diff options
author | Kristóf Marussy <kristof@marussy.com> | 2021-12-31 01:52:28 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2021-12-31 01:56:30 +0100 |
commit | 7108c642f4ff6dc5f0c4d30b8a8960064ff8e90f (patch) | |
tree | f8c0450a6e1b62f7e7f8470efd375b3659b91b2b /jest.config.js | |
parent | refactor: Install devtools extensions earlier (diff) | |
download | sophie-7108c642f4ff6dc5f0c4d30b8a8960064ff8e90f.tar.gz sophie-7108c642f4ff6dc5f0c4d30b8a8960064ff8e90f.tar.zst sophie-7108c642f4ff6dc5f0c4d30b8a8960064ff8e90f.zip |
test: Add tests for main package
- Changed jest to run from the root package and reference the packages
as projects. This required moving the base jest config file away from
the project root.
- Module isolation seems to prevent ts-jest from loading the shared
package, so we disabled it for now.
- To better facilitate mocking, services should be split into interfaces
and implementation
- Had to downgrade to chald 4.1.2 as per
https://github.com/chalk/chalk/releases/tag/v5.0.0 at least until
https://github.com/microsoft/TypeScript/issues/46452 is resolved.
Diffstat (limited to 'jest.config.js')
-rw-r--r-- | jest.config.js | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/jest.config.js b/jest.config.js index 1aa0cbb..414e49f 100644 --- a/jest.config.js +++ b/jest.config.js | |||
@@ -1,27 +1,6 @@ | |||
1 | import { join } from 'path'; | ||
2 | |||
3 | import { fileURLToDirname } from './config/build-common.js'; | ||
4 | |||
5 | const dirname = fileURLToDirname(import.meta.url); | ||
6 | |||
7 | /** @type {import('ts-jest').InitialOptionsTsJest} */ | 1 | /** @type {import('ts-jest').InitialOptionsTsJest} */ |
8 | export default { | 2 | export default { |
9 | preset: 'ts-jest/presets/default-esm', | 3 | projects: [ |
10 | globals: { | 4 | '<rootDir>/packages/*', |
11 | 'ts-jest': { | ||
12 | isolatedModules: true, | ||
13 | useESM: true, | ||
14 | }, | ||
15 | }, | ||
16 | moduleNameMapper: { | ||
17 | '@sophie/(.+)': join(dirname, 'packages/$1/src/index.ts'), | ||
18 | '^(\\.{1,2}/.*)\\.js$': '$1', | ||
19 | }, | ||
20 | resetMocks: true, | ||
21 | restoreMocks: true, | ||
22 | testEnvironment: 'node', | ||
23 | testPathIgnorePatterns: [ | ||
24 | '/dist/', | ||
25 | '/node_modules/', | ||
26 | ], | 5 | ], |
27 | }; | 6 | }; |