aboutsummaryrefslogtreecommitdiffstats
path: root/jest.config.js
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-30 12:05:27 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-30 12:05:27 +0100
commit62d816402c6ddccf22c9ac68822cf100f61662d6 (patch)
tree3963ce347ea0278e22f63eb16615ef3a23c23bf9 /jest.config.js
parentbuild: Simplify clean script (diff)
downloadsophie-62d816402c6ddccf22c9ac68822cf100f61662d6.tar.gz
sophie-62d816402c6ddccf22c9ac68822cf100f61662d6.tar.zst
sophie-62d816402c6ddccf22c9ac68822cf100f61662d6.zip
build: Use shared packages through modules
By running the build for the shared packages only once, errors in them are reported only once in watch mode. We still have to point jest to the original source files (and rebuild the shared source files as part of the test), because it won't load the "module" entry of the shared packages. However, as a benefit, jest can now run even if the shared packages haven't been built yet.
Diffstat (limited to 'jest.config.js')
-rw-r--r--jest.config.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/jest.config.js b/jest.config.js
index 6943513..d0ba361 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -1,5 +1,7 @@
1// @ts-check 1// @ts-check
2 2
3const { join } = require('path');
4
3/** @type {import('ts-jest').InitialOptionsTsJest} */ 5/** @type {import('ts-jest').InitialOptionsTsJest} */
4module.exports = { 6module.exports = {
5 preset: 'ts-jest', 7 preset: 'ts-jest',
@@ -8,6 +10,9 @@ module.exports = {
8 isolatedModules: true, 10 isolatedModules: true,
9 }, 11 },
10 }, 12 },
13 moduleNameMapper: {
14 '@sophie/(.+)': join(__dirname, 'packages/$1/src/index.ts'),
15 },
11 resetMocks: true, 16 resetMocks: true,
12 restoreMocks: true, 17 restoreMocks: true,
13 testEnvironment: 'node', 18 testEnvironment: 'node',