20 lines
1,001 B
JavaScript
20 lines
1,001 B
JavaScript
// Rôle : vérifie les règles React actives et l'exclusion des artefacts générés du lint.
|
|
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { ESLint } from "eslint";
|
|
|
|
test("React effect and purity checks are enabled for application sources", async () => {
|
|
const eslint = new ESLint();
|
|
const config = await eslint.calculateConfigForFile("website/src/main.jsx");
|
|
for (const rule of ["react-hooks/set-state-in-effect", "react-hooks/purity", "react-hooks/rules-of-hooks", "react-hooks/exhaustive-deps"]) {
|
|
assert.ok(config.rules[rule][0] > 0, `${rule} must remain enabled`);
|
|
}
|
|
});
|
|
|
|
test("browser reports are ignored without excluding authored E2E tests", async () => {
|
|
const eslint = new ESLint();
|
|
for (const path of ["playwright-report/trace/assets/viewer.js", "test-results/production/trace.js"]) {
|
|
assert.equal(await eslint.isPathIgnored(path), true, path);
|
|
}
|
|
assert.equal(await eslint.isPathIgnored("e2e/nds-controls.spec.js"), false);
|
|
});
|