Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jest-preset-angular

Package Overview
Dependencies
Maintainers
3
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-preset-angular - npm Package Compare versions

Comparing version 14.4.1 to 14.4.2

2

build/compiler/ng-jest-compiler.d.ts

@@ -6,4 +6,2 @@ import { type TsJestAstTransformer, TsCompiler, type ConfigSet } from 'ts-jest';

readonly jestCacheFS: Map<string, string>;
private readonly _defaultLibDirPath;
private readonly _libSourceFileCache;
constructor(configSet: ConfigSet, jestCacheFS: Map<string, string>);

@@ -10,0 +8,0 @@ protected _transpileOutput(fileContent: string, filePath: string): ts.TranspileOutput;

69

build/compiler/ng-jest-compiler.js

@@ -17,28 +17,38 @@ "use strict";

this.jestCacheFS = jestCacheFS;
this._libSourceFileCache = new Map();
this._logger.debug('created NgJestCompiler');
this._defaultLibDirPath = node_path_1.default.dirname(this._ts.getDefaultLibFilePath(this._compilerOptions));
}
_transpileOutput(fileContent, filePath) {
var _a;
const scriptTarget = (_a = this._compilerOptions.target) !== null && _a !== void 0 ? _a : this._ts.ScriptTarget.Latest;
const sourceFile = this._ts.createSourceFile(filePath, fileContent, scriptTarget);
const diagnostics = [];
const compilerOptions = Object.assign({}, this._compilerOptions);
const options = compilerOptions
?
this._ts.fixupCompilerOptions(compilerOptions, diagnostics)
: {};
const defaultOptions = this._ts.getDefaultCompilerOptions();
for (const key in defaultOptions) {
if (Object.prototype.hasOwnProperty.call(defaultOptions, key) && options[key] === undefined) {
options[key] = defaultOptions[key];
}
}
for (const option of this._ts.transpileOptionValueCompilerOptions) {
options[option.name] = option.transpileOptionValue;
}
options.suppressOutputPathCheck = true;
options.allowNonTsExtensions = true;
const sourceFile = this._ts.createSourceFile(filePath, fileContent, (_a = options.target) !== null && _a !== void 0 ? _a : this._ts.ScriptTarget.Latest);
let outputText;
let sourceMapText;
const compilerHost = {
getSourceFile: (fileName) => {
var _a;
if (fileName === node_path_1.default.normalize(filePath)) {
return sourceFile;
return node_path_1.default.normalize(fileName) === node_path_1.default.normalize(filePath) ? sourceFile : undefined;
},
writeFile: (name, text) => {
if (node_path_1.default.extname(name) === '.map') {
sourceMapText = text;
}
let libSourceFile = this._libSourceFileCache.get(fileName);
if (!libSourceFile) {
const libFilePath = node_path_1.default.join(this._defaultLibDirPath, fileName);
const libFileContent = (_a = this._ts.sys.readFile(libFilePath)) !== null && _a !== void 0 ? _a : '';
if (libFileContent) {
libSourceFile = this._ts.createSourceFile(fileName, libFileContent, scriptTarget);
this._libSourceFileCache.set(fileName, libSourceFile);
}
else {
outputText = text;
}
return libSourceFile;
},
writeFile: () => { },
getDefaultLibFileName: () => 'lib.d.ts',

@@ -49,3 +59,5 @@ useCaseSensitiveFileNames: () => false,

getNewLine: () => node_os_1.default.EOL,
fileExists: (fileName) => fileName === filePath,
fileExists: (fileName) => {
return node_path_1.default.normalize(fileName) === node_path_1.default.normalize(filePath);
},
readFile: () => '',

@@ -55,17 +67,12 @@ directoryExists: () => true,

};
this.program = this._ts.createProgram([filePath], this._compilerOptions, compilerHost);
return this._ts.transpileModule(fileContent, {
fileName: filePath,
transformers: this._makeTransformers(this.configSet.resolvedTransformers),
compilerOptions: this._compilerOptions,
reportDiagnostics: this.configSet.shouldReportDiagnostics(filePath),
});
this.program = this._ts.createProgram([filePath], options, compilerHost);
this.program.emit(undefined, undefined, undefined, undefined, this._makeTransformers(this.configSet.resolvedTransformers));
return { outputText: outputText !== null && outputText !== void 0 ? outputText : '', diagnostics, sourceMapText };
}
_makeTransformers(customTransformers) {
var _a;
const allTransformers = super._makeTransformers(customTransformers);
return Object.assign(Object.assign(Object.assign({}, allTransformers.after), allTransformers.afterDeclarations), { before: [
...((_a = allTransformers.before) !== null && _a !== void 0 ? _a : []),
(0, replace_resources_1.replaceResources)(this.program),
(0, jit_transform_1.angularJitApplicationTransform)(this.program),
const program = this.program;
return Object.assign(Object.assign(Object.assign({}, super._makeTransformers(customTransformers).after), super._makeTransformers(customTransformers).afterDeclarations), { before: [
...customTransformers.before.map((beforeTransformer) => beforeTransformer.factory(this, beforeTransformer.options)),
(0, replace_resources_1.replaceResources)(program),
(0, jit_transform_1.angularJitApplicationTransform)(program),
] });

@@ -72,0 +79,0 @@ }

{
"name": "jest-preset-angular",
"version": "14.4.1",
"version": "14.4.2",
"description": "Jest preset configuration for Angular projects",

@@ -41,2 +41,3 @@ "license": "MIT",

"test-examples": "yarn build && node scripts/test-examples.js",
"test-perf": "jest -c=performance/jest.config.ts --no-cache",
"doc": "cd website && yarn start",

@@ -69,5 +70,5 @@ "doc:build": "cd website && yarn build",

"@angular-devkit/build-angular": "^19.0.2",
"@angular-eslint/eslint-plugin": "^18.4.2",
"@angular-eslint/eslint-plugin-template": "^18.4.2",
"@angular-eslint/template-parser": "^18.4.2",
"@angular-eslint/eslint-plugin": "^18.4.3",
"@angular-eslint/eslint-plugin-template": "^18.4.3",
"@angular-eslint/template-parser": "^18.4.3",
"@angular/animations": "^19.0.1",

@@ -92,4 +93,4 @@ "@angular/cdk": "^19.0.1",

"@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"@typescript-eslint/eslint-plugin": "^8.17.0",
"@typescript-eslint/parser": "^8.17.0",
"babel-jest": "^29.7.0",

@@ -96,0 +97,0 @@ "chalk": "^4.1.2",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc