Created
March 16, 2016 11:44
-
-
Save lazywithclass/93898774a3644be63c32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
patched compile has crashed | |
internalModule is not defined | |
ReferenceError: internalModule is not defined | |
at Module.eval (eval at <anonymous> (/Users/lazywithclass/workspace/mutagen/node_modules/really-need/index.js:230:25), <anonymous>:30:19) | |
at Module._compile (/Users/lazywithclass/workspace/mutagen/node_modules/really-need/index.js:251:29) | |
at load (/Users/lazywithclass/workspace/mutagen/node_modules/really-need/index.js:73:12) | |
at Module.load (module.js:343:32) | |
at Function.Module._load (module.js:300:12) | |
at loadRealModule (/Users/lazywithclass/workspace/mutagen/node_modules/really-need/index.js:133:23) | |
at Module.reallyNeedRequire [as require] (/Users/lazywithclass/workspace/mutagen/node_modules/really-need/index.js:181:16) | |
at Object.<anonymous> (/Users/lazywithclass/workspace/mutagen/test/mutation-true-false/mutator.js:24:11) | |
at Module._compile (module.js:409:26) | |
at Object.Module._extensions..js (module.js:416:10) | |
the patched compile source | |
function (content, filename) { | |
// remove shebang | |
content = content.replace(shebangRe, ''); | |
// create wrapper function | |
var wrapper = Module.wrap(content); | |
var compiledWrapper = runInThisContext(wrapper, | |
{ filename: filename, lineOffset: 0 }); | |
if (global.v8debug) { | |
if (!resolvedArgv) { | |
// we enter the repl if we're not given a filename argument. | |
if (process.argv[1]) { | |
resolvedArgv = Module._resolveFilename(process.argv[1], null); | |
} else { | |
resolvedArgv = 'repl'; | |
} | |
} | |
// Set breakpoint on module start | |
if (filename === resolvedArgv) { | |
// Installing this dummy debug event listener tells V8 to start | |
// the debugger. Without it, the setBreakPoint() fails with an | |
// 'illegal access' error. | |
global.v8debug.Debug.setListener(function() {}); | |
global.v8debug.Debug.setBreakPoint(compiledWrapper, 0, 0); | |
} | |
} | |
const dirname = path.dirname(filename); | |
const require = internalModule.makeRequireFunction.call(this); | |
Object.defineProperty(require, 'paths', { get: function() { | |
throw new Error('require.paths is removed. Use ' + | |
'node_modules folders, or the NODE_PATH ' + | |
'environment variable instead.'); | |
}}); | |
require.registerExtension = function() { | |
throw new Error('require.registerExtension() removed. Use ' + | |
'require.extensions instead.'); | |
}; | |
const args = [this.exports, require, this, filename, dirname]; | |
return compiledWrapper.apply(this.exports, args); | |
} | |
died while processing content in /Users/lazywithclass/workspace/mutagen/test/mutation-true-false/test.js | |
describe('fn', function() { | |
var lib = require('./source'), | |
expect = require('chai').expect; | |
it('returns true', function() { | |
expect(lib.fn()).to.be.true; | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment