@nx/jest 20.6.3 → 20.6.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/jest",
3
- "version": "20.6.3",
3
+ "version": "20.6.4",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Jest contains executors and generators allowing your workspace to use the powerful Jest testing capabilities.",
6
6
  "repository": {
@@ -37,8 +37,8 @@
37
37
  "dependencies": {
38
38
  "@jest/reporters": "^29.4.1",
39
39
  "@jest/test-result": "^29.4.1",
40
- "@nx/devkit": "20.6.3",
41
- "@nx/js": "20.6.3",
40
+ "@nx/devkit": "20.6.4",
41
+ "@nx/js": "20.6.4",
42
42
  "@phenomnomnominal/tsquery": "~5.0.1",
43
43
  "identity-obj-proxy": "3.0.0",
44
44
  "jest-config": "^29.4.1",
@@ -16,7 +16,12 @@ process.env.NODE_ENV ??= 'test';
16
16
  async function jestExecutor(options, context) {
17
17
  // Jest registers ts-node with module CJS https://github.com/SimenB/jest/blob/v29.6.4/packages/jest-config/src/readConfigFileAndSetRootDir.ts#L117-L119
18
18
  // We want to support of ESM via 'module':'nodenext', we need to override the resolution until Jest supports it.
19
- process.env.TS_NODE_COMPILER_OPTIONS ??= '{"moduleResolution":"node10"}';
19
+ const existingValue = process.env['TS_NODE_COMPILER_OPTIONS'];
20
+ process.env['TS_NODE_COMPILER_OPTIONS'] = JSON.stringify({
21
+ ...(existingValue ? JSON.parse(existingValue) : {}),
22
+ moduleResolution: 'Node10',
23
+ customConditions: null,
24
+ });
20
25
  const config = await parseJestConfig(options, context);
21
26
  const { results } = await (0, jest_1.runCLI)(config, [options.jestConfig]);
22
27
  return { success: results.success };
@@ -124,13 +124,21 @@ async function buildJestTargets(configFilePath, projectRoot, options, context, p
124
124
  const rawConfig = await (0, config_utils_1.loadConfigFile)(absConfigFilePath);
125
125
  const targets = {};
126
126
  const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
127
+ const existingTsNodeCompilerOptions = process.env['TS_NODE_COMPILER_OPTIONS'];
128
+ const tsNodeCompilerOptions = JSON.stringify({
129
+ ...(existingTsNodeCompilerOptions
130
+ ? JSON.parse(existingTsNodeCompilerOptions)
131
+ : {}),
132
+ moduleResolution: 'node10',
133
+ customConditions: null,
134
+ });
127
135
  const target = (targets[options.targetName] = {
128
136
  command: 'jest',
129
137
  options: {
130
138
  cwd: projectRoot,
131
139
  // Jest registers ts-node with module CJS https://github.com/SimenB/jest/blob/v29.6.4/packages/jest-config/src/readConfigFileAndSetRootDir.ts#L117-L119
132
140
  // We want to support of ESM via 'module':'nodenext', we need to override the resolution until Jest supports it.
133
- env: { TS_NODE_COMPILER_OPTIONS: '{"moduleResolution":"node10"}' },
141
+ env: { TS_NODE_COMPILER_OPTIONS: tsNodeCompilerOptions },
134
142
  },
135
143
  metadata: {
136
144
  technologies: ['jest'],
@@ -179,7 +187,7 @@ async function buildJestTargets(configFilePath, projectRoot, options, context, p
179
187
  outputs,
180
188
  options: {
181
189
  cwd: projectRoot,
182
- env: { TS_NODE_COMPILER_OPTIONS: '{"moduleResolution":"node10"}' },
190
+ env: { TS_NODE_COMPILER_OPTIONS: tsNodeCompilerOptions },
183
191
  },
184
192
  metadata: {
185
193
  technologies: ['jest'],
@@ -289,9 +297,7 @@ async function buildJestTargets(configFilePath, projectRoot, options, context, p
289
297
  outputs,
290
298
  options: {
291
299
  cwd: projectRoot,
292
- env: {
293
- TS_NODE_COMPILER_OPTIONS: '{"moduleResolution":"node10"}',
294
- },
300
+ env: { TS_NODE_COMPILER_OPTIONS: tsNodeCompilerOptions },
295
301
  },
296
302
  metadata: {
297
303
  technologies: ['jest'],