From 6b54e0e4afd782387925cbbf6d2590b648f487c4 Mon Sep 17 00:00:00 2001 From: Nicolas Thouvenin Date: Thu, 8 Aug 2024 16:24:42 +0200 Subject: [PATCH] refactor jest config --- jest.config.js | 10 ++++++++++ package.json | 8 ++++---- src/api/e2e/jest.config.js | 3 --- 3 files changed, 14 insertions(+), 7 deletions(-) delete mode 100644 src/api/e2e/jest.config.js diff --git a/jest.config.js b/jest.config.js index cbd424e91..0d686c949 100644 --- a/jest.config.js +++ b/jest.config.js @@ -16,6 +16,16 @@ module.exports = { testPathIgnorePatterns: ['e2e'], testMatch: ['/**/*.spec.js'], }, + { + displayName: 'api-e2e', + rootDir: `${__dirname}/src/api/e2e`, + testEnvironment: 'node', + testMatch: ['/**/*.spec.js'], + moduleDirectories: ['node_modules'], + transformIgnorePatterns: [ + '/node_modules/', + ], + }, { displayName: 'common', rootDir: `${__dirname}/src/common`, diff --git a/package.json b/package.json index 8e783b3f8..a8109947f 100644 --- a/package.json +++ b/package.json @@ -24,10 +24,10 @@ "clean:modules": "modclean -Pr -n ./modclean.config.js:*", "clean:workers": "modclean -Pr -n ./modclean.config.js:* -D workers", "clean:packages": "modclean -Pr -n ./modclean.config.js:* -D packages", - "test:api:e2e": "./node_modules/jest/bin/jest.js --colors --runInBand --detectOpenHandles -c src/api/e2e/jest.config.js src/api/e2e", - "test:api:e2e:watch": "./node_modules/jest/bin/jest.js --colors --runInBand --detectOpenHandles -c src/api/e2e/jest.config.js src/api/e2e --watch", - "test:unit": "./node_modules/jest/bin/jest.js --force-exit --detectOpenHandles --colors", - "test:unit:watch": "./node_modules/jest/bin/jest.js --watch --colors", + "test:api:e2e": "jest --colors --runInBand --detectOpenHandles --projects api-e2e", + "test:api:e2e:watch": "jest --colors --runInBand --detectOpenHandles --projects api-e2e --watch", + "test:unit": "jest --force-exit --detectOpenHandles --colors --ignoreProjects api-e2e", + "test:unit:watch": "jest --watch --colors --ignoreProjects api-e2e", "test:e2e:phase:one": "cypress run --browser chrome --spec \"cypress/e2e/phase_1/*.cy.js\"", "test:e2e:phase:two": "cypress run --browser chrome --spec \"cypress/e2e/phase_2/*.cy.js\"", "test:e2e:phase:three": "cypress run --browser chrome --spec \"cypress/e2e/phase_3/*.cy.js\"", diff --git a/src/api/e2e/jest.config.js b/src/api/e2e/jest.config.js deleted file mode 100644 index 658c20ec0..000000000 --- a/src/api/e2e/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - testEnvironment: 'node', -};