jest-preset-angular 13.0.1 → 13.1.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## [13.1.1](https://github.com/thymikee/jest-preset-angular/compare/v13.1.0...v13.1.1) (2023-05-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * file separator issue on Windows causing error in `ngcc-jest-processor` ([#2079](https://github.com/thymikee/jest-preset-angular/issues/2079)) ([b6b3911](https://github.com/thymikee/jest-preset-angular/commit/b6b391155204120f31dc5538fee554c93b10d001))
7
+
8
+
9
+
10
+ # [13.1.0](https://github.com/thymikee/jest-preset-angular/compare/v13.0.1...v13.1.0) (2023-05-06)
11
+
12
+
13
+ ### Features
14
+
15
+ * bump peer deps to support angular 16 ([#2061](https://github.com/thymikee/jest-preset-angular/issues/2061)) ([18abd21](https://github.com/thymikee/jest-preset-angular/commit/18abd21fc63f4c3669878ed74f5a380852c4c193))
16
+ * **utils:** skip ngcc processing in ng16 or higher ([#2063](https://github.com/thymikee/jest-preset-angular/issues/2063)) ([2661988](https://github.com/thymikee/jest-preset-angular/commit/266198863242804e0cd79c83f151247194b37b06))
17
+
18
+
19
+
1
20
  ## [13.0.1](https://github.com/thymikee/jest-preset-angular/compare/v13.0.0...v13.0.1) (2023-03-21)
2
21
 
3
22
 
package/README.md CHANGED
@@ -91,7 +91,7 @@ Check out our [Angular Ivy guidance](https://thymikee.github.io/jest-preset-angu
91
91
  ## Example projects with base Jest configuration
92
92
 
93
93
  We have [example apps](https://github.com/thymikee/jest-preset-angular/tree/main/examples) to provide a basic setup to use Jest in an Angular project.
94
- The `examples` folder consist of several example Angular applications from **v10** to **13**, as well as example projects
94
+ The `examples` folder consist of several example Angular applications from **v13** onwards as well as example projects
95
95
  with `yarn workspace` or monorepo structure.
96
96
 
97
97
  ## Built With
@@ -6,17 +6,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.runNgccJestProcessor = void 0;
7
7
  const child_process_1 = require("child_process");
8
8
  const path_1 = __importDefault(require("path"));
9
- const ANGULAR_COMPILER_CLI_PKG_NAME = `@angular${path_1.default.sep}compiler-cli`;
9
+ const ANGULAR_COMPILER_CLI_PKG_NAME = '@angular/compiler-cli';
10
10
  let ngccPath = '';
11
11
  try {
12
12
  ngccPath = require.resolve('@angular/compiler-cli/ngcc/main-ngcc.js');
13
13
  }
14
14
  catch (_a) {
15
- const compilerCliNgccPath = require.resolve('@angular/compiler-cli/ngcc');
16
- ngccPath = path_1.default.resolve(compilerCliNgccPath.substring(0, compilerCliNgccPath.lastIndexOf(path_1.default.sep)), 'main-ngcc.js');
15
+ try {
16
+ const compilerCliNgccPath = require.resolve('@angular/compiler-cli/ngcc');
17
+ const compilerCliNgccFolder = compilerCliNgccPath.substring(0, compilerCliNgccPath.lastIndexOf(path_1.default.sep));
18
+ ngccPath = path_1.default.resolve(compilerCliNgccFolder, 'main-ngcc.js');
19
+ }
20
+ catch (_b) {
21
+ }
17
22
  }
18
23
  function findNodeModulesDirectory() {
19
- return ngccPath.substring(0, ngccPath.indexOf(ANGULAR_COMPILER_CLI_PKG_NAME));
24
+ return ngccPath.substring(0, ngccPath.indexOf(ANGULAR_COMPILER_CLI_PKG_NAME.replace('/', path_1.default.sep)));
25
+ }
26
+ function findAngularCompilerCliVersion() {
27
+ const packagePath = require.resolve(ANGULAR_COMPILER_CLI_PKG_NAME);
28
+ const substringLength = packagePath.indexOf(ANGULAR_COMPILER_CLI_PKG_NAME.replace('/', path_1.default.sep)) + ANGULAR_COMPILER_CLI_PKG_NAME.length;
29
+ const ngCompilerCliFolder = packagePath.substring(0, substringLength);
30
+ const ngCompilerCliPackageJson = `${ngCompilerCliFolder}/package.json`;
31
+ const { version } = require(ngCompilerCliPackageJson);
32
+ return version;
20
33
  }
21
34
  const nodeModuleDirPath = findNodeModulesDirectory();
22
35
  const runNgccJestProcessor = (tsconfigPath) => {
@@ -45,9 +58,17 @@ const runNgccJestProcessor = (tsconfigPath) => {
45
58
  }
46
59
  }
47
60
  else {
48
- console.log(`Warning: Could not locate '@angular/compiler-cli' to run 'ngcc' automatically.` +
49
- `Please make sure you are running 'ngcc-jest-processor.js' from root level of your project.` +
50
- `'ngcc' must be run before running Jest`);
61
+ const ngCompilerCliVersion = findAngularCompilerCliVersion();
62
+ const [ngMajorVersion] = ngCompilerCliVersion.split('.');
63
+ if (parseInt(ngMajorVersion, 10) < 16) {
64
+ console.log(`Warning: Could not locate '@angular/compiler-cli' to run 'ngcc' automatically.` +
65
+ `Please make sure you are running 'ngcc-jest-processor.js' from root level of your project.` +
66
+ `'ngcc' must be run before running Jest`);
67
+ }
68
+ else {
69
+ console.log(`@angular/compiler-cli@${ngCompilerCliVersion} detected. Skipping 'ngcc'`);
70
+ console.log(`Tip: To avoid this message you can remove 'jest-preset-angular/global-setup' from your jest config`);
71
+ }
51
72
  }
52
73
  };
53
74
  exports.runNgccJestProcessor = runNgccJestProcessor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jest-preset-angular",
3
- "version": "13.0.1",
3
+ "version": "13.1.1",
4
4
  "description": "Jest preset configuration for Angular projects",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -55,56 +55,56 @@
55
55
  "esbuild": ">=0.13.8"
56
56
  },
57
57
  "peerDependencies": {
58
- "@angular-devkit/build-angular": ">=13.0.0 <16.0.0",
59
- "@angular/compiler-cli": ">=13.0.0 <16.0.0",
60
- "@angular/core": ">=13.0.0 <16.0.0",
61
- "@angular/platform-browser-dynamic": ">=13.0.0 <16.0.0",
58
+ "@angular-devkit/build-angular": ">=13.0.0 <17.0.0",
59
+ "@angular/compiler-cli": ">=13.0.0 <17.0.0",
60
+ "@angular/core": ">=13.0.0 <17.0.0",
61
+ "@angular/platform-browser-dynamic": ">=13.0.0 <17.0.0",
62
62
  "jest": "^29.0.0",
63
63
  "typescript": ">=4.4"
64
64
  },
65
65
  "devDependencies": {
66
- "@angular-devkit/build-angular": "^15.2.4",
67
- "@angular/animations": "^15.2.3",
68
- "@angular/common": "^15.2.3",
69
- "@angular/compiler": "^15.2.3",
70
- "@angular/compiler-cli": "~15.2.3",
71
- "@angular/core": "^15.2.3",
72
- "@angular/platform-browser": "^15.2.3",
73
- "@angular/platform-browser-dynamic": "^15.2.3",
74
- "@commitlint/cli": "^17.4.4",
75
- "@commitlint/config-angular": "^17.4.4",
66
+ "@angular-devkit/build-angular": "^16.0.1",
67
+ "@angular/animations": "^16.0.1",
68
+ "@angular/common": "^16.0.1",
69
+ "@angular/compiler": "^16.0.1",
70
+ "@angular/compiler-cli": "~16.0.1",
71
+ "@angular/core": "^16.0.1",
72
+ "@angular/platform-browser": "^16.0.1",
73
+ "@angular/platform-browser-dynamic": "^16.0.1",
74
+ "@commitlint/cli": "^17.6.3",
75
+ "@commitlint/config-angular": "^17.6.3",
76
76
  "@jest/transform": "^29.5.0",
77
77
  "@jest/types": "^29.5.0",
78
- "@types/jest": "^29.5.0",
79
- "@types/node": "^18.14.6",
80
- "@types/semver": "^7.3.13",
81
- "@typescript-eslint/eslint-plugin": "^5.56.0",
82
- "@typescript-eslint/parser": "^5.56.0",
78
+ "@types/jest": "^29.5.1",
79
+ "@types/node": "^18.16.9",
80
+ "@types/semver": "^7.5.0",
81
+ "@typescript-eslint/eslint-plugin": "^5.59.5",
82
+ "@typescript-eslint/parser": "^5.59.5",
83
83
  "chalk": "^4.1.2",
84
84
  "conventional-changelog-cli": "^2.2.2",
85
85
  "cross-env": "^7.0.3",
86
- "eslint": "^8.36.0",
86
+ "eslint": "^8.40.0",
87
87
  "eslint-config-prettier": "^8.8.0",
88
88
  "eslint-plugin-import": "^2.27.5",
89
89
  "eslint-plugin-jest": "^27.2.1",
90
- "eslint-plugin-jsdoc": "^40.1.0",
90
+ "eslint-plugin-jsdoc": "^44.2.3",
91
91
  "eslint-plugin-prefer-arrow": "^1.2.3",
92
92
  "eslint-plugin-prettier": "^4.2.1",
93
93
  "execa": "5.1.1",
94
94
  "fs-extra": "^11.1.1",
95
95
  "github-files-fetcher": "^1.6.0",
96
- "glob": "^9.3.1",
96
+ "glob": "^10.2.2",
97
97
  "husky": "^8.0.3",
98
98
  "jest": "^29.5.0",
99
99
  "jest-snapshot-serializer-raw": "^1.2.0",
100
100
  "pinst": "^3.0.0",
101
- "prettier": "^2.8.6",
102
- "rimraf": "^4.3.0",
103
- "rxjs": "^7.8.0",
101
+ "prettier": "^2.8.8",
102
+ "rimraf": "^5.0.0",
103
+ "rxjs": "^7.8.1",
104
104
  "ts-node": "^10.9.1",
105
105
  "tslib": "^2.5.0",
106
106
  "typescript": "^4.9.5",
107
- "zone.js": "^0.12.0"
107
+ "zone.js": "^0.13.0"
108
108
  },
109
- "packageManager": "yarn@3.5.0"
109
+ "packageManager": "yarn@3.5.1"
110
110
  }