jasmine-promises icon indicating copy to clipboard operation
jasmine-promises copied to clipboard

Doesn't work correctly under Node.js

Open notheotherben opened this issue 9 years ago • 3 comments

Unfortunately it looks like this library doesn't function when run under Node.js.

I suspect this has something to do with the way in which you're attempting to patch the global object - specifically the global.jasmineRequire object.

Workaround

Currently I'm working around the issue by "mocking" the jasmineRequire.interface function with a no-op. This seems to address the problem, however it would be good to include a check in the library itself instead.

global.jasmineRequire = {
    interface: function() {}
};

require('jasmine-promises');

Error Message

TypeError: Cannot read property 'interface' of undefined
    at patchInterfaceFn (D:\...\node_modules\jasmine-promises\dist\jasmine-promises.js:68:21)
    at apply (D:\...\node_modules\jasmine-promises\dist\jasmine-promises.js:80:3)
    at Object.<anonymous> (D:\...\node_modules\jasmine-promises\dist\jasmine-promises.js:12:18)
    at Object.__dirname.1../patch (D:\...\node_modules\jasmine-promises\dist\jasmine-promises.js:14:4)
    at s ((D:\...\node_modules\jasmine-promises\dist\jasmine-promises.js:1:316)
    at e ((D:\...\node_modules\jasmine-promises\dist\jasmine-promises.js:1:487)
    at Object.<anonymous> (D:\...\node_modules\jasmine-promises\dist\jasmine-promises.js:1:505)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)

notheotherben avatar Feb 22 '16 14:02 notheotherben

Great work matthewjh! But for now I stumble over the same error as SPARTAN563 above.

fabian-dev avatar Apr 07 '16 07:04 fabian-dev

6e598751c5825515601a5850815f8c81ecddab06 is fixing this issue. It would be great if you could do a new release!

BenoitZugmeyer avatar Feb 26 '17 19:02 BenoitZugmeyer

If anyone's interested, I branched from the master of this repo, merged https://github.com/matthewjh/jasmine-promises/pull/15 h/t @BenoitZugmeyer, and rebuilt dist/jasmine-promises.js to make this work in Node. To get it, do

npm install jasmine-promises@mixmaxhq/jasmine-promises#working_in_node

wearhere avatar Mar 21 '17 03:03 wearhere