diff options
author | Kristóf Marussy <kristof@marussy.com> | 2022-05-26 11:20:00 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2022-05-27 21:07:44 +0200 |
commit | 4ed5115c2b06f204fd0aa3351d8acaee6884444f (patch) | |
tree | 121501617c3f3948ecf5911bfb13085dc994469d | |
parent | test(shared): ServiceBase tests (diff) | |
download | sophie-4ed5115c2b06f204fd0aa3351d8acaee6884444f.tar.gz sophie-4ed5115c2b06f204fd0aa3351d8acaee6884444f.tar.zst sophie-4ed5115c2b06f204fd0aa3351d8acaee6884444f.zip |
build: fix test rootDir configuration
Each package should load the tests from its src directory only.
Signed-off-by: Kristóf Marussy <kristof@marussy.com>
-rw-r--r-- | jest.config.js | 2 | ||||
-rw-r--r-- | jest.integ.config.cjs | 2 | ||||
-rw-r--r-- | packages/main/jest.config.js | 6 | ||||
-rw-r--r-- | packages/main/jest.integ.config.cjs | 1 | ||||
-rw-r--r-- | packages/preload/jest.config.js | 6 | ||||
-rw-r--r-- | packages/renderer/jest.config.js | 5 | ||||
-rw-r--r-- | packages/service-shared/tsconfig.json | 2 | ||||
-rw-r--r-- | packages/shared/jest.config.js | 6 | ||||
-rw-r--r-- | packages/shared/tsconfig.json | 9 | ||||
-rw-r--r-- | packages/test-utils/tsconfig.json | 2 |
10 files changed, 26 insertions, 15 deletions
diff --git a/jest.config.js b/jest.config.js index 4e765f0..3e1f9ce 100644 --- a/jest.config.js +++ b/jest.config.js | |||
@@ -1,7 +1,7 @@ | |||
1 | /** @type {import('@jest/types').Config.InitialOptions} */ | 1 | /** @type {import('@jest/types').Config.InitialOptions} */ |
2 | export default { | 2 | export default { |
3 | projects: ['<rootDir>/packages/*/jest.config.js'], | 3 | projects: ['<rootDir>/packages/*/jest.config.js'], |
4 | collectCoverageFrom: ['src/**/*.{ts,tsx}'], | 4 | collectCoverageFrom: ['**/*.{ts,tsx}'], |
5 | /** @type {'v8'} */ | 5 | /** @type {'v8'} */ |
6 | coverageProvider: 'v8', | 6 | coverageProvider: 'v8', |
7 | /** @type {['cobertura', 'text']} */ | 7 | /** @type {['cobertura', 'text']} */ |
diff --git a/jest.integ.config.cjs b/jest.integ.config.cjs index 271cf93..dcb3a04 100644 --- a/jest.integ.config.cjs +++ b/jest.integ.config.cjs | |||
@@ -1,7 +1,7 @@ | |||
1 | /** @type {import('@jest/types').Config.InitialOptions} */ | 1 | /** @type {import('@jest/types').Config.InitialOptions} */ |
2 | module.exports = { | 2 | module.exports = { |
3 | projects: ['<rootDir>/packages/*/jest.integ.config.cjs'], | 3 | projects: ['<rootDir>/packages/*/jest.integ.config.cjs'], |
4 | collectCoverageFrom: ['src/**/*.{ts,tsx}'], | 4 | collectCoverageFrom: ['**/*.{ts,tsx}'], |
5 | /** @type {'v8'} */ | 5 | /** @type {'v8'} */ |
6 | coverageProvider: 'v8', | 6 | coverageProvider: 'v8', |
7 | /** @type {['cobertura', 'text']} */ | 7 | /** @type {['cobertura', 'text']} */ |
diff --git a/packages/main/jest.config.js b/packages/main/jest.config.js index 9aaf344..c595d8d 100644 --- a/packages/main/jest.config.js +++ b/packages/main/jest.config.js | |||
@@ -1,4 +1,6 @@ | |||
1 | import baseConfig from '../../config/jest.config.base.js'; | 1 | import baseConfig from '../../config/jest.config.base.js'; |
2 | 2 | ||
3 | // eslint-disable-next-line unicorn/prefer-export-from -- Can't export from default. | 3 | export default { |
4 | export default baseConfig; | 4 | ...baseConfig, |
5 | rootDir: 'src', | ||
6 | }; | ||
diff --git a/packages/main/jest.integ.config.cjs b/packages/main/jest.integ.config.cjs index 474d722..db767ab 100644 --- a/packages/main/jest.integ.config.cjs +++ b/packages/main/jest.integ.config.cjs | |||
@@ -5,6 +5,7 @@ const baseConfig = require('../../config/jest.config.base.cjs'); | |||
5 | /** @type {import('@jest/types').Config.InitialOptions} */ | 5 | /** @type {import('@jest/types').Config.InitialOptions} */ |
6 | module.exports = { | 6 | module.exports = { |
7 | ...baseConfig, | 7 | ...baseConfig, |
8 | rootDir: 'src', | ||
8 | globalSetup: path.join(__dirname, '../../config/electronJestGlobalSetup.cjs'), | 9 | globalSetup: path.join(__dirname, '../../config/electronJestGlobalSetup.cjs'), |
9 | globalTeardown: path.join( | 10 | globalTeardown: path.join( |
10 | __dirname, | 11 | __dirname, |
diff --git a/packages/preload/jest.config.js b/packages/preload/jest.config.js index 27af475..24aa9e2 100644 --- a/packages/preload/jest.config.js +++ b/packages/preload/jest.config.js | |||
@@ -1,7 +1,7 @@ | |||
1 | import rootConfig from '../../config/jest.config.base.js'; | 1 | import baseConfig from '../../config/jest.config.base.js'; |
2 | 2 | ||
3 | /** @type {import('@jest/types').Config.InitialOptions} */ | 3 | /** @type {import('@jest/types').Config.InitialOptions} */ |
4 | export default { | 4 | export default { |
5 | ...rootConfig, | 5 | ...baseConfig, |
6 | testEnvironment: 'jsdom', | 6 | rootDir: 'src', |
7 | }; | 7 | }; |
diff --git a/packages/renderer/jest.config.js b/packages/renderer/jest.config.js index 27af475..3abeb8b 100644 --- a/packages/renderer/jest.config.js +++ b/packages/renderer/jest.config.js | |||
@@ -1,7 +1,8 @@ | |||
1 | import rootConfig from '../../config/jest.config.base.js'; | 1 | import baseConfig from '../../config/jest.config.base.js'; |
2 | 2 | ||
3 | /** @type {import('@jest/types').Config.InitialOptions} */ | 3 | /** @type {import('@jest/types').Config.InitialOptions} */ |
4 | export default { | 4 | export default { |
5 | ...rootConfig, | 5 | ...baseConfig, |
6 | rootDir: 'src', | ||
6 | testEnvironment: 'jsdom', | 7 | testEnvironment: 'jsdom', |
7 | }; | 8 | }; |
diff --git a/packages/service-shared/tsconfig.json b/packages/service-shared/tsconfig.json index daad7c4..e0f7223 100644 --- a/packages/service-shared/tsconfig.json +++ b/packages/service-shared/tsconfig.json | |||
@@ -5,7 +5,7 @@ | |||
5 | "emitDeclarationOnly": false, | 5 | "emitDeclarationOnly": false, |
6 | "declarationDir": null, | 6 | "declarationDir": null, |
7 | "noEmit": true, | 7 | "noEmit": true, |
8 | "rootDir": null | 8 | "rootDir": "../.." |
9 | }, | 9 | }, |
10 | "include": ["src/**/*.ts", ".eslintrc.cjs", "esbuild.config.js"] | 10 | "include": ["src/**/*.ts", ".eslintrc.cjs", "esbuild.config.js"] |
11 | } | 11 | } |
diff --git a/packages/shared/jest.config.js b/packages/shared/jest.config.js index 9aaf344..c595d8d 100644 --- a/packages/shared/jest.config.js +++ b/packages/shared/jest.config.js | |||
@@ -1,4 +1,6 @@ | |||
1 | import baseConfig from '../../config/jest.config.base.js'; | 1 | import baseConfig from '../../config/jest.config.base.js'; |
2 | 2 | ||
3 | // eslint-disable-next-line unicorn/prefer-export-from -- Can't export from default. | 3 | export default { |
4 | export default baseConfig; | 4 | ...baseConfig, |
5 | rootDir: 'src', | ||
6 | }; | ||
diff --git a/packages/shared/tsconfig.json b/packages/shared/tsconfig.json index daad7c4..eb1e81d 100644 --- a/packages/shared/tsconfig.json +++ b/packages/shared/tsconfig.json | |||
@@ -5,7 +5,12 @@ | |||
5 | "emitDeclarationOnly": false, | 5 | "emitDeclarationOnly": false, |
6 | "declarationDir": null, | 6 | "declarationDir": null, |
7 | "noEmit": true, | 7 | "noEmit": true, |
8 | "rootDir": null | 8 | "rootDir": "../.." |
9 | }, | 9 | }, |
10 | "include": ["src/**/*.ts", ".eslintrc.cjs", "esbuild.config.js"] | 10 | "include": [ |
11 | "src/**/*.ts", | ||
12 | ".eslintrc.cjs", | ||
13 | "esbuild.config.js", | ||
14 | "jest.config.js" | ||
15 | ] | ||
11 | } | 16 | } |
diff --git a/packages/test-utils/tsconfig.json b/packages/test-utils/tsconfig.json index d01eb81..bca0327 100644 --- a/packages/test-utils/tsconfig.json +++ b/packages/test-utils/tsconfig.json | |||
@@ -5,7 +5,7 @@ | |||
5 | "emitDeclarationOnly": false, | 5 | "emitDeclarationOnly": false, |
6 | "declarationDir": null, | 6 | "declarationDir": null, |
7 | "noEmit": true, | 7 | "noEmit": true, |
8 | "rootDir": null, | 8 | "rootDir": "../..", |
9 | "types": ["@types/jest", "node"] | 9 | "types": ["@types/jest", "node"] |
10 | }, | 10 | }, |
11 | "include": ["src/**/*.ts", ".eslintrc.cjs"] | 11 | "include": ["src/**/*.ts", ".eslintrc.cjs"] |