diff --git a/packages/web-react/config/jest/config.js b/packages/web-react/config/jest/config.js deleted file mode 100644 index 8ae6d64f4a..0000000000 --- a/packages/web-react/config/jest/config.js +++ /dev/null @@ -1,62 +0,0 @@ -const config = { - // The root directory that Jest should scan for tests and modules within. - // https://jestjs.io/docs/configuration#rootdir-string - rootDir: '../../', - - // This option tells Jest that all imported modules in your tests should be mocked automatically. - // https://jestjs.io/docs/configuration#automock-boolean - automock: false, - - // Indicates whether each individual test should be reported during the run. - // https://jestjs.io/docs/configuration#verbose-boolean - verbose: false, - - // A list of paths to modules that run some code to configure or set up the testing environment. - // https://jestjs.io/docs/configuration#setupfiles-array - setupFiles: ['/config/jest/setup.js'], - - // A list of paths to modules that run some code to configure or set up the testing framework before each test file in the suite is executed. - // https://jestjs.io/docs/configuration#setupfilesafterenv-array - setupFilesAfterEnv: ['/config/jest/setupTestingLibrary.ts'], - - // A map from regular expressions to paths to transformers - // https://jestjs.io/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object - transform: { - '^.+\\.(t|j)sx?$': ['/../../node_modules/@swc/jest'], - }, - - // This line is because of polyfill for useResizeHook - // An array of regexp pattern strings that are matched against all source file paths before transformation. - // https://jestjs.io/docs/configuration#transformignorepatterns-arraystring - transformIgnorePatterns: ['/../../node_modules/@juggle/resize-observer'], - - // The test environment that will be used for testing. - // https://jestjs.io/docs/configuration#testenvironment-string - testEnvironment: 'jsdom', - - // An array of regexp pattern strings that are matched against all test paths before executing the test - // https://jestjs.io/docs/configuration#testpathignorepatterns-arraystring - testPathIgnorePatterns: ['/dist/', '/node_modules/', '.*__tests__/.*DataProvider.ts'], - - // The directory where Jest should output its coverage files. - // https://jestjs.io/docs/configuration#coveragedirectory-string - coverageDirectory: './.coverage', - - // An array of glob patterns indicating a set of files for which coverage information should be collected. - // https://jestjs.io/docs/configuration#collectcoveragefrom-array - collectCoverageFrom: ['/src/**/*.{js,jsx,ts,tsx}', '!/src/**/*.d.ts'], - - // An array of regexp pattern strings that are matched against all file paths before executing the test. - // https://jestjs.io/docs/configuration#coveragepathignorepatterns-arraystring - coveragePathIgnorePatterns: ['__fixtures__', '.*.stories.*', '/stories/.*', '/demo/.*'], - - // A list of reporter names that Jest uses when writing coverage reports. Any istanbul reporter can be used. - // https://jestjs.io/docs/configuration#coveragereporters-arraystring--string-options - coverageReporters: ['text', 'text-summary', ['lcov', { projectRoot: '../../' }]], - - // An array of regexp pattern strings that are matched against all module paths before those paths are 'visible' to the loader. - // https://jestjs.io/docs/configuration#modulepathignorepatterns-arraystring - modulePathIgnorePatterns: ['/dist'], -}; - -module.exports = config; diff --git a/packages/web-react/config/jest/setup.js b/packages/web-react/config/jest/setup.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/web-react/jest.config.ts b/packages/web-react/jest.config.ts new file mode 100644 index 0000000000..f2ff89dfb3 --- /dev/null +++ b/packages/web-react/jest.config.ts @@ -0,0 +1,14 @@ +const config = { + preset: 'jest-config-spirit/jsdom', + + /** + * @todo Move this configuration to the `jest-config-spirit` preset + * + * @see { @link https://github.com/lmc-eu/spirit-design-system/issues/1413 } + */ + // A list of paths to modules that run some code to configure or set up the testing framework before each test file in the suite is executed. + // https://jestjs.io/docs/configuration#setupfilesafterenv-array + setupFilesAfterEnv: ['/config/jest/setupTestingLibrary.ts'], +}; + +export default config; diff --git a/packages/web-react/package.json b/packages/web-react/package.json index 01188e95a8..df7f53a225 100644 --- a/packages/web-react/package.json +++ b/packages/web-react/package.json @@ -36,8 +36,6 @@ "@lmc-eu/spirit-design-tokens": "^1.1.6", "@lmc-eu/spirit-web": "^1.14.0", "@rollup/plugin-node-resolve": "15.2.3", - "@swc/core": "1.5.7", - "@swc/jest": "0.2.36", "@testing-library/dom": "9.3.4", "@testing-library/jest-dom": "6.4.5", "@testing-library/react": "14.3.1", @@ -62,8 +60,6 @@ "eslint-plugin-standard": "5.0.0", "glob": "10.3.15", "jest": "29.7.0", - "jest-cli": "29.7.0", - "jest-environment-jsdom": "29.7.0", "npm-run-all": "4.1.5", "react": "18.3.1", "react-dom": "18.3.1", @@ -105,7 +101,7 @@ "lint": "eslint ./", "lint:fix": "yarn lint --fix", "test": "npm-run-all --serial lint types test:unit:coverage", - "test:unit": "jest --config ./config/jest/config.js", + "test:unit": "jest", "test:unit:watch": "yarn test:unit --watchAll", "test:unit:coverage": "yarn test:unit --coverage" }, diff --git a/yarn.lock b/yarn.lock index 8b5671f482..3fe51bb373 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3816,11 +3816,8 @@ __metadata: resolution: "@lmc-eu/spirit-form-validations@workspace:packages/form-validations" dependencies: "@lmc-eu/browserslist-config": 2.0.0 - "@swc/core": 1.5.7 - "@swc/jest": 0.2.36 "@types/jest": 29.5.12 jest: 29.7.0 - jest-environment-jsdom: 29.7.0 npm-run-all: 4.1.5 sass: 1.77.1 shx: 0.3.4 @@ -3888,8 +3885,6 @@ __metadata: "@lmc-eu/spirit-web": ^1.14.0 "@react-hook/resize-observer": ^1.2.6 "@rollup/plugin-node-resolve": 15.2.3 - "@swc/core": 1.5.7 - "@swc/jest": 0.2.36 "@testing-library/dom": 9.3.4 "@testing-library/jest-dom": 6.4.5 "@testing-library/react": 14.3.1 @@ -3917,8 +3912,6 @@ __metadata: html-dom-parser: 5.0.8 html-react-parser: 5.1.10 jest: 29.7.0 - jest-cli: 29.7.0 - jest-environment-jsdom: 29.7.0 npm-run-all: 4.1.5 react: 18.3.1 react-dom: 18.3.1 @@ -3963,19 +3956,14 @@ __metadata: "@lmc-eu/spirit-icons": ^0.10.2 "@lmc-eu/stylelint-config": 7.0.1 "@rollup/plugin-typescript": 11.1.6 - "@swc/core": 1.5.7 - "@swc/jest": 0.2.36 "@types/jest": 29.5.12 autoprefixer: 10.4.19 clean-css-cli: 5.6.3 glob: 10.3.15 jest: 29.7.0 - jest-environment-jsdom: 29.7.0 - jest-environment-node-single-context: 29.4.0 npm-run-all: 4.1.5 postcss: 8.4.38 postcss-cli: 10.1.0 - resize-observer-polyfill: 1.5.1 rollup: 3.29.4 rollup-plugin-terser: 7.0.2 sass: 1.77.1 @@ -25931,7 +25919,7 @@ __metadata: languageName: node linkType: hard -"resize-observer-polyfill@npm:1.5.1, resize-observer-polyfill@npm:^1.5.1": +"resize-observer-polyfill@npm:^1.5.1": version: 1.5.1 resolution: "resize-observer-polyfill@npm:1.5.1" checksum: 57e7f79489867b00ba43c9c051524a5c8f162a61d5547e99333549afc23e15c44fd43f2f318ea0261ea98c0eb3158cca261e6f48d66e1ed1cd1f340a43977094