skuba 7.5.1 → 7.5.2-jest-node-next-20240319065558
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jest/transform.js +28 -5
- package/package.json +1 -1
- package/template/express-rest-api/Dockerfile +1 -1
- package/template/express-rest-api/Dockerfile.dev-deps +1 -1
- package/template/greeter/Dockerfile +1 -1
- package/template/koa-rest-api/Dockerfile +1 -1
- package/template/koa-rest-api/Dockerfile.dev-deps +1 -1
- package/template/lambda-sqs-worker/Dockerfile +1 -1
- package/template/lambda-sqs-worker-cdk/Dockerfile +1 -1
package/jest/transform.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const { defaults } = require('ts-jest/presets');
|
|
2
|
+
const { ModuleResolutionKind } = require('typescript');
|
|
2
3
|
|
|
3
4
|
const { tryParseTsConfig } = require('./tsConfig');
|
|
4
5
|
|
|
@@ -14,6 +15,29 @@ const TS_JEST_PATH = require.resolve(TS_JEST_NAME);
|
|
|
14
15
|
|
|
15
16
|
const maybeTsConfig = tryParseTsConfig();
|
|
16
17
|
|
|
18
|
+
const isolatedModules = maybeTsConfig?.options.isolatedModules ?? true;
|
|
19
|
+
|
|
20
|
+
const BROKEN_MODULE_RESOLUTIONS = new Set([
|
|
21
|
+
ModuleResolutionKind.Node16,
|
|
22
|
+
ModuleResolutionKind.NodeNext,
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Passing through `Node16` or `NodeNext` seems to break `ts-jest`.
|
|
27
|
+
*
|
|
28
|
+
* ```
|
|
29
|
+
* error TS5110: Option 'module' must be set to 'Node16' when option 'moduleResolution' is set to 'Node16'.
|
|
30
|
+
* error TS5110: Option 'module' must be set to 'NodeNext' when option 'moduleResolution' is set to 'NodeNext'.
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* https://github.com/kulshekhar/ts-jest/issues/4198
|
|
34
|
+
*/
|
|
35
|
+
const tsconfig = BROKEN_MODULE_RESOLUTIONS.has(
|
|
36
|
+
maybeTsConfig?.options.moduleResolution,
|
|
37
|
+
)
|
|
38
|
+
? { moduleResolution: 'Node' }
|
|
39
|
+
: undefined;
|
|
40
|
+
|
|
17
41
|
// Rewrite `ts-jest` transformations using our resolved `TS_JEST_PATH`.
|
|
18
42
|
module.exports.transform = Object.fromEntries(
|
|
19
43
|
Object.entries(defaults.transform).map(([key, value]) => {
|
|
@@ -24,7 +48,8 @@ module.exports.transform = Object.fromEntries(
|
|
|
24
48
|
? [
|
|
25
49
|
TS_JEST_PATH,
|
|
26
50
|
{
|
|
27
|
-
isolatedModules
|
|
51
|
+
isolatedModules,
|
|
52
|
+
tsconfig,
|
|
28
53
|
},
|
|
29
54
|
]
|
|
30
55
|
: value,
|
|
@@ -38,10 +63,8 @@ module.exports.transform = Object.fromEntries(
|
|
|
38
63
|
TS_JEST_PATH,
|
|
39
64
|
{
|
|
40
65
|
...value[1],
|
|
41
|
-
isolatedModules
|
|
42
|
-
|
|
43
|
-
maybeTsConfig?.isolatedModules ??
|
|
44
|
-
true,
|
|
66
|
+
isolatedModules,
|
|
67
|
+
tsconfig,
|
|
45
68
|
},
|
|
46
69
|
]
|
|
47
70
|
: value,
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ RUN pnpm install --offline --prod
|
|
|
12
12
|
|
|
13
13
|
###
|
|
14
14
|
|
|
15
|
-
FROM --platform
|
|
15
|
+
FROM --platform=<%- platformName %> gcr.io/distroless/nodejs20-debian12 AS runtime
|
|
16
16
|
|
|
17
17
|
WORKDIR /workdir
|
|
18
18
|
|
|
@@ -12,7 +12,7 @@ RUN pnpm install --offline --prod
|
|
|
12
12
|
|
|
13
13
|
###
|
|
14
14
|
|
|
15
|
-
FROM --platform
|
|
15
|
+
FROM --platform=<%- platformName %> gcr.io/distroless/nodejs20-debian12 AS runtime
|
|
16
16
|
|
|
17
17
|
WORKDIR /workdir
|
|
18
18
|
|