bahmutov / bahmutov/really-need

Problem in basic usage

Open
#33 13 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
107
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Hello, thanks a lot for this library.

I am evaluating it to see if I could use for a mutation testing library I am writing, I've setup a basic scenario to see how it works:

``` javascript
// source.js
var lib = {};

lib.fn = function() {
return true;
};

module.exports = lib;

// test.js
describe('fn', function() {

var lib = require('./source'),
expect = require('chai').expect;

it('returns true', function() {
expect(lib.fn()).to.be.true;
});

});

// runner.js
require = require('really-need');
var foo = require('./test', {
pre: function (source, filename) {
return source;
}
});
```

When I run it it gives me an error, it's quite long, I'll paste what I think it's relevant (here the whole thing https://gist.github.com/lazywithclass/93898774a3644be63c32)

```
patched compile has crashed
internalModule is not defined
ReferenceError: internalModule is not defined
at Module.eval (eval at (/Users/lazywithclass/workspace/mutagen/node_modules/really-need/index.js:230:25), :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. (/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)
```

I am running node 4.3.1and really-need 1.9.2.

Any hint / help would be greatly appreciated.

UPDATE: Using node 4.2.2 and `fake` seems to solve the issue... but still I am looking at your code to understand how can I use it with newer versions.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the basic scenario from source.js, test.js, and runner.js with Node 4.3.1 and really-need 1.9.2, then compare it with the reported Node 4.2.2 and fake workaround. Inspect really-need/index.js around the patched compile path at lines 230-251 and the full linked stack trace. Done means the scenario no longer raises the reported internalModule error or the compatibility limitation is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.