@taiga-ui/jest-config 0.223.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/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # @taiga-ui/jest-config
2
+
3
+ Common Jest configuration for taiga-ui projects
4
+
5
+ ## Usage
6
+
7
+ 1. Install from npm
8
+
9
+ ```bash
10
+ npm i --save-dev @taiga-ui/jest-config
11
+ ```
12
+
13
+ 2. Add to `package.json`
14
+
15
+ ```json
16
+ {
17
+ "jest": {
18
+ "preset": "@taiga-ui/jest-config"
19
+ }
20
+ }
21
+ ```
@@ -0,0 +1,2 @@
1
+ declare const preset: any;
2
+ export default preset;
package/jest-preset.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const preset = require(require('node:path').resolve(__dirname, './jest.config.js'));
4
+ exports.default = preset;
5
+ /**
6
+ * Should be here because
7
+ * SyntaxError: Unexpected token 'export'
8
+ * Jest encountered an unexpected token
9
+ */
10
+ module.exports = preset;
@@ -0,0 +1,35 @@
1
+ declare const _default: {
2
+ rootDir: string;
3
+ preset: string;
4
+ testEnvironment: string;
5
+ setupFilesAfterEnv: string[];
6
+ extensionsToTreatAsEsm: string[];
7
+ transform: {
8
+ '^.+\\.(ts|js|mjs|html|svg)$': ["jest-preset-angular", {
9
+ tsconfig: string;
10
+ stringifyContentPathRegex: string;
11
+ isolatedModules: true;
12
+ diagnostics: true;
13
+ }];
14
+ };
15
+ transformIgnorePatterns: string[];
16
+ testMatch: string[];
17
+ testPathIgnorePatterns: string[];
18
+ coverageDirectory: string;
19
+ collectCoverageFrom: string[];
20
+ coveragePathIgnorePatterns: string[];
21
+ moduleNameMapper: {
22
+ [key: string]: string | string[];
23
+ } | undefined;
24
+ modulePathIgnorePatterns: string[];
25
+ coverageReporters: ("clover" | "lcov")[];
26
+ cacheDirectory: string;
27
+ maxConcurrency: number;
28
+ maxWorkers: number;
29
+ verbose: boolean;
30
+ bail: number;
31
+ reporters: string[];
32
+ passWithNoTests: true;
33
+ collectCoverage: true;
34
+ };
35
+ export default _default;
package/jest.config.js ADDED
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /// <reference lib="es2021" />
4
+ const node_path_1 = require("node:path");
5
+ const ts_jest_1 = require("ts-jest");
6
+ process.env.TZ = 'Europe/Moscow';
7
+ process.env.FORCE_COLOR = 'true';
8
+ process.env.TS_JEST_DISABLE_VER_CHECKER = 'true';
9
+ const { compilerOptions } = require((0, node_path_1.resolve)(process.cwd(), 'tsconfig.json'));
10
+ const maxParallel = require('node:os').cpus().length / 2;
11
+ exports.default = {
12
+ rootDir: process.cwd(),
13
+ preset: 'jest-preset-angular',
14
+ testEnvironment: 'jsdom',
15
+ setupFilesAfterEnv: [
16
+ (0, node_path_1.resolve)(process.cwd(), './node_modules/@taiga-ui/testing/setup-jest/index.ts'),
17
+ ],
18
+ extensionsToTreatAsEsm: ['.ts'],
19
+ transform: {
20
+ '^.+\\.(ts|js|mjs|html|svg)$': [
21
+ 'jest-preset-angular',
22
+ {
23
+ tsconfig: (0, node_path_1.resolve)(process.cwd(), 'tsconfig.spec.json'),
24
+ stringifyContentPathRegex: String.raw `\.html$`,
25
+ isolatedModules: true,
26
+ diagnostics: true,
27
+ },
28
+ ],
29
+ },
30
+ transformIgnorePatterns: [
31
+ String.raw `node_modules/(?!@angular|rxjs|ngx-highlightjs|@maskito|@ng-web-apis|@taiga-ui\/event-plugins|@taiga-ui\/polymorpheus)`,
32
+ ],
33
+ testMatch: ['<rootDir>/projects/**/*.spec.ts'],
34
+ testPathIgnorePatterns: ['/cypress/', '/playwright/', '/node_modules/'],
35
+ coverageDirectory: '<rootDir>/coverage',
36
+ collectCoverageFrom: ['<rootDir>/**/*.ts'],
37
+ coveragePathIgnorePatterns: ['node_modules', 'schematics', '.spec.ts', '.cy.ts'],
38
+ moduleNameMapper: (0, ts_jest_1.pathsToModuleNameMapper)(compilerOptions.paths, {
39
+ prefix: `<rootDir>/${compilerOptions.baseUrl}/`
40
+ .replaceAll('./', '/')
41
+ .replaceAll(/\/\/+/g, '/'),
42
+ }),
43
+ modulePathIgnorePatterns: ['.cache', 'dist', '<rootDir>/dist/'],
44
+ coverageReporters: ['lcov', 'clover'],
45
+ cacheDirectory: '<rootDir>/node_modules/.cache/jest',
46
+ maxConcurrency: maxParallel,
47
+ maxWorkers: maxParallel,
48
+ verbose: !process.env.CI,
49
+ bail: 1,
50
+ reporters: ['default'],
51
+ passWithNoTests: true,
52
+ collectCoverage: true,
53
+ };
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@taiga-ui/jest-config",
3
+ "version": "0.223.0",
4
+ "description": "Taiga UI jest config",
5
+ "keywords": [
6
+ "jest",
7
+ "prettier"
8
+ ],
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/taiga-family/configurations.git"
12
+ },
13
+ "license": "Apache-2.0",
14
+ "main": "jest.config.js",
15
+ "types": "jest.config.d.ts",
16
+ "peerDependencies": {
17
+ "@taiga-ui/testing": ">=4.10.0",
18
+ "@types/jest": ">=29.5.13",
19
+ "jest": ">=29.7.0",
20
+ "jest-preset-angular": ">=14.2.4",
21
+ "ts-jest": ">=29.2.5"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ }
26
+ }