forked from vue-a11y/eslint-plugin-vuejs-accessibility
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflat-config.spec.ts
40 lines (35 loc) · 1.02 KB
/
flat-config.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import cp from "child_process";
import path from "path";
import semver from "semver";
import { readPackageJson } from "./helper";
const ESLINT = `.${path.sep}node_modules${path.sep}.bin${path.sep}eslint`;
describe("Integration with flat config", () => {
let originalCwd: null | string = null;
beforeEach(() => {
originalCwd = process.cwd();
process.chdir(path.join(__dirname, "flat-config"));
cp.execSync("npm i -f", { stdio: "inherit" });
});
afterEach(() => {
originalCwd && process.chdir(originalCwd);
});
it("should work with config", () => {
if (
!semver.satisfies(
process.version,
readPackageJson(
path.resolve(__dirname, "flat-config/node_modules/eslint")
).engines.node
)
) {
return;
}
const result = JSON.parse(
cp.execSync(`${ESLINT} a.vue --max-warnings 1 --format=json`, {
encoding: "utf-8"
})
);
expect(result.length).toBe(1);
expect(result[0].messages[0].messageId).toBe("imgMissingAlt");
});
});