jest-preset-angular 14.5.3 → 14.5.5
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 +19 -0
- package/build/compiler/ng-jest-compiler.d.ts +1 -1
- package/build/compiler/ng-jest-compiler.js +16 -7
- package/build/environments/jest-jsdom-env.js +17 -7
- package/build/presets/index.d.ts +1081 -38
- package/build/presets/index.js +28 -9
- package/build/transformers/jit_transform.js +38 -38
- package/package.json +32 -30
- package/presets/defaults/jest-preset.js +1 -1
- package/presets/defaults-esm/jest-preset.js +1 -1
- package/presets/index.d.ts +3 -24
- package/presets/index.js +1 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [14.5.5](https://github.com/thymikee/jest-preset-angular/compare/v14.5.4...v14.5.5) (2025-04-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* fix: allow name exports for `presets` subpath ([9100baf](https://github.com/thymikee/jest-preset-angular/commit/9100baf))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## [14.5.4](https://github.com/thymikee/jest-preset-angular/compare/v14.5.3...v14.5.4) (2025-03-31)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* fix: warn when using both `isolatedModules` and `emitDecoratorMetadata` (#3029) ([51db8f4](https://github.com/thymikee/jest-preset-angular/commit/51db8f4)), closes [#3029](https://github.com/thymikee/jest-preset-angular/issues/3029)
|
|
16
|
+
* update dependency ts-jest to v29.3.0 ([1d8415d](https://github.com/thymikee/jest-preset-angular/commit/1d8415d))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
1
20
|
## [14.5.3](https://github.com/thymikee/jest-preset-angular/compare/v14.5.2...v14.5.3) (2025-02-24)
|
|
2
21
|
|
|
3
22
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type TsJestAstTransformer, TsCompiler, type ConfigSet } from 'ts-jest';
|
|
2
|
-
import
|
|
2
|
+
import ts from 'typescript';
|
|
3
3
|
export declare class NgJestCompiler extends TsCompiler {
|
|
4
4
|
readonly configSet: ConfigSet;
|
|
5
5
|
readonly jestCacheFS: Map<string, string>;
|
|
@@ -7,6 +7,7 @@ exports.NgJestCompiler = void 0;
|
|
|
7
7
|
const node_os_1 = __importDefault(require("node:os"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const ts_jest_1 = require("ts-jest");
|
|
10
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
10
11
|
const jit_transform_1 = require("../transformers/jit_transform");
|
|
11
12
|
const replace_resources_1 = require("../transformers/replace-resources");
|
|
12
13
|
class NgJestCompiler extends ts_jest_1.TsCompiler {
|
|
@@ -22,20 +23,26 @@ class NgJestCompiler extends ts_jest_1.TsCompiler {
|
|
|
22
23
|
const compilerOptions = Object.assign({}, this._compilerOptions);
|
|
23
24
|
const options = compilerOptions
|
|
24
25
|
?
|
|
25
|
-
|
|
26
|
+
typescript_1.default.fixupCompilerOptions(compilerOptions, diagnostics)
|
|
26
27
|
: {};
|
|
27
|
-
const defaultOptions =
|
|
28
|
+
const defaultOptions = typescript_1.default.getDefaultCompilerOptions();
|
|
28
29
|
for (const key in defaultOptions) {
|
|
29
30
|
if (Object.prototype.hasOwnProperty.call(defaultOptions, key) && options[key] === undefined) {
|
|
30
31
|
options[key] = defaultOptions[key];
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
for (const option of
|
|
34
|
+
for (const option of typescript_1.default.transpileOptionValueCompilerOptions) {
|
|
34
35
|
options[option.name] = option.transpileOptionValue;
|
|
35
36
|
}
|
|
37
|
+
if (options.isolatedModules && options.emitDecoratorMetadata) {
|
|
38
|
+
this._logger.warn(`
|
|
39
|
+
TypeScript compiler option 'isolatedModules' may prevent the 'emitDecoratorMetadata' option from emitting all metadata.
|
|
40
|
+
The 'emitDecoratorMetadata' option is not required by Angular and can be removed if not explicitly required by the project.'
|
|
41
|
+
`);
|
|
42
|
+
}
|
|
36
43
|
options.suppressOutputPathCheck = true;
|
|
37
44
|
options.allowNonTsExtensions = true;
|
|
38
|
-
const sourceFile =
|
|
45
|
+
const sourceFile = typescript_1.default.createSourceFile(filePath, fileContent, (_a = options.target) !== null && _a !== void 0 ? _a : typescript_1.default.ScriptTarget.Latest);
|
|
39
46
|
let outputText;
|
|
40
47
|
let sourceMapText;
|
|
41
48
|
const compilerHost = {
|
|
@@ -62,14 +69,16 @@ class NgJestCompiler extends ts_jest_1.TsCompiler {
|
|
|
62
69
|
directoryExists: () => true,
|
|
63
70
|
getDirectories: () => [],
|
|
64
71
|
};
|
|
65
|
-
this.program =
|
|
72
|
+
this.program = typescript_1.default.createProgram([filePath], options, compilerHost);
|
|
66
73
|
this.program.emit(undefined, undefined, undefined, undefined, this._makeTransformers(this.configSet.resolvedTransformers));
|
|
67
74
|
return { outputText: outputText !== null && outputText !== void 0 ? outputText : '', diagnostics, sourceMapText };
|
|
68
75
|
}
|
|
69
76
|
_makeTransformers(customTransformers) {
|
|
77
|
+
var _a;
|
|
70
78
|
const program = this.program;
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
const transformerFactories = super._makeTransformers(customTransformers);
|
|
80
|
+
return Object.assign(Object.assign(Object.assign({}, transformerFactories.after), transformerFactories.afterDeclarations), { before: [
|
|
81
|
+
...((_a = transformerFactories.before) !== null && _a !== void 0 ? _a : []),
|
|
73
82
|
(0, replace_resources_1.replaceResources)(program),
|
|
74
83
|
(0, jit_transform_1.angularJitApplicationTransform)(program),
|
|
75
84
|
] });
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|