Skip to content

Commit

Permalink
chore: avoid reporting of flat config rules when single rule requested
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Mar 31, 2023
1 parent 671a40b commit 0453fe6
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions test/rules/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,25 @@ const main = async () => {
ruleTester.run(ruleName, rule, assertions);
}

// Catch syntax errors
let flatRuleNames;
try {
flatRuleNames = (await import('./assertions/flatConfig.js')).default;
} catch (error) {
// eslint-disable-next-line no-console -- Reporting back to tester
console.error(error);
return;
}
if (!process.env.npm_config_rule) {
// Catch syntax errors
let flatRuleNames;
try {
flatRuleNames = (await import('./assertions/flatConfig.js')).default;
} catch (error) {
// eslint-disable-next-line no-console -- Reporting back to tester
console.error(error);
return;
}

const fakeRuleTester = new FlatRuleTester();
for (const [
ruleName,
assertions,
] of Object.entries(flatRuleNames)) {
const rule = config.rules[ruleName];
fakeRuleTester.run(ruleName, rule, assertions);
const fakeRuleTester = new FlatRuleTester();
for (const [
ruleName,
assertions,
] of Object.entries(flatRuleNames)) {
const rule = config.rules[ruleName];
fakeRuleTester.run(ruleName, rule, assertions);
}
}
};

Expand Down

0 comments on commit 0453fe6

Please sign in to comment.