diff --git a/src/configs/testing.spec.ts b/src/configs/testing.spec.ts index d12fc28..653243b 100644 --- a/src/configs/testing.spec.ts +++ b/src/configs/testing.spec.ts @@ -3,7 +3,7 @@ import { testingConfig } from "./testing"; describe("testingConfig", () => { it("should create default config w/ vitest overrides", async () => { - const [, vitest] = await testingConfig({}, false); + const [vitest] = await testingConfig({}, false); expect(vitest?.rules).toStrictEqual( expect.objectContaining({ @@ -19,7 +19,7 @@ describe("testingConfig", () => { }); it("should create default config w/o vitest overrides", async () => { - const [, jest] = await testingConfig({ framework: "jest" }, false); + const [jest] = await testingConfig({ framework: "jest" }, false); expect(jest?.rules).toStrictEqual( expect.not.objectContaining({ @@ -33,4 +33,10 @@ describe("testingConfig", () => { }), ); }); + + it("should create e2e config last", async () => { + const configs = await testingConfig({ framework: "jest" }, false); + + expect(configs.at(-1)?.name).toBe("jimmy.codes/e2e"); + }); }); diff --git a/src/configs/testing.ts b/src/configs/testing.ts index 1ad2039..c2c0ef6 100644 --- a/src/configs/testing.ts +++ b/src/configs/testing.ts @@ -13,17 +13,7 @@ export const testingConfig = async ( const isVitest = autoDetect ? hasVitest() : framework === "vitest"; const isJest = framework === "jest" || (autoDetect && hasJest()); - const configs: TypedConfigItem[] = [ - { - files: GLOB_E2E, - name: "jimmy.codes/e2e", - rules: { - "jest/expect-expect": "off", - "jest/no-deprecated-functions": "off", - "jest/require-hook": "off", - } satisfies Rules, - }, - ]; + const configs: TypedConfigItem[] = []; if (isVitest) { const jestPlugin = await interopDefault(import("eslint-plugin-jest")); @@ -47,5 +37,15 @@ export const testingConfig = async ( }); } + configs.push({ + files: GLOB_E2E, + name: "jimmy.codes/e2e", + rules: { + "jest/expect-expect": "off", + "jest/no-deprecated-functions": "off", + "jest/require-hook": "off", + } satisfies Rules, + }); + return configs; };