@nx/jest 21.2.0 → 21.2.2

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": "21.2.0",
3
+ "version": "21.2.2",
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": "21.2.0",
41
- "@nx/js": "21.2.0",
40
+ "@nx/devkit": "21.2.2",
41
+ "@nx/js": "21.2.2",
42
42
  "@phenomnomnominal/tsquery": "~5.0.1",
43
43
  "identity-obj-proxy": "3.0.0",
44
44
  "jest-config": "^29.4.1",
@@ -58,6 +58,10 @@ function configurationGenerator(tree, schema) {
58
58
  }
59
59
  async function configurationGeneratorInternal(tree, schema) {
60
60
  const options = normalizeOptions(tree, schema);
61
+ // we'll only add the vscode recommended extension if the jest preset does
62
+ // not exist, which most likely means this is a first run, in the cases it's
63
+ // not a first run, we'll skip adding it but it's not a critical thing to do
64
+ const shouldAddVsCodeRecommendations = (0, config_file_1.findRootJestPreset)(tree) === null;
61
65
  const tasks = [];
62
66
  tasks.push(await (0, js_1.initGenerator)(tree, { ...schema, skipFormat: true }));
63
67
  tasks.push(await (0, init_1.jestInitGenerator)(tree, { ...options, skipFormat: true }));
@@ -69,7 +73,9 @@ async function configurationGeneratorInternal(tree, schema) {
69
73
  (0, check_for_test_target_1.checkForTestTarget)(tree, options);
70
74
  (0, create_files_1.createFiles)(tree, options, presetExt);
71
75
  (0, update_tsconfig_1.updateTsConfig)(tree, options);
72
- (0, update_vscode_recommended_extensions_1.updateVsCodeRecommendedExtensions)(tree);
76
+ if (shouldAddVsCodeRecommendations) {
77
+ (0, update_vscode_recommended_extensions_1.updateVsCodeRecommendedExtensions)(tree);
78
+ }
73
79
  const nxJson = (0, devkit_1.readNxJson)(tree);
74
80
  const hasPlugin = nxJson.plugins?.some((p) => {
75
81
  if (typeof p === 'string') {
@@ -122,7 +122,14 @@ async function buildJestTargets(configFilePath, projectRoot, options, context, p
122
122
  const absConfigFilePath = (0, path_1.resolve)(context.workspaceRoot, configFilePath);
123
123
  if (require.cache[absConfigFilePath])
124
124
  (0, config_utils_1.clearRequireCache)();
125
- const rawConfig = await (0, config_utils_1.loadConfigFile)(absConfigFilePath);
125
+ const rawConfig = await (0, config_utils_1.loadConfigFile)(absConfigFilePath,
126
+ // lookup for the same files we look for in the resolver and fall back to tsconfig.json
127
+ [
128
+ 'tsconfig.spec.json',
129
+ 'tsconfig.test.json',
130
+ 'tsconfig.jest.json',
131
+ 'tsconfig.json',
132
+ ]);
126
133
  const targets = {};
127
134
  const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
128
135
  const tsNodeCompilerOptions = JSON.stringify({