jest-preset-angular
Version:
Jest preset configuration for Angular projects
33 lines (32 loc) • 1.64 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NgJestConfig = exports.defaultProcessWithEsbuildPatterns = void 0;
const jest_util_1 = require("jest-util");
const ts_jest_1 = require("ts-jest");
exports.defaultProcessWithEsbuildPatterns = ['**/*.mjs'];
class NgJestConfig extends ts_jest_1.ConfigSet {
processWithEsbuild;
constructor(jestConfig, parentLogger) {
super(jestConfig, parentLogger);
const jestGlobalsConfig = jestConfig?.globals?.ngJest ?? Object.create(null);
if (jestGlobalsConfig.processWithEsbuild) {
this.logger.warn('Specifying `processWithEsbuild` in `ngJest` config is deprecated and will be removed in the next major version. Please follow this documentation https://thymikee.github.io/jest-preset-angular/docs/getting-started/options#processing-with-esbuild instead.');
}
this.processWithEsbuild = (0, jest_util_1.globsToMatcher)([
...(jestGlobalsConfig.processWithEsbuild ?? []),
...exports.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;