diff options
author | Kristóf Marussy <kristof@marussy.com> | 2022-01-27 18:26:21 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2022-02-08 21:43:18 +0100 |
commit | bfc1f4d55d02553f761fbc9acc5ed15103455149 (patch) | |
tree | cb1650750c2ff1587f7cd0fd215d2179822568ae /packages/main | |
parent | refactor: Extract main window hardening (diff) | |
download | sophie-bfc1f4d55d02553f761fbc9acc5ed15103455149.tar.gz sophie-bfc1f4d55d02553f761fbc9acc5ed15103455149.tar.zst sophie-bfc1f4d55d02553f761fbc9acc5ed15103455149.zip |
build: Add test-utils package
Added as a common devDependency, this lets us handle test utility code
from one place.
For now, the main reason for its existence is the workaround code for
importing jest-each from ESM.
Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'packages/main')
-rw-r--r-- | packages/main/package.json | 2 | ||||
-rw-r--r-- | packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.spec.ts | 6 | ||||
-rw-r--r-- | packages/main/tsconfig.json | 3 |
3 files changed, 5 insertions, 6 deletions
diff --git a/packages/main/package.json b/packages/main/package.json index ea10b84..4f4a6cb 100644 --- a/packages/main/package.json +++ b/packages/main/package.json | |||
@@ -27,6 +27,7 @@ | |||
27 | }, | 27 | }, |
28 | "devDependencies": { | 28 | "devDependencies": { |
29 | "@jest/globals": "^27.4.6", | 29 | "@jest/globals": "^27.4.6", |
30 | "@sophie/test-utils": "workspace:*", | ||
30 | "@types/deep-equal": "^1.0.1", | 31 | "@types/deep-equal": "^1.0.1", |
31 | "@types/electron-devtools-installer": "^2.2.1", | 32 | "@types/electron-devtools-installer": "^2.2.1", |
32 | "@types/lodash-es": "^4.17.5", | 33 | "@types/lodash-es": "^4.17.5", |
@@ -38,7 +39,6 @@ | |||
38 | "esbuild": "^0.14.14", | 39 | "esbuild": "^0.14.14", |
39 | "git-repo-info": "^2.1.1", | 40 | "git-repo-info": "^2.1.1", |
40 | "jest": "^27.4.7", | 41 | "jest": "^27.4.7", |
41 | "jest-each": "^27.4.6", | ||
42 | "jest-mock": "^27.4.6", | 42 | "jest-mock": "^27.4.6", |
43 | "source-map-support": "^0.5.21" | 43 | "source-map-support": "^0.5.21" |
44 | } | 44 | } |
diff --git a/packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.spec.ts b/packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.spec.ts index d045e54..e7e9d71 100644 --- a/packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.spec.ts +++ b/packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.spec.ts | |||
@@ -20,15 +20,11 @@ | |||
20 | 20 | ||
21 | import os from 'node:os'; | 21 | import os from 'node:os'; |
22 | 22 | ||
23 | import eachModule from 'jest-each'; | 23 | import { each } from '@sophie/test-utils'; |
24 | 24 | ||
25 | import Resources from '../../Resources'; | 25 | import Resources from '../../Resources'; |
26 | import getDistResources from '../getDistResources'; | 26 | import getDistResources from '../getDistResources'; |
27 | 27 | ||
28 | // Workaround for jest ESM loader incorrectly wrapping the import in another layer of `default`. | ||
29 | const each = | ||
30 | (eachModule as Partial<typeof import('jest-each')>).default ?? eachModule; | ||
31 | |||
32 | const defaultDevServerURL = 'http://localhost:3000/'; | 28 | const defaultDevServerURL = 'http://localhost:3000/'; |
33 | 29 | ||
34 | const [ | 30 | const [ |
diff --git a/packages/main/tsconfig.json b/packages/main/tsconfig.json index dad597d..e18e7d3 100644 --- a/packages/main/tsconfig.json +++ b/packages/main/tsconfig.json | |||
@@ -10,6 +10,9 @@ | |||
10 | }, | 10 | }, |
11 | { | 11 | { |
12 | "path": "../shared/tsconfig.build.json" | 12 | "path": "../shared/tsconfig.build.json" |
13 | }, | ||
14 | { | ||
15 | "path": "../test-utils/tsconfig.build.json" | ||
13 | } | 16 | } |
14 | ], | 17 | ], |
15 | "include": [ | 18 | "include": [ |