-
Notifications
You must be signed in to change notification settings - Fork 7
/
mod.test.ts
45 lines (42 loc) · 1.28 KB
/
mod.test.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
41
42
43
44
45
import { context } from "../../../../../cli/src/plugin/mod.ts";
import { assertEquals, deepMerge } from "../../../../../cli/deps.ts";
import { introspect } from "./mod.ts";
Deno.test("Plugins > _shared > ESLint - dedicated config and no ignore file", async () => {
const fakeContext = deepMerge(
context,
{
files: {
// deno-lint-ignore require-await
includes: async (glob: string): Promise<boolean> => {
if (glob === "**/.eslintrc.{js,cjs,yaml,yml,json}") {
return true;
}
return false;
},
},
},
);
const result = await introspect(fakeContext);
assertEquals(result, { name: "eslint", hasIgnoreFile: false });
});
Deno.test("Plugins > _shared > ESLint - dedicated config and ignore file", async () => {
const fakeContext = deepMerge(
context,
{
files: {
// deno-lint-ignore require-await
includes: async (glob: string): Promise<boolean> => {
if (
glob === "**/.eslintrc.{js,cjs,yaml,yml,json}" ||
glob === "**/.eslintignore"
) {
return true;
}
return false;
},
},
},
);
const result = await introspect(fakeContext);
assertEquals(result, { name: "eslint", hasIgnoreFile: true });
});