-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathjest.preset.js
61 lines (59 loc) · 1.59 KB
/
jest.preset.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const nxPreset = require('@nrwl/jest/preset');
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { paths } = require('./tsconfig.base.json').compilerOptions;
const webpackConfig = require('./webpack.config');
function getWasmOptions() {
const cfg = webpackConfig({
mode: 'development',
resolve: {
extensions: [],
},
module: {
rules: [],
},
});
return cfg.module.rules[0].use[0].options;
}
module.exports = {
...nxPreset,
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
},
transform: {
'^.+\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular', //'ts-jest',
'^.+\\.(c|cpp)$': ['jest-cpp-wasm', getWasmOptions()],
},
moduleFileExtensions: ['ts', 'html', 'js', 'mjs', 'json'],
transformIgnorePatterns: [
'node_modules/(?!@ngrx|@cds|@lit|lit-?|ramda|.*\\.mjs$)',
],
// resolver: '@nrwl/jest/plugins/resolver',
resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',
moduleNameMapper: pathsToModuleNameMapper(paths, {
prefix: '<rootDir>/../../',
}),
coverageReporters: ['html-spa', 'json-summary'],
coverageThreshold: {
global: {
branches: 0,
functions: 0,
lines: 0,
statements: 0,
},
},
collectCoverageFrom: [
'**/*.ts',
'!**/node_modules/**',
'!**/coverage/**',
'!**/ts/**',
'!**/*.js',
'!**/*.stories.ts',
'!**/*.module.ts',
],
collectCoverage: true,
cacheDirectory: '/tmp/jest_rs/webaudio-spectrum-analyser',
};