@nx/jest 18.3.0-beta.1 → 18.3.0-beta.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.0-beta.1",
3
+ "version": "18.3.0-beta.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.0-beta.1",
40
- "@nx/js": "18.3.0-beta.1",
39
+ "@nx/devkit": "18.3.0-beta.3",
40
+ "@nx/js": "18.3.0-beta.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.0-beta.1"
51
+ "@nrwl/jest": "18.3.0-beta.3"
52
52
  },
53
53
  "publishConfig": {
54
54
  "access": "public"
@@ -2,25 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.jestInitGeneratorInternal = exports.jestInitGenerator = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const update_package_scripts_1 = require("@nx/devkit/src/utils/update-package-scripts");
6
5
  const plugin_1 = require("../../plugins/plugin");
7
6
  const versions_1 = require("../../utils/versions");
8
7
  const is_preset_cjs_1 = require("../../utils/config/is-preset-cjs");
9
- function addPlugin(tree) {
10
- const nxJson = (0, devkit_1.readNxJson)(tree);
11
- nxJson.plugins ??= [];
12
- if (!nxJson.plugins.some((p) => typeof p === 'string'
13
- ? p === '@nx/jest/plugin'
14
- : p.plugin === '@nx/jest/plugin')) {
15
- nxJson.plugins.push({
16
- plugin: '@nx/jest/plugin',
17
- options: {
18
- targetName: 'test',
19
- },
20
- });
21
- }
22
- (0, devkit_1.updateNxJson)(tree, nxJson);
23
- }
8
+ const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
24
9
  function updateProductionFileSet(tree, presetExt) {
25
10
  const nxJson = (0, devkit_1.readNxJson)(tree);
26
11
  const productionFileSet = nxJson.namedInputs?.production;
@@ -83,7 +68,9 @@ async function jestInitGeneratorInternal(tree, options) {
83
68
  if (!tree.exists('jest.preset.js') && !tree.exists('jest.preset.cjs')) {
84
69
  updateProductionFileSet(tree, presetExt);
85
70
  if (options.addPlugin) {
86
- addPlugin(tree);
71
+ await (0, add_plugin_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/jest/plugin', plugin_1.createNodes, {
72
+ targetName: ['test', 'jest:test', 'jest-test'],
73
+ }, options.updatePackageScripts);
87
74
  }
88
75
  else {
89
76
  addJestTargetDefaults(tree, presetExt);
@@ -94,9 +81,6 @@ async function jestInitGeneratorInternal(tree, options) {
94
81
  tasks.push((0, devkit_1.removeDependenciesFromPackageJson)(tree, ['@nx/jest'], []));
95
82
  tasks.push(updateDependencies(tree, options));
96
83
  }
97
- if (options.updatePackageScripts) {
98
- await (0, update_package_scripts_1.updatePackageScripts)(tree, plugin_1.createNodes);
99
- }
100
84
  if (!options.skipFormat) {
101
85
  await (0, devkit_1.formatFiles)(tree);
102
86
  }