jest-preset-angular
Version:
Jest preset configuration for Angular projects
30 lines (29 loc) • 1.24 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.NgJestConfig = void 0;
const jest_util_1 = require("jest-util");
const ts_jest_1 = require("ts-jest");
const defaultProcessWithEsbuildPatterns = ['**/*.mjs'];
class NgJestConfig extends ts_jest_1.ConfigSet {
processWithEsbuild;
constructor(jestConfig, parentLogger) {
super(jestConfig, parentLogger);
const jestGlobalsConfig = jestConfig?.globals?.ngJest ?? Object.create(null);
this.processWithEsbuild = (0, jest_util_1.globsToMatcher)([
...(jestGlobalsConfig.processWithEsbuild ?? []),
...defaultProcessWithEsbuildPatterns,
]);
}
_resolveTsConfig(compilerOptions, resolvedConfigFile) {
const result = super._resolveTsConfig(compilerOptions, resolvedConfigFile);
result.options.enableIvy = true;
result.options.noEmitOnError = false;
result.options.suppressOutputPathCheck = true;
result.options.allowEmptyCodegenFiles = false;
result.options.annotationsAs = 'decorators';
result.options.enableResourceInlining = false;
result.options.allowJs = true;
return result;
}
}
exports.NgJestConfig = NgJestConfig;
;