Skip to content

Commit 956b45a

Browse files
committed
Add test for React detection warning
1 parent fea8749 commit 956b45a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/config.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ const { CLIEngine } = require('eslint');
44

55
describe('config', () => {
66
it('works', () => {
7+
console.error = jest.fn();
8+
79
const cli = new CLIEngine({
810
useEslintrc: false,
911
configFile: path.join(__dirname, '..', 'config.js'),
@@ -13,5 +15,10 @@ describe('config', () => {
1315
errorCount: 2,
1416
warningCount: 0,
1517
});
18+
19+
// This project does not depend on React, so using the config will log an error.
20+
expect(console.error).toHaveBeenCalledWith(
21+
'Warning: React version was set to "detect" in eslint-plugin-react settings, but the "react" package is not installed. Assuming latest React version for linting.',
22+
);
1623
});
1724
});

0 commit comments

Comments
 (0)