jest-preset-angular 14.2.4 → 14.3.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 +39 -0
- package/README.md +1 -1
- package/build/compiler/ng-jest-compiler.d.ts +11 -0
- package/build/config/global-setup.d.ts +1 -0
- package/build/config/ng-jest-config.d.ts +9 -0
- package/build/constants.d.ts +7 -0
- package/build/index.d.ts +6 -0
- package/build/ng-jest-transformer.d.ts +9 -0
- package/build/presets/index.d.ts +39 -0
- package/build/resolvers/ng-jest-resolver.d.ts +3 -0
- package/build/serializers/html-comment.d.ts +5 -0
- package/build/serializers/index.d.ts +2 -0
- package/build/serializers/ng-snapshot.d.ts +11 -0
- package/build/serializers/no-ng-attributes.d.ts +5 -0
- package/build/transformers/esm_interop_inject.d.cts +1 -0
- package/build/transformers/jit_transform.js +41 -41
- package/build/transformers/replace-resources.d.ts +2 -0
- package/build/utils/ngcc-jest-processor.d.ts +1 -0
- package/package.json +26 -25
- package/setup-env/utils.mjs +19 -0
- package/setup-env/zone/index.d.mts +3 -0
- package/setup-env/zone/index.d.ts +6 -0
- package/setup-env/zone/index.js +43 -0
- package/setup-env/zone/index.mjs +18 -0
- package/setup-env/zoneless/index.d.mts +3 -0
- package/setup-env/zoneless/index.d.ts +6 -0
- package/setup-env/zoneless/index.js +11 -0
- package/setup-env/zoneless/index.mjs +39 -0
- package/setup-jest.js +10 -0
- package/setup-jest.mjs +12 -1
- package/jest-cjs.config.ts +0 -8
- package/jest-esm.config.ts +0 -8
- package/jest-src.config.ts +0 -18
- package/jest-transpile-cjs.config.ts +0 -8
- package/jest-transpile-esm.config.ts +0 -8
- package/tsconfig-base.spec.json +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
+
## [14.3.0](https://github.com/thymikee/jest-preset-angular/compare/v14.2.4...v14.3.0) (2024-11-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* feat: add new setup test env functions ([21c0238](https://github.com/thymikee/jest-preset-angular/commit/21c0238)), closes [#354](https://github.com/thymikee/jest-preset-angular/issues/354) [#2755](https://github.com/thymikee/jest-preset-angular/issues/2755)
|
|
7
|
+
* feat: build package with type definitions ([a269daa](https://github.com/thymikee/jest-preset-angular/commit/a269daa))
|
|
8
|
+
* feat: deprecate `setup-jest.js` and `setup-jest.mjs` ([a304036](https://github.com/thymikee/jest-preset-angular/commit/a304036))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Code Refactoring
|
|
12
|
+
|
|
13
|
+
* test: switch example app test config files to ts ([e61f1ff](https://github.com/thymikee/jest-preset-angular/commit/e61f1ff))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## DEPRECATIONS
|
|
17
|
+
|
|
18
|
+
Importing `setup-jest.js`/`setup-jest.mjs` directly is deprecated. The files will be removed in the future.
|
|
19
|
+
|
|
20
|
+
Please use "setupZoneTestEnv" function instead. Example:
|
|
21
|
+
|
|
22
|
+
For CJS
|
|
23
|
+
```
|
|
24
|
+
// setup-jest.ts
|
|
25
|
+
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env';
|
|
26
|
+
|
|
27
|
+
setupZoneTestEnv();
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
For ESM
|
|
31
|
+
```
|
|
32
|
+
// setup-jest.ts
|
|
33
|
+
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/index.mjs';
|
|
34
|
+
|
|
35
|
+
setupZoneTestEnv();
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
1
40
|
## [14.2.4](https://github.com/thymikee/jest-preset-angular/compare/v14.2.3...v14.2.4) (2024-09-12)
|
|
2
41
|
|
|
3
42
|
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="https://actions-badge.atrox.dev/thymikee/jest-preset-angular/goto?ref=main"><img alt="Build Status" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fthymikee%2Fjest-preset-angular%2Fbadge%3Fref%3Dmain&style=flat-square" /></a>
|
|
7
7
|
<a href="https://www.npmjs.com/package/jest-preset-angular"><img src="https://img.shields.io/npm/v/jest-preset-angular/latest.svg?style=flat-square" alt="NPM Version" /></a>
|
|
8
|
-
<a href="https://github.com/thymikee/jest-preset-angular/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/jest-preset-angular.svg?style=flat-square" alt="GitHub license" /></a>
|
|
8
|
+
<a href="https://github.com/thymikee/jest-preset-angular/blob/main/LICENSE.md"><img src="https://img.shields.io/npm/l/jest-preset-angular.svg?style=flat-square" alt="GitHub license" /></a>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
> Our online documentation is available at https://thymikee.github.io/jest-preset-angular/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type TsJestAstTransformer, TsCompiler, type ConfigSet } from 'ts-jest';
|
|
2
|
+
import type ts from 'typescript';
|
|
3
|
+
export declare class NgJestCompiler extends TsCompiler {
|
|
4
|
+
readonly configSet: ConfigSet;
|
|
5
|
+
readonly jestCacheFS: Map<string, string>;
|
|
6
|
+
private readonly _defaultLibDirPath;
|
|
7
|
+
private readonly _libSourceFileCache;
|
|
8
|
+
constructor(configSet: ConfigSet, jestCacheFS: Map<string, string>);
|
|
9
|
+
protected _transpileOutput(fileContent: string, filePath: string): ts.TranspileOutput;
|
|
10
|
+
protected _makeTransformers(customTransformers: TsJestAstTransformer): ts.CustomTransformers;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const globalSetup: () => Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Logger } from 'bs-logger';
|
|
2
|
+
import { globsToMatcher } from 'jest-util';
|
|
3
|
+
import { type RawCompilerOptions, ConfigSet, type TsJestTransformOptions } from 'ts-jest';
|
|
4
|
+
import type { ParsedCommandLine } from 'typescript';
|
|
5
|
+
export declare class NgJestConfig extends ConfigSet {
|
|
6
|
+
readonly processWithEsbuild: ReturnType<typeof globsToMatcher>;
|
|
7
|
+
constructor(jestConfig: TsJestTransformOptions['config'] | undefined, parentLogger?: Logger | undefined);
|
|
8
|
+
protected _resolveTsConfig(compilerOptions?: RawCompilerOptions, resolvedConfigFile?: string): ParsedCommandLine;
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const TEMPLATE_URL = "templateUrl";
|
|
2
|
+
export declare const STYLE_URLS = "styleUrls";
|
|
3
|
+
export declare const STYLE_URL = "styleUrl";
|
|
4
|
+
export declare const STYLES = "styles";
|
|
5
|
+
export declare const TEMPLATE = "template";
|
|
6
|
+
export declare const REQUIRE = "require";
|
|
7
|
+
export declare const COMPONENT = "Component";
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TransformedSource } from '@jest/transform';
|
|
2
|
+
import { type TsJestTransformerOptions, ConfigSet, TsJestTransformer, type TsJestTransformOptions } from 'ts-jest';
|
|
3
|
+
export declare class NgJestTransformer extends TsJestTransformer {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(tsJestConfig?: TsJestTransformerOptions);
|
|
6
|
+
protected _createConfigSet(config: TsJestTransformOptions['config'] | undefined): ConfigSet;
|
|
7
|
+
protected _createCompiler(configSet: ConfigSet, cacheFS: Map<string, string>): void;
|
|
8
|
+
process(fileContent: string, filePath: string, transformOptions: TsJestTransformOptions): TransformedSource;
|
|
9
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { TsJestTransformerOptions } from 'ts-jest';
|
|
2
|
+
declare const defaultTransformerOptions: TsJestTransformerOptions;
|
|
3
|
+
declare const defaultPreset: {
|
|
4
|
+
transformIgnorePatterns: string[];
|
|
5
|
+
transform: {
|
|
6
|
+
'^.+\\.(ts|js|mjs|html|svg)$': (string | import("ts-jest").TsJestGlobalOptions)[];
|
|
7
|
+
};
|
|
8
|
+
testEnvironment?: string | undefined;
|
|
9
|
+
moduleFileExtensions?: string[] | undefined;
|
|
10
|
+
snapshotSerializers?: string[] | undefined;
|
|
11
|
+
};
|
|
12
|
+
declare const defaultEsmPreset: {
|
|
13
|
+
extensionsToTreatAsEsm: string[];
|
|
14
|
+
moduleNameMapper: {
|
|
15
|
+
tslib: string;
|
|
16
|
+
};
|
|
17
|
+
transform: {
|
|
18
|
+
'^.+\\.(ts|js|html|svg)$': (string | {
|
|
19
|
+
useESM: boolean;
|
|
20
|
+
tsconfig?: boolean | string | import("ts-jest").RawCompilerOptions;
|
|
21
|
+
isolatedModules?: boolean;
|
|
22
|
+
compiler?: "typescript" | "ttypescript" | string;
|
|
23
|
+
astTransformers?: import("ts-jest").ConfigCustomTransformer;
|
|
24
|
+
diagnostics?: boolean | {
|
|
25
|
+
pretty?: boolean;
|
|
26
|
+
ignoreCodes?: number | string | Array<number | string>;
|
|
27
|
+
exclude?: string[];
|
|
28
|
+
warnOnly?: boolean;
|
|
29
|
+
};
|
|
30
|
+
babelConfig?: boolean | string | import("ts-jest").BabelConfig;
|
|
31
|
+
stringifyContentPathRegex?: string | RegExp;
|
|
32
|
+
})[];
|
|
33
|
+
};
|
|
34
|
+
transformIgnorePatterns: string[];
|
|
35
|
+
testEnvironment?: string | undefined;
|
|
36
|
+
moduleFileExtensions?: string[] | undefined;
|
|
37
|
+
snapshotSerializers?: string[] | undefined;
|
|
38
|
+
};
|
|
39
|
+
export { defaultPreset, defaultEsmPreset, defaultTransformerOptions };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { OldPlugin } from 'pretty-format';
|
|
2
|
+
type PluginPrintFnArgs = Parameters<OldPlugin['print']>;
|
|
3
|
+
type NgSnapshotOptions = {
|
|
4
|
+
omitAllCompAttrs?: boolean;
|
|
5
|
+
};
|
|
6
|
+
type PluginPrintFn = (fixture: PluginPrintFnArgs[0], printer: PluginPrintFnArgs[1], indent: PluginPrintFnArgs[2], opts: PluginPrintFnArgs[3] & NgSnapshotOptions, colors: PluginPrintFnArgs[4]) => string;
|
|
7
|
+
declare const _default: {
|
|
8
|
+
print: PluginPrintFn;
|
|
9
|
+
test: (arg0: any) => boolean;
|
|
10
|
+
};
|
|
11
|
+
export = _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
serialize: (val: any, config: import("pretty-format").Config, indentation: string, depth: number, refs: import("pretty-format").Refs, printer: import("pretty-format").Printer) => string;
|
|
3
|
+
test: (arg0: any) => boolean;
|
|
4
|
+
};
|
|
5
|
+
export = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const import_meta_url: import("url").URL;
|