Skip to content

Commit 934470e

Browse files
committed
test: report syntax errors
1 parent a7f3039 commit 934470e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: test/rules/index.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ const main = async () => {
2424
ecmaVersion: 6,
2525
};
2626

27-
const assertions = (await import(`./assertions/${camelCase(ruleName)}`)).default;
27+
// Catch syntax errors
28+
let assertions;
29+
try {
30+
assertions = (await import(`./assertions/${camelCase(ruleName)}`)).default;
31+
} catch (error) {
32+
// eslint-disable-next-line no-console -- Reporting back to tester
33+
console.error(error);
34+
return;
35+
}
2836

2937
if (!('meta' in rule && 'schema' in rule.meta) && (
3038
assertions.invalid.some((item) => {

0 commit comments

Comments
 (0)