Skip to content

Commit

Permalink
[Tests] no-unused-modules: properly skip in mocha 3
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jul 27, 2023
1 parent 68bf510 commit a6de522
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions tests/src/rules/no-unused-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -1374,19 +1374,21 @@ describe('parser ignores prefixes like BOM and hashbang', () => {
});
});

describe('supports flat eslint', { skip: !FlatRuleTester }, () => {
const flatRuleTester = new FlatRuleTester();
flatRuleTester.run('no-unused-modules', rule, {
valid: [{
options: unusedExportsOptions,
code: 'import { o2 } from "./file-o"; export default () => 12',
filename: testFilePath('./no-unused-modules/file-a.js'),
}],
invalid: [{
options: unusedExportsOptions,
code: 'export default () => 13',
filename: testFilePath('./no-unused-modules/file-f.js'),
errors: [error(`exported declaration 'default' not used within other modules`)],
}],
(FlatRuleTester ? describe : describe.skip)('supports flat eslint', () => {
it('passes', () => {
const flatRuleTester = new FlatRuleTester();
flatRuleTester.run('no-unused-modules', rule, {
valid: [{
options: unusedExportsOptions,
code: 'import { o2 } from "./file-o"; export default () => 12',
filename: testFilePath('./no-unused-modules/file-a.js'),
}],
invalid: [{
options: unusedExportsOptions,
code: 'export default () => 13',
filename: testFilePath('./no-unused-modules/file-f.js'),
errors: [error(`exported declaration 'default' not used within other modules`)],
}],
});
});
});

0 comments on commit a6de522

Please sign in to comment.