Skip to content

Commit

Permalink
fix(test): move jest configuration options unallowed in project confi…
Browse files Browse the repository at this point in the history
…g to global
  • Loading branch information
artus9033 committed Aug 14, 2024
1 parent 4e88477 commit 5538f99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
13 changes: 12 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
import type { Config } from "jest";

import { testPathIgnorePatterns } from "./tests/__config__/commonJestConfig";

// since jest projects don't inherit from root config, we instead use tests/__config__/commonJestConfig.ts
// thus, here we want just to define projects' configs; see https://github.com/jestjs/jest/issues/10991
const config: Pick<Config, "projects"> = {
const config: Pick<
Config,
| "projects"
| "coverageReporters"
| "collectCoverageFrom"
| "coveragePathIgnorePatterns"
> = {
projects: [
"<rootDir>/tests/unit/jest.unit.config.ts",
"<rootDir>/tests/integration/jest.integration.config.ts",
],
collectCoverageFrom: ["src/*.{js,ts,jsx,tsx}"],
coverageReporters: ["lcov", "json"],
coveragePathIgnorePatterns: testPathIgnorePatterns,
};

export default config;
5 changes: 1 addition & 4 deletions tests/__config__/commonJestConfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Config } from "jest";

const testPathIgnorePatterns: string[] = [
export const testPathIgnorePatterns: string[] = [
"__utils__",
"__fixtures__",
"__mocks__",
Expand Down Expand Up @@ -29,9 +29,6 @@ const config: Config = {
testEnvironmentOptions: {
customExportConditions: ["node", "node-addons"],
},
collectCoverageFrom: ["src/*.{js,ts,jsx,tsx}"],
coverageReporters: ["lcov", "json"],
coveragePathIgnorePatterns: testPathIgnorePatterns,
};

export default config;

0 comments on commit 5538f99

Please sign in to comment.