@taiga-ui/jest-config 0.301.0 → 0.302.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/jest.config.d.ts +1 -0
- package/jest.config.js +1 -0
- package/package.json +1 -1
- package/polyfill.js +17 -0
- package/polyfill.ts +20 -0
- package/simple.spec.js +0 -10
- /package/{simple.spec.d.ts → polyfill.d.ts} +0 -0
package/jest.config.d.ts
CHANGED
package/jest.config.js
CHANGED
|
@@ -32,6 +32,7 @@ exports.default = {
|
|
|
32
32
|
preset: 'jest-preset-angular',
|
|
33
33
|
reporters: ['default'],
|
|
34
34
|
rootDir: process.cwd(),
|
|
35
|
+
setupFiles: [require.resolve('./polyfill')],
|
|
35
36
|
setupFilesAfterEnv: (0, node_fs_1.existsSync)(setupJestFile)
|
|
36
37
|
? [(0, node_path_1.resolve)(process.cwd(), './node_modules/@taiga-ui/testing/setup-jest/index.ts')]
|
|
37
38
|
: [],
|
package/package.json
CHANGED
package/polyfill.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
if (typeof globalThis.structuredClone !== 'function') {
|
|
4
|
+
globalThis.structuredClone = (obj) => JSON.parse(JSON.stringify(obj));
|
|
5
|
+
}
|
|
6
|
+
if (typeof globalThis.setImmediate !== 'function') {
|
|
7
|
+
globalThis.setImmediate = ((fn, ...args) => setTimeout(fn, 0, ...args));
|
|
8
|
+
}
|
|
9
|
+
if (typeof globalThis.clearImmediate !== 'function') {
|
|
10
|
+
globalThis.clearImmediate = ((timeoutId) => clearTimeout(timeoutId));
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Should be here because
|
|
14
|
+
* SyntaxError: Unexpected token 'export'
|
|
15
|
+
* Jest encountered an unexpected token
|
|
16
|
+
*/
|
|
17
|
+
module.exports = {};
|
package/polyfill.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
if (typeof globalThis.structuredClone !== 'function') {
|
|
2
|
+
globalThis.structuredClone = (obj: unknown) => JSON.parse(JSON.stringify(obj));
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
if (typeof globalThis.setImmediate !== 'function') {
|
|
6
|
+
globalThis.setImmediate = ((fn: (...args: unknown[]) => void, ...args: unknown[]) =>
|
|
7
|
+
setTimeout(fn, 0, ...args)) as unknown as typeof globalThis.setImmediate;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (typeof globalThis.clearImmediate !== 'function') {
|
|
11
|
+
globalThis.clearImmediate = ((timeoutId: number | undefined) =>
|
|
12
|
+
clearTimeout(timeoutId)) as unknown as typeof globalThis.clearImmediate;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Should be here because
|
|
17
|
+
* SyntaxError: Unexpected token 'export'
|
|
18
|
+
* Jest encountered an unexpected token
|
|
19
|
+
*/
|
|
20
|
+
module.exports = {};
|
package/simple.spec.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const globals_1 = require("@jest/globals");
|
|
5
|
-
const jest_config_1 = tslib_1.__importDefault(require("./jest.config"));
|
|
6
|
-
(0, globals_1.describe)('Jest config', () => {
|
|
7
|
-
(0, globals_1.it)('moduleNameMapper is not empty', () => {
|
|
8
|
-
(0, globals_1.expect)(jest_config_1.default.moduleNameMapper).toBeInstanceOf(Object);
|
|
9
|
-
});
|
|
10
|
-
});
|
|
File without changes
|