Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function process(
src: string,
filePath: Path,
jestConfig: JestConfig,
transformOptions: TransformOptions = { instrument: false },
) {
src =
`require('typewiz-node').register();` +
instrument(src, filePath, {
instrumentCallExpressions: true,
instrumentImplicitThis: true,
tsConfig: 'tsconfig.json', // TODO read it from jest config?
});
return originalProcess(src, filePath, jestConfig, transformOptions);
}
process(
src: string,
filePath: jest.Path,
jestConfig: jest.ProjectConfig,
transformOptions: jest.TransformOptions
) {
const extendedConfig = extendJestConfig(jestConfig, filePath);
return TsJest.process(src, filePath, extendedConfig, transformOptions);
},
function process(...args) {
return 'module.exports = ' + JSON.stringify(processTs(...args));
}
module.exports.process = (src, path, config, transformOptions) => {
if (path.endsWith('.html')) {
src = src.replace(ESCAPE_TEMPLATE_REGEX, '\\$1');
}
src = src
.replace(TEMPLATE_URL_REGEX, 'template: require($1./$3$4)')
.replace(STYLE_URLS_REGEX, 'styles: []');
return process(src, path, config, transformOptions);
};