Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
inner =>
function() {
if (isIntroscopedModule(arguments[1])) {
// content
arguments[0] =
arguments[0] + '\n\n// @introscope "enable": true';
}
// filename
arguments[1] = removeQuery(arguments[1]);
return inner.apply(this, arguments);
},
);
wrap(
Runtime.prototype,
'requireModule',
inner =>
function(from, moduleName) {
if (isIntroscopedModule(moduleName)) {
let modulePath = this._resolveModule(from, moduleName);
const realPath = removeQuery(modulePath);
// makes module resolver find the proper transformer
const ext = extname(realPath);
moduleName += ext;
modulePath += ext;
arguments[1] = moduleName;
this._cacheFS[modulePath] = fs.readFileSync(realPath, 'utf8');
}
return inner.apply(this, arguments);
#!/usr/bin/env node
/* eslint-disable */
const jestRuntime = require('jest-runtime');
const oldexecModule = jestRuntime.prototype._execModule;
jestRuntime.prototype._execModule = function _execModule(localModule, options) {
// Do not apply esm to dependencies & test files to have access to jest globals
if (
localModule.id.includes('node_modules') ||
localModule.id.includes('__tests__')
) {
return oldexecModule.apply(this, [localModule, options]);
}
localModule.exports = require('esm')(localModule)(localModule.id);
return localModule;
};
cli = require('jest/bin/jest');
#!/usr/bin/env node
/* eslint-disable */
const jestRuntime = require('jest-runtime');
const oldexecModule = jestRuntime.prototype._execModule;
jestRuntime.prototype._execModule = function _execModule(localModule, options) {
// Do not apply esm to dependencies & test files to have access to jest globals
if (
localModule.id.includes('node_modules') ||
localModule.id.includes('__tests__')
) {
return oldexecModule.apply(this, [localModule, options]);
}
localModule.exports = require('esm')(localModule)(localModule.id);
return localModule;
};
cli = require('jest/bin/jest');