@nx/jest 18.3.1 → 18.3.3

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": "18.3.1",
3
+ "version": "18.3.3",
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": {
@@ -36,8 +36,8 @@
36
36
  "dependencies": {
37
37
  "@jest/reporters": "^29.4.1",
38
38
  "@jest/test-result": "^29.4.1",
39
- "@nx/devkit": "18.3.1",
40
- "@nx/js": "18.3.1",
39
+ "@nx/devkit": "18.3.3",
40
+ "@nx/js": "18.3.3",
41
41
  "@phenomnomnominal/tsquery": "~5.0.1",
42
42
  "chalk": "^4.1.0",
43
43
  "identity-obj-proxy": "3.0.0",
@@ -48,7 +48,7 @@
48
48
  "resolve.exports": "1.1.0",
49
49
  "tslib": "^2.3.0",
50
50
  "yargs-parser": "21.1.1",
51
- "@nrwl/jest": "18.3.1"
51
+ "@nrwl/jest": "18.3.3"
52
52
  },
53
53
  "publishConfig": {
54
54
  "access": "public"
@@ -8,6 +8,7 @@ const fs_1 = require("fs");
8
8
  const jest_config_1 = require("jest-config");
9
9
  const cache_directory_1 = require("nx/src/utils/cache-directory");
10
10
  const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
11
+ const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
11
12
  const package_json_workspaces_1 = require("nx/src/plugins/package-json-workspaces");
12
13
  const globs_1 = require("nx/src/utils/globs");
13
14
  const minimatch_1 = require("minimatch");
@@ -68,10 +69,14 @@ exports.createNodes = [
68
69
  },
69
70
  ];
70
71
  async function buildJestTargets(configFilePath, projectRoot, options, context) {
72
+ const absConfigFilePath = (0, path_1.resolve)(context.workspaceRoot, configFilePath);
73
+ if (require.cache[absConfigFilePath]) {
74
+ (0, config_utils_1.clearRequireCache)();
75
+ }
71
76
  const config = await (0, jest_config_1.readConfig)({
72
77
  _: [],
73
78
  $0: undefined,
74
- }, (0, path_1.resolve)(context.workspaceRoot, configFilePath));
79
+ }, absConfigFilePath);
75
80
  const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
76
81
  const targets = {};
77
82
  const target = (targets[options.targetName] = {
@@ -97,11 +102,11 @@ async function buildJestTargets(configFilePath, projectRoot, options, context) {
97
102
  paths: [(0, path_1.dirname)(jestPath)],
98
103
  // nx-ignore-next-line
99
104
  }));
100
- const context = await Runtime.createContext(config.projectConfig, {
105
+ const jestContext = await Runtime.createContext(config.projectConfig, {
101
106
  maxWorkers: 1,
102
107
  watchman: false,
103
108
  });
104
- const source = new jest.SearchSource(context);
109
+ const source = new jest.SearchSource(jestContext);
105
110
  const specs = await source.getTestPaths(config.globalConfig);
106
111
  const testPaths = new Set(specs.tests.map(({ path }) => path));
107
112
  if (testPaths.size > 0) {
@@ -126,7 +131,7 @@ async function buildJestTargets(configFilePath, projectRoot, options, context) {
126
131
  };
127
132
  targetGroup.push(options.ciTargetName);
128
133
  for (const testPath of testPaths) {
129
- const relativePath = (0, path_1.normalize)((0, path_1.relative)(projectRoot, testPath));
134
+ const relativePath = (0, path_1.normalize)((0, path_1.relative)((0, path_1.join)(context.workspaceRoot, projectRoot), testPath));
130
135
  const targetName = `${options.ciTargetName}--${relativePath}`;
131
136
  dependsOn.push(targetName);
132
137
  targets[targetName] = {