Skip to content

Commit

Permalink
Chore: Repro missing built-in rule validation (refs #13793)
Browse files Browse the repository at this point in the history
The bulk of our tests for rule schemas are isolated unit tests of
`ConfigValidator`. This is a single test to be sure we actually run rule
schema validation end-to-end and prevent cases like #13793.

After I run a patch release of `@eslint/eslintrc`, I'll push a second
commit on this branch to bump the dependency version and fix the test.
  • Loading branch information
btmills committed Oct 26, 2020
1 parent 631ae8b commit 36ee8ab
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/lib/eslint/eslint.js
Expand Up @@ -3919,6 +3919,26 @@ describe("ESLint", () => {

await assert.rejects(() => eslint.calculateConfigForFile(null), /'filePath' must be a non-empty string/u);
});

// https://github.com/eslint/eslint/issues/13793
it("should throw with an invalid built-in rule config", async () => {
const options = {
baseConfig: {
rules: {
"no-alert": ["error", {
thisDoesNotExist: true
}]
}
}
};
const engine = new ESLint(options);
const filePath = getFixturePath("single-quoted.js");

await assert.rejects(
() => engine.calculateConfigForFile(filePath),
/Configuration for rule "no-alert" is invalid:/u
);
});
});

describe("isPathIgnored", () => {
Expand Down

0 comments on commit 36ee8ab

Please sign in to comment.