Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly set the errored property for --report options #5079

Merged
merged 4 commits into from Jan 12, 2021

Conversation

nex3
Copy link
Contributor

@nex3 nex3 commented Dec 15, 2020

This sets the errored property (and thus the exit code) as long as
any warning has severity "error", which includes warnings generated by
--report options.

Closes #5046

This sets the `errored` property (and thus the exit code) as long as
any warning has severity "error", which includes warnings generated by
--report options.
Copy link
Member

@hudochenkov hudochenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it is possible to add a test for this?

We have tests for different exit codes in https://github.com/stylelint/stylelint/blob/master/lib/__tests__/cli.test.js.

@nex3
Copy link
Contributor Author

nex3 commented Dec 15, 2020

There are already tests in there that verify the exit codes for report flags:

it('reports disallowed disables', async () => {
await cli([
'--config',
replaceBackslashes(path.join(fixturesPath, 'config-block-no-empty-report-disables.json')),
replaceBackslashes(path.join(fixturesPath, 'empty-block-with-relevant-disable.css')),
]);
expect(process.exitCode).toBe(2);
expect(process.stdout.write).toHaveBeenCalledTimes(1);
expect(process.stdout.write).toHaveBeenCalledWith(
expect.stringContaining('Rule "block-no-empty" may not be disabled'),
);
});

It's not clear to me why that wasn't failing prior to this PR, or how to write a test that wouldn't just recapitulate what that test is already doing.

@nex3 nex3 requested a review from hudochenkov January 8, 2021 01:25
@vankop
Copy link
Member

vankop commented Jan 8, 2021

@nex3 @hudochenkov please rereview

system-tests/004/fs.test.js Outdated Show resolved Hide resolved
@jeddy3 jeddy3 mentioned this pull request Jan 11, 2021
6 tasks
@nex3
Copy link
Contributor Author

nex3 commented Jan 11, 2021

Tests look good to me, just need @vankop to approve the PR and I can land it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Fix regression where report flags don't exit with non-zero
3 participants