@nx/jest 22.7.0-beta.12 → 22.7.0-beta.14

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": "22.7.0-beta.12",
3
+ "version": "22.7.0-beta.14",
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": {
@@ -38,8 +38,8 @@
38
38
  "dependencies": {
39
39
  "@jest/reporters": "^30.0.2",
40
40
  "@jest/test-result": "^30.0.2",
41
- "@nx/devkit": "22.7.0-beta.12",
42
- "@nx/js": "22.7.0-beta.12",
41
+ "@nx/devkit": "22.7.0-beta.14",
42
+ "@nx/js": "22.7.0-beta.14",
43
43
  "@phenomnomnominal/tsquery": "~6.1.4",
44
44
  "identity-obj-proxy": "3.0.0",
45
45
  "jest-config": "^30.0.2",
@@ -53,7 +53,7 @@
53
53
  "yargs-parser": "21.1.1"
54
54
  },
55
55
  "devDependencies": {
56
- "nx": "22.7.0-beta.12"
56
+ "nx": "22.7.0-beta.14"
57
57
  },
58
58
  "publishConfig": {
59
59
  "access": "public"
@@ -18,6 +18,10 @@ function getCompilerSetup(rootDir) {
18
18
  const readResult = ts.readConfigFile(tsConfigPath, ts.sys.readFile);
19
19
  const config = ts.parseJsonConfigFileContent(readResult.config, ts.sys, (0, path_1.dirname)(tsConfigPath));
20
20
  const compilerOptions = config.options;
21
+ if (!compilerOptions.baseUrl) {
22
+ const { resolvePathsBaseUrl, } = require('@nx/js/src/utils/typescript/ts-config');
23
+ compilerOptions.baseUrl = resolvePathsBaseUrl(tsConfigPath);
24
+ }
21
25
  const host = ts.createCompilerHost(compilerOptions, true);
22
26
  return { compilerOptions, host };
23
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/jest/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EAUd,MAAM,YAAY,CAAC;AAiCpB,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAwBD,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,iBAAiB,CAuIxD,CAAC;AAEF,eAAO,MAAM,aAAa,kCAAc,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/jest/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EAUd,MAAM,YAAY,CAAC;AAiCpB,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAwBD,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,iBAAiB,CA8IxD,CAAC;AAEF,eAAO,MAAM,aAAa,kCAAc,CAAC"}
@@ -57,10 +57,16 @@ exports.createNodes = [
57
57
  configFiles: [],
58
58
  });
59
59
  const lockFilePattern = (0, js_1.getLockFileName)(packageManager);
60
+ // Load configs in parallel. `loadConfigFile` calls `registerTsProject`,
61
+ // whose transpiler dedup is refcounted: serial register/unregister cycles
62
+ // drop refCount to 0 between iterations and recreate a fresh ts-node
63
+ // service each time (ts-node has no cleanup — see
64
+ // packages/nx/src/plugins/js/utils/register.js), stacking N services in
65
+ // `require.extensions` and OOM'ing under NX_PREFER_TS_NODE. Parallel
66
+ // loads keep all registrations alive concurrently so the dedup holds and
67
+ // a single transpiler instance is shared.
60
68
  let requireCacheCleared = false;
61
- const loadedConfigs = [];
62
- for (let i = 0; i < validConfigFiles.length; i++) {
63
- const configFilePath = validConfigFiles[i];
69
+ const loadedConfigs = await Promise.all(validConfigFiles.map(async (configFilePath, i) => {
64
70
  const projectRoot = projectRoots[i];
65
71
  const absConfigFilePath = (0, node_path_1.resolve)(context.workspaceRoot, configFilePath);
66
72
  if (!requireCacheCleared && require.cache[absConfigFilePath]) {
@@ -79,8 +85,8 @@ exports.createNodes = [
79
85
  tsconfigExistsCache,
80
86
  isolatedModulesCache,
81
87
  });
82
- loadedConfigs.push({ rawConfig, externalFiles, needsDtsInputs });
83
- }
88
+ return { rawConfig, externalFiles, needsDtsInputs };
89
+ }));
84
90
  const hashes = await (0, calculate_hash_for_create_nodes_1.calculateHashesForCreateNodes)(projectRoots, options, context, loadedConfigs.map(({ externalFiles }) => [
85
91
  lockFilePattern,
86
92
  ...externalFiles,