Skip to content

Commit

Permalink
fix: πŸ› don't apply jest,vitest & testing-library to e2e files
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmy-guzman committed Nov 23, 2024
1 parent 321d018 commit 3ecd068
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 34 deletions.
8 changes: 1 addition & 7 deletions src/configs/testing-library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,13 @@ export const testingLibrary = async () => {
return [
{
files: GLOB_TESTS,
ignores: GLOB_E2E,
name: "jimmy.codes/testing/testing-library",
plugins: {
"jest-dom": jestDom,
"testing-library": testingLibrary,
},
rules: await testingLibraryRules(),
},
{
files: GLOB_E2E,
name: "jimmy.codes/testing/testing-library/disabled",
rules: {
"testing-library/prefer-screen-queries": "off",
},
},
] satisfies TypedConfigItem[];
};
6 changes: 0 additions & 6 deletions src/configs/testing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,4 @@ 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");
});
});
14 changes: 3 additions & 11 deletions src/configs/testing.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Rules, TestingOptions, TypedConfigItem } from "../types";
import type { TestingOptions, TypedConfigItem } from "../types";

import { GLOB_E2E, GLOB_TESTS } from "../constants";
import { jestRules } from "../rules/jest";
Expand All @@ -20,6 +20,7 @@ export const testingConfig = async (

configs.push({
files: GLOB_TESTS,
ignores: GLOB_E2E,
...jestPlugin.configs["flat/recommended"],
name: "jimmy.codes/vitest",
rules: await vitestRules(),
Expand All @@ -31,21 +32,12 @@ export const testingConfig = async (

configs.push({
files: GLOB_TESTS,
ignores: GLOB_E2E,
...jestPlugin.configs["flat/recommended"],
name: "jimmy.codes/jest",
rules: await jestRules(),
});
}

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;
};
10 changes: 0 additions & 10 deletions src/factory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ describe("jimmyDotCodes", () => {
jimmyDotCodes({ autoDetect: false, testing: { framework: "jest" } }),
).resolves.toStrictEqual(
expect.arrayContaining([
expect.objectContaining({ name: "jimmy.codes/e2e" }),
expect.objectContaining({ name: "jimmy.codes/jest" }),
expect.not.objectContaining({ name: "jimmy.codes/vitest" }),
]),
Expand All @@ -77,7 +76,6 @@ describe("jimmyDotCodes", () => {
jimmyDotCodes({ autoDetect: false, testing: true }),
).resolves.toStrictEqual(
expect.arrayContaining([
expect.objectContaining({ name: "jimmy.codes/e2e" }),
expect.not.objectContaining({ name: "jimmy.codes/jest" }),
expect.objectContaining({ name: "jimmy.codes/vitest" }),
]),
Expand All @@ -93,15 +91,11 @@ describe("jimmyDotCodes", () => {
}),
).resolves.toStrictEqual(
expect.arrayContaining([
expect.objectContaining({ name: "jimmy.codes/e2e" }),
expect.objectContaining({ name: "jimmy.codes/jest" }),
expect.objectContaining({ name: "jimmy.codes/react" }),
expect.objectContaining({
name: "jimmy.codes/testing/testing-library",
}),
expect.objectContaining({
name: "jimmy.codes/testing/testing-library/disabled",
}),
]),
);
});
Expand All @@ -115,15 +109,11 @@ describe("jimmyDotCodes", () => {
}),
).resolves.toStrictEqual(
expect.arrayContaining([
expect.objectContaining({ name: "jimmy.codes/e2e" }),
expect.objectContaining({ name: "jimmy.codes/vitest" }),
expect.objectContaining({ name: "jimmy.codes/react" }),
expect.objectContaining({
name: "jimmy.codes/testing/testing-library",
}),
expect.objectContaining({
name: "jimmy.codes/testing/testing-library/disabled",
}),
]),
);
});
Expand Down

0 comments on commit 3ecd068

Please sign in to comment.