25 lines
958 B
JavaScript
25 lines
958 B
JavaScript
import assert from "node:assert/strict";
|
|
import { execPath } from "node:process";
|
|
import { spawnSync } from "node:child_process";
|
|
import { dirname, resolve } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const frontendRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
const eslintCli = resolve(frontendRoot, "node_modules/eslint/bin/eslint.js");
|
|
const fixtures = [
|
|
"scripts/fixtures/src/features/search/ui/search.ts",
|
|
"scripts/fixtures/src/features/search/ui/entry.ts",
|
|
];
|
|
const result = spawnSync(execPath, [eslintCli, "--format", "json", ...fixtures], {
|
|
cwd: frontendRoot,
|
|
encoding: "utf8",
|
|
});
|
|
|
|
assert.notEqual(result.status, 0, "ESLint accepted an import from a peer feature slice.");
|
|
const reports = JSON.parse(result.stdout);
|
|
assert.equal(reports.length, fixtures.length);
|
|
for (const report of reports) {
|
|
assert.equal(report.errorCount, 1);
|
|
assert.equal(report.messages[0]?.ruleId, "boundaries/dependencies");
|
|
}
|