@nx/jest 16.0.0-beta.1

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.
Files changed (124) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +22 -0
  3. package/README.md +63 -0
  4. package/executors.json +17 -0
  5. package/generators.json +34 -0
  6. package/index.d.ts +5 -0
  7. package/index.js +16 -0
  8. package/index.js.map +1 -0
  9. package/migrations.json +275 -0
  10. package/package.json +57 -0
  11. package/plugins/resolver.d.ts +1 -0
  12. package/plugins/resolver.js +56 -0
  13. package/plugins/resolver.js.map +1 -0
  14. package/preset/index.d.ts +2 -0
  15. package/preset/index.js +5 -0
  16. package/preset/index.js.map +1 -0
  17. package/preset/jest-preset.d.ts +2 -0
  18. package/preset/jest-preset.js +34 -0
  19. package/preset/jest-preset.js.map +1 -0
  20. package/src/executors/jest/compat.d.ts +2 -0
  21. package/src/executors/jest/compat.js +6 -0
  22. package/src/executors/jest/compat.js.map +1 -0
  23. package/src/executors/jest/jest.impl.d.ts +11 -0
  24. package/src/executors/jest/jest.impl.js +153 -0
  25. package/src/executors/jest/jest.impl.js.map +1 -0
  26. package/src/executors/jest/schema.d.ts +42 -0
  27. package/src/executors/jest/schema.json +218 -0
  28. package/src/executors/jest/summary.d.ts +7 -0
  29. package/src/executors/jest/summary.js +155 -0
  30. package/src/executors/jest/summary.js.map +1 -0
  31. package/src/generators/init/init.d.ts +5 -0
  32. package/src/generators/init/init.js +169 -0
  33. package/src/generators/init/init.js.map +1 -0
  34. package/src/generators/init/schema.d.ts +11 -0
  35. package/src/generators/init/schema.json +42 -0
  36. package/src/generators/jest-project/files/jest.config.ts__tmpl__ +16 -0
  37. package/src/generators/jest-project/files/src/test-setup.ts__tmpl__ +0 -0
  38. package/src/generators/jest-project/files/tsconfig.spec.json__tmpl__ +21 -0
  39. package/src/generators/jest-project/files-angular/jest.config.ts__tmpl__ +27 -0
  40. package/src/generators/jest-project/files-angular/src/test-setup.ts__tmpl__ +1 -0
  41. package/src/generators/jest-project/files-angular/tsconfig.spec.json__tmpl__ +22 -0
  42. package/src/generators/jest-project/jest-project.d.ts +4 -0
  43. package/src/generators/jest-project/jest-project.js +55 -0
  44. package/src/generators/jest-project/jest-project.js.map +1 -0
  45. package/src/generators/jest-project/lib/check-for-test-target.d.ts +3 -0
  46. package/src/generators/jest-project/lib/check-for-test-target.js +13 -0
  47. package/src/generators/jest-project/lib/check-for-test-target.js.map +1 -0
  48. package/src/generators/jest-project/lib/create-files.d.ts +3 -0
  49. package/src/generators/jest-project/lib/create-files.js +44 -0
  50. package/src/generators/jest-project/lib/create-files.js.map +1 -0
  51. package/src/generators/jest-project/lib/update-jestconfig.d.ts +3 -0
  52. package/src/generators/jest-project/lib/update-jestconfig.js +22 -0
  53. package/src/generators/jest-project/lib/update-jestconfig.js.map +1 -0
  54. package/src/generators/jest-project/lib/update-tsconfig.d.ts +3 -0
  55. package/src/generators/jest-project/lib/update-tsconfig.js +22 -0
  56. package/src/generators/jest-project/lib/update-tsconfig.js.map +1 -0
  57. package/src/generators/jest-project/lib/update-workspace.d.ts +3 -0
  58. package/src/generators/jest-project/lib/update-workspace.js +37 -0
  59. package/src/generators/jest-project/lib/update-workspace.js.map +1 -0
  60. package/src/generators/jest-project/schema.d.ts +23 -0
  61. package/src/generators/jest-project/schema.json +80 -0
  62. package/src/migrations/update-12-1-2/update-jest-preset-angular.d.ts +1 -0
  63. package/src/migrations/update-12-1-2/update-jest-preset-angular.js +55 -0
  64. package/src/migrations/update-12-1-2/update-jest-preset-angular.js.map +1 -0
  65. package/src/migrations/update-12-1-2/update-ts-jest.d.ts +2 -0
  66. package/src/migrations/update-12-1-2/update-ts-jest.js +36 -0
  67. package/src/migrations/update-12-1-2/update-ts-jest.js.map +1 -0
  68. package/src/migrations/update-12-4-0/add-test-environment-for-node.d.ts +2 -0
  69. package/src/migrations/update-12-4-0/add-test-environment-for-node.js +38 -0
  70. package/src/migrations/update-12-4-0/add-test-environment-for-node.js.map +1 -0
  71. package/src/migrations/update-12-4-0/update-jest-preset-angular.d.ts +25 -0
  72. package/src/migrations/update-12-4-0/update-jest-preset-angular.js +89 -0
  73. package/src/migrations/update-12-4-0/update-jest-preset-angular.js.map +1 -0
  74. package/src/migrations/update-12-6-0/update-base-jest-config.d.ts +2 -0
  75. package/src/migrations/update-12-6-0/update-base-jest-config.js +43 -0
  76. package/src/migrations/update-12-6-0/update-base-jest-config.js.map +1 -0
  77. package/src/migrations/update-13-1-2/update-tsconfigs-for-tests.d.ts +2 -0
  78. package/src/migrations/update-13-1-2/update-tsconfigs-for-tests.js +60 -0
  79. package/src/migrations/update-13-1-2/update-tsconfigs-for-tests.js.map +1 -0
  80. package/src/migrations/update-13-4-4/add-missing-root-babel-config.d.ts +2 -0
  81. package/src/migrations/update-13-4-4/add-missing-root-babel-config.js +43 -0
  82. package/src/migrations/update-13-4-4/add-missing-root-babel-config.js.map +1 -0
  83. package/src/migrations/update-14-0-0/update-jest-config-ext.d.ts +3 -0
  84. package/src/migrations/update-14-0-0/update-jest-config-ext.js +115 -0
  85. package/src/migrations/update-14-0-0/update-jest-config-ext.js.map +1 -0
  86. package/src/migrations/update-14-1-5/update-exports-jest-config.d.ts +7 -0
  87. package/src/migrations/update-14-1-5/update-exports-jest-config.js +66 -0
  88. package/src/migrations/update-14-1-5/update-exports-jest-config.js.map +1 -0
  89. package/src/migrations/update-14-6-0/update-configs-jest-28.d.ts +5 -0
  90. package/src/migrations/update-14-6-0/update-configs-jest-28.js +82 -0
  91. package/src/migrations/update-14-6-0/update-configs-jest-28.js.map +1 -0
  92. package/src/migrations/update-14-6-0/update-tests-jest-28.d.ts +24 -0
  93. package/src/migrations/update-14-6-0/update-tests-jest-28.js +158 -0
  94. package/src/migrations/update-14-6-0/update-tests-jest-28.js.map +1 -0
  95. package/src/migrations/update-15-0-0/add-jest-inputs.d.ts +2 -0
  96. package/src/migrations/update-15-0-0/add-jest-inputs.js +47 -0
  97. package/src/migrations/update-15-0-0/add-jest-inputs.js.map +1 -0
  98. package/src/migrations/update-15-8-0/update-configs-jest-29.d.ts +3 -0
  99. package/src/migrations/update-15-8-0/update-configs-jest-29.js +153 -0
  100. package/src/migrations/update-15-8-0/update-configs-jest-29.js.map +1 -0
  101. package/src/migrations/update-15-8-0/update-tests-jest-29.d.ts +5 -0
  102. package/src/migrations/update-15-8-0/update-tests-jest-29.js +64 -0
  103. package/src/migrations/update-15-8-0/update-tests-jest-29.js.map +1 -0
  104. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  105. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
  106. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
  107. package/src/utils/ast-utils.d.ts +9 -0
  108. package/src/utils/ast-utils.js +33 -0
  109. package/src/utils/ast-utils.js.map +1 -0
  110. package/src/utils/config/find-root-jest-files.d.ts +3 -0
  111. package/src/utils/config/find-root-jest-files.js +21 -0
  112. package/src/utils/config/find-root-jest-files.js.map +1 -0
  113. package/src/utils/config/functions.d.ts +17 -0
  114. package/src/utils/config/functions.js +214 -0
  115. package/src/utils/config/functions.js.map +1 -0
  116. package/src/utils/config/get-jest-projects.d.ts +19 -0
  117. package/src/utils/config/get-jest-projects.js +64 -0
  118. package/src/utils/config/get-jest-projects.js.map +1 -0
  119. package/src/utils/config/update-config.d.ts +20 -0
  120. package/src/utils/config/update-config.js +84 -0
  121. package/src/utils/config/update-config.js.map +1 -0
  122. package/src/utils/versions.d.ts +9 -0
  123. package/src/utils/versions.js +13 -0
  124. package/src/utils/versions.js.map +1 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+
7
+
8
+ **Note:** Version bump only for package @nx/jest
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2017-2023 Narwhal Technologies Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ <p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
2
+
3
+ <div style="text-align: center;">
4
+
5
+ [![CircleCI](https://circleci.com/gh/nrwl/nx.svg?style=svg)](https://circleci.com/gh/nrwl/nx)
6
+ [![License](https://img.shields.io/npm/l/@nrwl/workspace.svg?style=flat-square)]()
7
+ [![NPM Version](https://badge.fury.io/js/%40nrwl%2Fworkspace.svg)](https://www.npmjs.com/@nrwl/workspace)
8
+ [![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)]()
9
+ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
10
+ [![Join the chat at https://gitter.im/nrwl-nx/community](https://badges.gitter.im/nrwl-nx/community.svg)](https://gitter.im/nrwl-nx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
11
+ [![Join us @nrwl/community on slack](https://img.shields.io/badge/slack-%40nrwl%2Fcommunity-brightgreen)](https://join.slack.com/t/nrwlcommunity/shared_invite/enQtNzU5MTE4OTQwOTk0LTgxY2E0ZWYzMWE0YzA5ZDA2MWM1NDVhNmI2ZWMyYmZhNWJiODk3MjkxZjY3MzU5ZjRmM2NmNWU1OTgyZmE4Mzc)
12
+
13
+ </div>
14
+
15
+
16
+ <hr>
17
+
18
+ # Nx: Smart, Fast and Extensible Build System
19
+
20
+ Nx is a next generation build system with first class monorepo support and powerful integrations.
21
+
22
+ This package is a [Jest plugin for Nx](https://nx.dev/jest/overview).
23
+
24
+ ## Getting Started
25
+
26
+ ### Creating an Nx Workspace
27
+
28
+ **Using `npx`**
29
+
30
+ ```bash
31
+ npx create-nx-workspace
32
+ ```
33
+
34
+ **Using `npm init`**
35
+
36
+ ```bash
37
+ npm init nx-workspace
38
+ ```
39
+
40
+ **Using `yarn create`**
41
+
42
+ ```bash
43
+ yarn create nx-workspace
44
+ ```
45
+
46
+ ### Adding Nx to an Existing Repository
47
+
48
+ Run:
49
+
50
+ ```bash
51
+ npx nx@latest init
52
+ ```
53
+
54
+ ## Documentation & Resources
55
+
56
+ - [Nx.Dev: Documentation, Guides, Tutorials](https://nx.dev)
57
+ - [Intro to Nx](https://nx.dev/getting-started/intro)
58
+ - [Official Nx YouTube Channel](https://www.youtube.com/@NxDevtools)
59
+ - [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
60
+
61
+ <p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
62
+ width="100%" alt="Nx - Smart, Fast and Extensible Build System"></a></p>
63
+
package/executors.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "builders": {
3
+ "jest": {
4
+ "implementation": "./src/executors/jest/compat",
5
+ "schema": "./src/executors/jest/schema.json",
6
+ "description": "Run Jest unit tests."
7
+ }
8
+ },
9
+ "executors": {
10
+ "jest": {
11
+ "implementation": "./src/executors/jest/jest.impl",
12
+ "batchImplementation": "./src/executors/jest/jest.impl#batchJest",
13
+ "schema": "./src/executors/jest/schema.json",
14
+ "description": "Run Jest unit tests."
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "Nx Jest",
3
+ "version": "0.1",
4
+ "schematics": {
5
+ "init": {
6
+ "factory": "./src/generators/init/init#jestInitSchematic",
7
+ "schema": "./src/generators/init/schema.json",
8
+ "description": "Initialize the `@nrwl/jest` plugin.",
9
+ "aliases": ["ng-add"],
10
+ "hidden": true
11
+ },
12
+ "jest-project": {
13
+ "factory": "./src/generators/jest-project/jest-project#jestProjectSchematic",
14
+ "schema": "./src/generators/jest-project/schema.json",
15
+ "description": "Add Jest configuration to a project.",
16
+ "hidden": true
17
+ }
18
+ },
19
+ "generators": {
20
+ "init": {
21
+ "factory": "./src/generators/init/init#jestInitGenerator",
22
+ "schema": "./src/generators/init/schema.json",
23
+ "description": "Initialize the `@nrwl/jest` plugin.",
24
+ "aliases": ["ng-add"],
25
+ "hidden": true
26
+ },
27
+ "jest-project": {
28
+ "factory": "./src/generators/jest-project/jest-project#jestProjectGenerator",
29
+ "schema": "./src/generators/jest-project/schema.json",
30
+ "description": "Add Jest configuration to a project.",
31
+ "hidden": true
32
+ }
33
+ }
34
+ }
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export { addPropertyToJestConfig, removePropertyFromJestConfig, } from './src/utils/config/update-config';
2
+ export { jestConfigObjectAst } from './src/utils/config/functions';
3
+ export { jestProjectGenerator } from './src/generators/jest-project/jest-project';
4
+ export { jestInitGenerator } from './src/generators/init/init';
5
+ export { getJestProjects, getNestedJestProjects, } from './src/utils/config/get-jest-projects';
package/index.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getNestedJestProjects = exports.getJestProjects = exports.jestInitGenerator = exports.jestProjectGenerator = exports.jestConfigObjectAst = exports.removePropertyFromJestConfig = exports.addPropertyToJestConfig = void 0;
4
+ var update_config_1 = require("./src/utils/config/update-config");
5
+ Object.defineProperty(exports, "addPropertyToJestConfig", { enumerable: true, get: function () { return update_config_1.addPropertyToJestConfig; } });
6
+ Object.defineProperty(exports, "removePropertyFromJestConfig", { enumerable: true, get: function () { return update_config_1.removePropertyFromJestConfig; } });
7
+ var functions_1 = require("./src/utils/config/functions");
8
+ Object.defineProperty(exports, "jestConfigObjectAst", { enumerable: true, get: function () { return functions_1.jestConfigObjectAst; } });
9
+ var jest_project_1 = require("./src/generators/jest-project/jest-project");
10
+ Object.defineProperty(exports, "jestProjectGenerator", { enumerable: true, get: function () { return jest_project_1.jestProjectGenerator; } });
11
+ var init_1 = require("./src/generators/init/init");
12
+ Object.defineProperty(exports, "jestInitGenerator", { enumerable: true, get: function () { return init_1.jestInitGenerator; } });
13
+ var get_jest_projects_1 = require("./src/utils/config/get-jest-projects");
14
+ Object.defineProperty(exports, "getJestProjects", { enumerable: true, get: function () { return get_jest_projects_1.getJestProjects; } });
15
+ Object.defineProperty(exports, "getNestedJestProjects", { enumerable: true, get: function () { return get_jest_projects_1.getNestedJestProjects; } });
16
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/jest/index.ts"],"names":[],"mappings":";;;AAAA,kEAG0C;AAFxC,wHAAA,uBAAuB,OAAA;AACvB,6HAAA,4BAA4B,OAAA;AAE9B,0DAAmE;AAA1D,gHAAA,mBAAmB,OAAA;AAC5B,2EAAkF;AAAzE,oHAAA,oBAAoB,OAAA;AAC7B,mDAA+D;AAAtD,yGAAA,iBAAiB,OAAA;AAC1B,0EAG8C;AAF5C,oHAAA,eAAe,OAAA;AACf,0HAAA,qBAAqB,OAAA"}
@@ -0,0 +1,275 @@
1
+ {
2
+ "generators": {
3
+ "update-jest-preset-angular-8-4-0": {
4
+ "version": "12.1.0-beta.1",
5
+ "cli": "nx",
6
+ "description": "Update jest-preset-angular to version 8.4.0",
7
+ "factory": "./src/migrations/update-12-1-2/update-jest-preset-angular"
8
+ },
9
+ "update-ts-jest-6-5-5": {
10
+ "version": "12.1.2-beta.1",
11
+ "cli": "nx",
12
+ "description": "Replace tsConfig with tsconfig for ts-jest in jest.config.js",
13
+ "factory": "./src/migrations/update-12-1-2/update-ts-jest"
14
+ },
15
+ "support-jest-27": {
16
+ "version": "12.4.0-beta.1",
17
+ "cli": "nx",
18
+ "description": "Add testEnvironment: 'jsdom' in web apps + libraries",
19
+ "factory": "./src/migrations/update-12-4-0/add-test-environment-for-node"
20
+ },
21
+ "update-ts-jest-and-jest-preset-angular": {
22
+ "version": "12.4.0-beta.1",
23
+ "cli": "nx",
24
+ "description": "Support for Jest 27 via updating ts-jest + jest-preset-angular",
25
+ "factory": "./src/migrations/update-12-4-0/update-jest-preset-angular"
26
+ },
27
+ "update-jest-config-to-use-util": {
28
+ "version": "12.6.0-beta.0",
29
+ "cli": "nx",
30
+ "description": "Uses `getJestProjects()` to populate projects array in root level `jest.config.js` file.",
31
+ "factory": "./src/migrations/update-12-6-0/update-base-jest-config"
32
+ },
33
+ "update-ts-config-for-test-filenames": {
34
+ "version": "13.1.2-beta.0",
35
+ "cli": "nx",
36
+ "description": "Support .test. file names in tsconfigs",
37
+ "factory": "./src/migrations/update-13-1-2/update-tsconfigs-for-tests"
38
+ },
39
+ "add-missing-root-babel-config": {
40
+ "version": "13.4.4-beta.0",
41
+ "cli": "nx",
42
+ "description": "Create a root babel config file if it doesn't exist and using babel-jest in jest.config.js and add @nrwl/web as needed",
43
+ "factory": "./src/migrations/update-13-4-4/add-missing-root-babel-config"
44
+ },
45
+ "update-jest-config-extensions": {
46
+ "version": "14.0.0-beta.2",
47
+ "cli": "nx",
48
+ "description": "Update move jest config files to .ts files.",
49
+ "factory": "./src/migrations/update-14-0-0/update-jest-config-ext"
50
+ },
51
+ "update-to-export-default": {
52
+ "version": "14.1.5-beta.0",
53
+ "cli": "nx",
54
+ "description": "Update to export default in jest config and revert jest.preset.ts to jest.preset.js",
55
+ "factory": "./src/migrations/update-14-1-5/update-exports-jest-config"
56
+ },
57
+ "exclude-jest-config-from-ts-config": {
58
+ "version": "14.5.5-beta.0",
59
+ "cli": "nx",
60
+ "description": "Exclude jest.config.ts from tsconfig where missing.",
61
+ "factory": "./src/migrations/update-14-0-0/update-jest-config-ext"
62
+ },
63
+ "update-configs-jest-28": {
64
+ "version": "14.6.0-beta.0",
65
+ "cli": "nx",
66
+ "description": "Update jest configs to support jest 28 changes (https://jestjs.io/docs/upgrading-to-jest28#configuration-options)",
67
+ "factory": "./src/migrations/update-14-6-0/update-configs-jest-28"
68
+ },
69
+ "update-tests-jest-28": {
70
+ "version": "14.6.0-beta.0",
71
+ "cli": "nx",
72
+ "description": "Update jest test files to support jest 28 changes (https://jestjs.io/docs/upgrading-to-jest28)",
73
+ "factory": "./src/migrations/update-14-6-0/update-tests-jest-28"
74
+ },
75
+ "add-jest-inputs": {
76
+ "version": "15.0.0-beta.0",
77
+ "cli": "nx",
78
+ "description": "Stop hashing jest spec files and config files for build targets and dependent tasks",
79
+ "factory": "./src/migrations/update-15-0-0/add-jest-inputs"
80
+ },
81
+ "update-configs-jest-29": {
82
+ "version": "15.8.0-beta.0",
83
+ "cli": "nx",
84
+ "description": "Update jest configs to support jest 29 changes (https://jestjs.io/docs/upgrading-to-jest29)",
85
+ "factory": "./src/migrations/update-15-8-0/update-configs-jest-29"
86
+ },
87
+ "update-tests-jest-29": {
88
+ "version": "15.8.0-beta.0",
89
+ "cli": "nx",
90
+ "description": "Update jest test files to support jest 29 changes (https://jestjs.io/docs/upgrading-to-jest29)",
91
+ "factory": "./src/migrations/update-15-8-0/update-tests-jest-29"
92
+ },
93
+ "update-16-0-0-add-nx-packages": {
94
+ "cli": "nx",
95
+ "version": "16.0.0-beta.1",
96
+ "description": "Replace @nrwl/jest with @nx/jest",
97
+ "implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
98
+ }
99
+ },
100
+ "packageJsonUpdates": {
101
+ "12.1.0": {
102
+ "version": "12.1.0-beta.1",
103
+ "packages": {
104
+ "jest-preset-angular": {
105
+ "version": "8.4.0",
106
+ "alwaysAddToPackageJson": false
107
+ },
108
+ "ts-jest": {
109
+ "version": "26.5.5",
110
+ "alwaysAddToPackageJson": false
111
+ }
112
+ }
113
+ },
114
+ "12.4.0": {
115
+ "version": "12.4.0-beta.1",
116
+ "packages": {
117
+ "jest": {
118
+ "version": "27.0.3",
119
+ "alwaysAddToPackageJson": false
120
+ },
121
+ "ts-jest": {
122
+ "version": "27.0.3",
123
+ "alwaysAddToPackageJson": false
124
+ },
125
+ "jest-preset-angular": {
126
+ "version": "9.0.3",
127
+ "alwaysAddToPackageJson": false
128
+ }
129
+ }
130
+ },
131
+ "12.10.0": {
132
+ "version": "12.10.0-beta.1",
133
+ "packages": {
134
+ "jest": {
135
+ "version": "27.2.3",
136
+ "alwaysAddToPackageJson": false
137
+ },
138
+ "@types/jest": {
139
+ "version": "27.0.2",
140
+ "alwaysAddToPackageJson": false
141
+ },
142
+ "ts-jest": {
143
+ "version": "27.0.5",
144
+ "alwaysAddToPackageJson": false
145
+ },
146
+ "babel-jest": {
147
+ "version": "27.2.3",
148
+ "alwaysAddToPackageJson": false
149
+ }
150
+ }
151
+ },
152
+ "14.0.0": {
153
+ "version": "14.0.0-beta.2",
154
+ "packages": {
155
+ "jest": {
156
+ "version": "27.5.1",
157
+ "alwaysAddToPackageJson": false
158
+ },
159
+ "@types/jest": {
160
+ "version": "27.4.1",
161
+ "alwaysAddToPackageJson": false
162
+ },
163
+ "ts-jest": {
164
+ "version": "27.1.4",
165
+ "alwaysAddToPackageJson": false
166
+ },
167
+ "babel-jest": {
168
+ "version": "27.5.1",
169
+ "alwaysAddToPackageJson": false
170
+ }
171
+ }
172
+ },
173
+ "14.2.0": {
174
+ "version": "14.2.0-rc.2",
175
+ "packages": {
176
+ "ts-node": {
177
+ "version": "~10.8.0",
178
+ "alwaysAddToPackageJson": false
179
+ }
180
+ }
181
+ },
182
+ "14.5.5": {
183
+ "version": "14.5.5-beta.0",
184
+ "packages": {
185
+ "ts-node": {
186
+ "version": "10.9.1",
187
+ "alwaysAddToPackageJson": false
188
+ }
189
+ }
190
+ },
191
+ "14.6.0": {
192
+ "version": "14.6.0-beta.0",
193
+ "packages": {
194
+ "jest": {
195
+ "version": "~28.1.1",
196
+ "alwaysAddToPackageJson": false
197
+ },
198
+ "@types/jest": {
199
+ "version": "~28.1.1",
200
+ "alwaysAddToPackageJson": false
201
+ },
202
+ "expect": {
203
+ "version": "~28.1.1",
204
+ "alwaysAddToPackageJson": false
205
+ },
206
+ "@jest/globals": {
207
+ "version": "~28.1.1",
208
+ "alwaysAddToPackageJson": false
209
+ },
210
+ "jest-jasmine2": {
211
+ "version": "~28.1.1",
212
+ "alwaysAddToPackageJson": false
213
+ },
214
+ "jest-environment-jsdom": {
215
+ "version": "~28.1.1",
216
+ "alwaysAddToPackageJson": false
217
+ },
218
+ "ts-jest": {
219
+ "version": "~28.0.5",
220
+ "alwaysAddToPackageJson": false
221
+ },
222
+ "babel-jest": {
223
+ "version": "~28.1.1",
224
+ "alwaysAddToPackageJson": false
225
+ }
226
+ }
227
+ },
228
+ "15.0.1-beta.3": {
229
+ "version": "15.0.1-beta.3",
230
+ "packages": {
231
+ "jest-environment-jsdom": {
232
+ "version": "~28.1.1",
233
+ "addToPackageJson": "devDependencies"
234
+ }
235
+ }
236
+ },
237
+ "15.8.0": {
238
+ "version": "15.8.0-beta.0",
239
+ "packages": {
240
+ "jest": {
241
+ "version": "~29.4.1",
242
+ "alwaysAddToPackageJson": false
243
+ },
244
+ "@types/jest": {
245
+ "version": "~29.4.0",
246
+ "alwaysAddToPackageJson": false
247
+ },
248
+ "expect": {
249
+ "version": "~29.4.1",
250
+ "alwaysAddToPackageJson": false
251
+ },
252
+ "@jest/globals": {
253
+ "version": "~29.4.1",
254
+ "alwaysAddToPackageJson": false
255
+ },
256
+ "jest-jasmine2": {
257
+ "version": "~29.4.1",
258
+ "alwaysAddToPackageJson": false
259
+ },
260
+ "jest-environment-jsdom": {
261
+ "version": "~29.4.1",
262
+ "alwaysAddToPackageJson": false
263
+ },
264
+ "ts-jest": {
265
+ "version": "~29.0.5",
266
+ "alwaysAddToPackageJson": false
267
+ },
268
+ "babel-jest": {
269
+ "version": "~29.4.1",
270
+ "alwaysAddToPackageJson": false
271
+ }
272
+ }
273
+ }
274
+ }
275
+ }
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@nx/jest",
3
+ "version": "16.0.0-beta.1",
4
+ "private": false,
5
+ "description": "The Nx Plugin for Jest contains executors and generators allowing your workspace to use the powerful Jest testing capabilities.",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/nrwl/nx.git",
9
+ "directory": "packages/jest"
10
+ },
11
+ "keywords": [
12
+ "Monorepo",
13
+ "Angular",
14
+ "React",
15
+ "Web",
16
+ "Node",
17
+ "Nest",
18
+ "Jest",
19
+ "Unit Testing",
20
+ "CLI"
21
+ ],
22
+ "main": "./index",
23
+ "typings": "./index.d.ts",
24
+ "author": "Victor Savkin",
25
+ "license": "MIT",
26
+ "bugs": {
27
+ "url": "https://github.com/nrwl/nx/issues"
28
+ },
29
+ "homepage": "https://nx.dev",
30
+ "schematics": "./generators.json",
31
+ "builders": "./executors.json",
32
+ "ng-update": {
33
+ "requirements": {},
34
+ "migrations": "./migrations.json"
35
+ },
36
+ "dependencies": {
37
+ "@jest/reporters": "^29.4.1",
38
+ "@jest/test-result": "^29.4.1",
39
+ "@nrwl/jest": "16.0.0-beta.1",
40
+ "@nx/devkit": "16.0.0-beta.1",
41
+ "@nx/js": "16.0.0-beta.1",
42
+ "@phenomnomnominal/tsquery": "~5.0.1",
43
+ "chalk": "^4.1.0",
44
+ "dotenv": "~10.0.0",
45
+ "identity-obj-proxy": "3.0.0",
46
+ "jest-config": "^29.4.1",
47
+ "jest-resolve": "^29.4.1",
48
+ "jest-util": "^29.4.1",
49
+ "resolve.exports": "1.1.0",
50
+ "tslib": "^2.3.0"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "types": "./index.d.ts",
56
+ "gitHead": "abf534c265f5aa3aac146e55bb31de598ea281d7"
57
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ const resolve_exports_1 = require("resolve.exports");
5
+ let compilerSetup;
6
+ let ts;
7
+ function getCompilerSetup(rootDir) {
8
+ const tsConfigPath = ts.findConfigFile(rootDir, ts.sys.fileExists, 'tsconfig.spec.json') ||
9
+ ts.findConfigFile(rootDir, ts.sys.fileExists, 'tsconfig.test.json') ||
10
+ ts.findConfigFile(rootDir, ts.sys.fileExists, 'tsconfig.jest.json');
11
+ if (!tsConfigPath) {
12
+ console.error(`Cannot locate a tsconfig.spec.json. Please create one at ${rootDir}/tsconfig.spec.json`);
13
+ }
14
+ const readResult = ts.readConfigFile(tsConfigPath, ts.sys.readFile);
15
+ const config = ts.parseJsonConfigFileContent(readResult.config, ts.sys, (0, path_1.dirname)(tsConfigPath));
16
+ const compilerOptions = config.options;
17
+ const host = ts.createCompilerHost(compilerOptions, true);
18
+ return { compilerOptions, host };
19
+ }
20
+ module.exports = function (path, options) {
21
+ const ext = (0, path_1.extname)(path);
22
+ if (ext === '.css' ||
23
+ ext === '.scss' ||
24
+ ext === '.sass' ||
25
+ ext === '.less' ||
26
+ ext === '.styl') {
27
+ return require.resolve('identity-obj-proxy');
28
+ }
29
+ try {
30
+ try {
31
+ // Try to use the defaultResolver with default options
32
+ return options.defaultResolver(path, options);
33
+ }
34
+ catch (_a) {
35
+ // Try to use the defaultResolver with a packageFilter
36
+ return options.defaultResolver(path, Object.assign(Object.assign({}, options), { packageFilter: (pkg) => (Object.assign(Object.assign({}, pkg), { main: pkg.main || pkg.es2015 || pkg.module })), pathFilter: (pkg) => {
37
+ if (!pkg.exports) {
38
+ return path;
39
+ }
40
+ return (0, resolve_exports_1.resolve)(pkg, path) || path;
41
+ } }));
42
+ }
43
+ }
44
+ catch (e) {
45
+ if (path === 'jest-sequencer-@jest/test-sequencer' ||
46
+ path === '@jest/test-sequencer') {
47
+ return;
48
+ }
49
+ // Fallback to using typescript
50
+ ts = ts || require('typescript');
51
+ compilerSetup = compilerSetup || getCompilerSetup(options.rootDir);
52
+ const { compilerOptions, host } = compilerSetup;
53
+ return ts.resolveModuleName(path, (0, path_1.join)(options.basedir, 'fake-placeholder.ts'), compilerOptions, host).resolvedModule.resolvedFileName;
54
+ }
55
+ };
56
+ //# sourceMappingURL=resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../../../packages/jest/plugins/resolver.ts"],"names":[],"mappings":";;AAAA,+BAA8C;AAC9C,qDAA4D;AAa5D,IAAI,aAAa,CAAC;AAClB,IAAI,EAAE,CAAC;AAEP,SAAS,gBAAgB,CAAC,OAAe;IACvC,MAAM,YAAY,GAChB,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,oBAAoB,CAAC;QACnE,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,oBAAoB,CAAC;QACnE,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC;IAEtE,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,CAAC,KAAK,CACX,4DAA4D,OAAO,qBAAqB,CACzF,CAAC;KACH;IAED,MAAM,UAAU,GAAG,EAAE,CAAC,cAAc,CAAC,YAAY,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACpE,MAAM,MAAM,GAAG,EAAE,CAAC,0BAA0B,CAC1C,UAAU,CAAC,MAAM,EACjB,EAAE,CAAC,GAAG,EACN,IAAA,cAAO,EAAC,YAAY,CAAC,CACtB,CAAC;IACF,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC;IACvC,MAAM,IAAI,GAAG,EAAE,CAAC,kBAAkB,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;IAC1D,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;AACnC,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,IAAY,EAAE,OAAuB;IAC9D,MAAM,GAAG,GAAG,IAAA,cAAO,EAAC,IAAI,CAAC,CAAC;IAC1B,IACE,GAAG,KAAK,MAAM;QACd,GAAG,KAAK,OAAO;QACf,GAAG,KAAK,OAAO;QACf,GAAG,KAAK,OAAO;QACf,GAAG,KAAK,OAAO,EACf;QACA,OAAO,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;KAC9C;IACD,IAAI;QACF,IAAI;YACF,sDAAsD;YACtD,OAAO,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SAC/C;QAAC,WAAM;YACN,sDAAsD;YACtD,OAAO,OAAO,CAAC,eAAe,CAAC,IAAI,kCAC9B,OAAO,KACV,aAAa,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,iCACnB,GAAG,KACN,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM,IAC1C,EACF,UAAU,EAAE,CAAC,GAAG,EAAE,EAAE;oBAClB,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;wBAChB,OAAO,IAAI,CAAC;qBACb;oBAED,OAAO,IAAA,yBAAc,EAAC,GAAG,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC;gBAC3C,CAAC,IACD,CAAC;SACJ;KACF;IAAC,OAAO,CAAC,EAAE;QACV,IACE,IAAI,KAAK,qCAAqC;YAC9C,IAAI,KAAK,sBAAsB,EAC/B;YACA,OAAO;SACR;QACD,+BAA+B;QAC/B,EAAE,GAAG,EAAE,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;QACjC,aAAa,GAAG,aAAa,IAAI,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACnE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,aAAa,CAAC;QAChD,OAAO,EAAE,CAAC,iBAAiB,CACzB,IAAI,EACJ,IAAA,WAAI,EAAC,OAAO,CAAC,OAAO,EAAE,qBAAqB,CAAC,EAC5C,eAAe,EACf,IAAI,CACL,CAAC,cAAc,CAAC,gBAAgB,CAAC;KACnC;AACH,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { nxPreset } from './jest-preset';
2
+ export default nxPreset;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jest_preset_1 = require("./jest-preset");
4
+ exports.default = jest_preset_1.nxPreset;
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/jest/preset/index.ts"],"names":[],"mappings":";;AAAA,+CAAyC;AAEzC,kBAAe,sBAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { Config } from 'jest';
2
+ export declare const nxPreset: Config;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nxPreset = void 0;
4
+ exports.nxPreset = {
5
+ // This is one of the patterns that jest finds by default https://jestjs.io/docs/configuration#testmatch-arraystring
6
+ testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'],
7
+ resolver: '@nrwl/jest/plugins/resolver',
8
+ moduleFileExtensions: ['ts', 'js', 'mjs', 'html'],
9
+ coverageReporters: ['html'],
10
+ transform: {
11
+ '^.+\\.(ts|js|html)$': [
12
+ 'ts-jest',
13
+ { tsconfig: '<rootDir>/tsconfig.spec.json' },
14
+ ],
15
+ },
16
+ testEnvironment: 'jsdom',
17
+ /**
18
+ * manually set the exports names to load in common js, to mimic the behaviors of jest 27
19
+ * before jest didn't fully support package exports and would load in common js code (typically via main field). now jest 28+ will load in the browser esm code, but jest esm support is not fully supported.
20
+ * In this case we will tell jest to load in the common js code regardless of environment.
21
+ *
22
+ * this can be removed via just overriding this setting in it's usage
23
+ *
24
+ * @example
25
+ * module.exports = {
26
+ * ...nxPreset,
27
+ * testEnvironmentOptions: {},
28
+ * }
29
+ */
30
+ testEnvironmentOptions: {
31
+ customExportConditions: ['node', 'require', 'default'],
32
+ },
33
+ };
34
+ //# sourceMappingURL=jest-preset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jest-preset.js","sourceRoot":"","sources":["../../../../packages/jest/preset/jest-preset.ts"],"names":[],"mappings":";;;AACa,QAAA,QAAQ,GAAW;IAC9B,oHAAoH;IACpH,SAAS,EAAE,CAAC,gCAAgC,CAAC;IAC7C,QAAQ,EAAE,6BAA6B;IACvC,oBAAoB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC;IACjD,iBAAiB,EAAE,CAAC,MAAM,CAAC;IAC3B,SAAS,EAAE;QACT,qBAAqB,EAAE;YACrB,SAAS;YACT,EAAE,QAAQ,EAAE,8BAA8B,EAAE;SAC7C;KACF;IACD,eAAe,EAAE,OAAO;IACxB;;;;;;;;;;;;OAYG;IACH,sBAAsB,EAAE;QACtB,sBAAsB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC;KACvD;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const jest_impl_1 = require("./jest.impl");
5
+ exports.default = (0, devkit_1.convertNxExecutor)(jest_impl_1.default);
6
+ //# sourceMappingURL=compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../packages/jest/src/executors/jest/compat.ts"],"names":[],"mappings":";;AAAA,uCAA+C;AAE/C,2CAAsD;AAEtD,kBAAe,IAAA,0BAAiB,EAAC,mBAAY,CAAC,CAAC"}