jest-preset-angular 16.1.5 → 17.0.0
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 +23 -0
- package/build/config/ng-jest-config.d.ts +1 -5
- package/build/config/ng-jest-config.js +0 -13
- package/build/ng-jest-transformer.js +1 -1
- package/build/presets/index.d.ts +14 -6
- package/build/serializers/ng-snapshot.js +1 -1
- package/build/transformers/jit_transform.js +38 -39
- package/package.json +50 -53
- package/setup-env/zone/index.js +18 -42
- package/setup-env/zone/index.mjs +18 -39
- package/setup-env/zoneless/index.js +17 -45
- package/setup-env/zoneless/index.mjs +17 -44
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
# [17.0.0](https://github.com/thymikee/jest-preset-angular/compare/v16.2.0...v17.0.0) (2026-06-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### BREAKING CHANGES
|
|
5
|
+
|
|
6
|
+
* Minimum supported version for `esbuild` is now `0.28.0`
|
|
7
|
+
* Minimum supported version for Angular now is `v20`
|
|
8
|
+
* Minimum supported version for NodeJs is now `v20`
|
|
9
|
+
* Drop support for `@angular/platform-browser-dynamic` from `peerDependencies`. Users should use `@angular/platform-browser` instead.
|
|
10
|
+
* Configuring `ngJest` via Jest `globals` option is no longer supported. Please configure via `transform` option instead.
|
|
11
|
+
* Drop support for `provideExperimentalZonelessChangeDetection` fallback. Angular `v20` shipped `provideZonelessChangeDetection` as a stable API, so the fallback is no longer needed.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# [16.2.0](https://github.com/thymikee/jest-preset-angular/compare/v16.1.5...v16.2.0) (2026-06-09)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* Support angular 22 ([#3821](https://github.com/thymikee/jest-preset-angular/issues/3821)) ([a267f0e](https://github.com/thymikee/jest-preset-angular/commit/a267f0e7cc1a74453bda049080c0681e3507cca7)), closes [#3811](https://github.com/thymikee/jest-preset-angular/issues/3811)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
1
24
|
## [16.1.5](https://github.com/thymikee/jest-preset-angular/compare/v16.1.4...v16.1.5) (2026-05-07)
|
|
2
25
|
|
|
3
26
|
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { globsToMatcher } from 'jest-util';
|
|
3
|
-
import { type RawCompilerOptions, ConfigSet, type TsJestTransformOptions } from 'ts-jest';
|
|
1
|
+
import { type RawCompilerOptions, ConfigSet } from 'ts-jest';
|
|
4
2
|
import type { ParsedCommandLine } from 'typescript';
|
|
5
3
|
export declare class NgJestConfig extends ConfigSet {
|
|
6
|
-
readonly processWithEsbuild: ReturnType<typeof globsToMatcher>;
|
|
7
|
-
constructor(jestConfig: TsJestTransformOptions['config'] | undefined, parentLogger?: Logger | undefined);
|
|
8
4
|
protected _resolveTsConfig(compilerOptions?: RawCompilerOptions, resolvedConfigFile?: string): ParsedCommandLine;
|
|
9
5
|
}
|
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NgJestConfig = exports.defaultProcessWithEsbuildPatterns = void 0;
|
|
4
|
-
const jest_util_1 = require("jest-util");
|
|
5
4
|
const ts_jest_1 = require("ts-jest");
|
|
6
5
|
exports.defaultProcessWithEsbuildPatterns = ['**/*.mjs'];
|
|
7
6
|
class NgJestConfig extends ts_jest_1.ConfigSet {
|
|
8
|
-
processWithEsbuild;
|
|
9
|
-
constructor(jestConfig, parentLogger) {
|
|
10
|
-
super(jestConfig, parentLogger);
|
|
11
|
-
const jestGlobalsConfig = jestConfig?.globals?.ngJest ?? Object.create(null);
|
|
12
|
-
if (jestGlobalsConfig.processWithEsbuild) {
|
|
13
|
-
this.logger.warn('Specifying `processWithEsbuild` in `ngJest` config is deprecated and will be removed in the next major version. Please follow this documentation https://thymikee.github.io/jest-preset-angular/docs/getting-started/options#processing-with-esbuild instead.');
|
|
14
|
-
}
|
|
15
|
-
this.processWithEsbuild = (0, jest_util_1.globsToMatcher)([
|
|
16
|
-
...(jestGlobalsConfig.processWithEsbuild ?? []),
|
|
17
|
-
...exports.defaultProcessWithEsbuildPatterns,
|
|
18
|
-
]);
|
|
19
|
-
}
|
|
20
7
|
_resolveTsConfig(compilerOptions, resolvedConfigFile) {
|
|
21
8
|
const result = super._resolveTsConfig(compilerOptions, resolvedConfigFile);
|
|
22
9
|
result.options.enableIvy = true;
|
|
@@ -64,7 +64,7 @@ class NgJestTransformer extends ts_jest_1.TsJestTransformer {
|
|
|
64
64
|
}
|
|
65
65
|
process(fileContent, filePath, transformOptions) {
|
|
66
66
|
const configSet = super._configsFor(transformOptions);
|
|
67
|
-
if (
|
|
67
|
+
if (this.#processWithEsbuild(filePath)) {
|
|
68
68
|
this.#ngJestLogger.debug({ filePath }, 'process with esbuild');
|
|
69
69
|
const compilerOpts = configSet.parsedTsConfig.options;
|
|
70
70
|
const useESM = transformOptions.supportsStaticESM && configSet.useESM;
|
package/build/presets/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ declare const presetEntries: {
|
|
|
23
23
|
changedSince?: string | undefined;
|
|
24
24
|
collectCoverage?: boolean | undefined;
|
|
25
25
|
collectCoverageFrom?: string[] | undefined;
|
|
26
|
+
collectTests?: boolean | undefined;
|
|
26
27
|
coverageDirectory?: string | undefined;
|
|
27
28
|
coveragePathIgnorePatterns?: string[] | undefined;
|
|
28
29
|
coverageProvider?: "babel" | "v8" | undefined;
|
|
@@ -55,9 +56,9 @@ declare const presetEntries: {
|
|
|
55
56
|
fakeTimers?: ({
|
|
56
57
|
enableGlobally?: boolean | undefined;
|
|
57
58
|
} & ({
|
|
58
|
-
now?: number | undefined;
|
|
59
59
|
advanceTimers?: number | boolean | undefined;
|
|
60
|
-
doNotFake?: ("Date" | "hrtime" | "nextTick" | "performance" | "queueMicrotask" | "requestAnimationFrame" | "cancelAnimationFrame" | "requestIdleCallback" | "cancelIdleCallback" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "setTimeout" | "clearTimeout")[] | undefined;
|
|
60
|
+
doNotFake?: ("Date" | "hrtime" | "nextTick" | "performance" | "queueMicrotask" | "requestAnimationFrame" | "cancelAnimationFrame" | "requestIdleCallback" | "cancelIdleCallback" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "setTimeout" | "clearTimeout" | "Temporal")[] | undefined;
|
|
61
|
+
now?: number | undefined;
|
|
61
62
|
timerLimit?: number | undefined;
|
|
62
63
|
legacyFakeTimers?: false | undefined;
|
|
63
64
|
} | {
|
|
@@ -119,7 +120,9 @@ declare const presetEntries: {
|
|
|
119
120
|
resolver?: string | null | undefined;
|
|
120
121
|
restoreMocks?: boolean | undefined;
|
|
121
122
|
roots?: string[] | undefined;
|
|
122
|
-
runner?: string |
|
|
123
|
+
runner?: string | [string, {
|
|
124
|
+
[x: string]: unknown;
|
|
125
|
+
}] | undefined;
|
|
123
126
|
runTestsByPath?: boolean | undefined;
|
|
124
127
|
runtime?: string | undefined;
|
|
125
128
|
sandboxInjectedGlobals?: string[] | undefined;
|
|
@@ -183,6 +186,7 @@ declare const presetEntries: {
|
|
|
183
186
|
watchPlugins?: (string | [string, unknown])[] | undefined;
|
|
184
187
|
workerIdleMemoryLimit?: string | number | undefined;
|
|
185
188
|
workerThreads?: boolean | undefined;
|
|
189
|
+
workerGracefulExitTimeout?: number | undefined;
|
|
186
190
|
}, "transform" | "transformIgnorePatterns">>;
|
|
187
191
|
createEsmPreset: (options?: {
|
|
188
192
|
tsconfig?: import("ts-jest").TsJestTransformerOptions["tsconfig"];
|
|
@@ -208,6 +212,7 @@ declare const presetEntries: {
|
|
|
208
212
|
changedSince?: string | undefined;
|
|
209
213
|
collectCoverage?: boolean | undefined;
|
|
210
214
|
collectCoverageFrom?: string[] | undefined;
|
|
215
|
+
collectTests?: boolean | undefined;
|
|
211
216
|
coverageDirectory?: string | undefined;
|
|
212
217
|
coveragePathIgnorePatterns?: string[] | undefined;
|
|
213
218
|
coverageProvider?: "babel" | "v8" | undefined;
|
|
@@ -240,9 +245,9 @@ declare const presetEntries: {
|
|
|
240
245
|
fakeTimers?: ({
|
|
241
246
|
enableGlobally?: boolean | undefined;
|
|
242
247
|
} & ({
|
|
243
|
-
now?: number | undefined;
|
|
244
248
|
advanceTimers?: number | boolean | undefined;
|
|
245
|
-
doNotFake?: ("Date" | "hrtime" | "nextTick" | "performance" | "queueMicrotask" | "requestAnimationFrame" | "cancelAnimationFrame" | "requestIdleCallback" | "cancelIdleCallback" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "setTimeout" | "clearTimeout")[] | undefined;
|
|
249
|
+
doNotFake?: ("Date" | "hrtime" | "nextTick" | "performance" | "queueMicrotask" | "requestAnimationFrame" | "cancelAnimationFrame" | "requestIdleCallback" | "cancelIdleCallback" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "setTimeout" | "clearTimeout" | "Temporal")[] | undefined;
|
|
250
|
+
now?: number | undefined;
|
|
246
251
|
timerLimit?: number | undefined;
|
|
247
252
|
legacyFakeTimers?: false | undefined;
|
|
248
253
|
} | {
|
|
@@ -304,7 +309,9 @@ declare const presetEntries: {
|
|
|
304
309
|
resolver?: string | null | undefined;
|
|
305
310
|
restoreMocks?: boolean | undefined;
|
|
306
311
|
roots?: string[] | undefined;
|
|
307
|
-
runner?: string |
|
|
312
|
+
runner?: string | [string, {
|
|
313
|
+
[x: string]: unknown;
|
|
314
|
+
}] | undefined;
|
|
308
315
|
runTestsByPath?: boolean | undefined;
|
|
309
316
|
runtime?: string | undefined;
|
|
310
317
|
sandboxInjectedGlobals?: string[] | undefined;
|
|
@@ -368,6 +375,7 @@ declare const presetEntries: {
|
|
|
368
375
|
watchPlugins?: (string | [string, unknown])[] | undefined;
|
|
369
376
|
workerIdleMemoryLimit?: string | number | undefined;
|
|
370
377
|
workerThreads?: boolean | undefined;
|
|
378
|
+
workerGracefulExitTimeout?: number | undefined;
|
|
371
379
|
}, "extensionsToTreatAsEsm" | "moduleNameMapper" | "transform" | "transformIgnorePatterns">>;
|
|
372
380
|
};
|
|
373
381
|
export = presetEntries;
|
|
@@ -19,7 +19,7 @@ const print = (fixture, printer, indent, opts, colors) => {
|
|
|
19
19
|
const componentDef = componentRef.componentType.ɵcmp;
|
|
20
20
|
const componentName = componentDef.selectors[0][0];
|
|
21
21
|
const nodes = Array.from(componentRef.location.nativeElement.childNodes).map(printer).join('');
|
|
22
|
-
let serializedComponent
|
|
22
|
+
let serializedComponent;
|
|
23
23
|
if (opts.omitAllCompAttrs) {
|
|
24
24
|
serializedComponent = '<' + componentName + '>\n' + indent(nodes) + '\n</' + componentName + '>';
|
|
25
25
|
}
|