You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been comparing using rewire and mocks to see which best suits my needs.
Using node 5.6.0, I've noticed two things when using loadFile on a module:
private const's aren't available unless I change them to var's
private functions that throw errors don't seem to throw the same type of error as they do when they natively throw the error
I think 1. is caused because vm.runInNewContext does not seem to make the const's available on the context.
I'm not sure what causes 2.---although I suspect it's related to the 'displayErrors' option for runInNewContext---but the symptom is that:
// in module being loadFile'dmyFunc(){thrownewError('foo')}// in testshould.Throw(myFunc(),Error,'foo')
will not assert.
I'm not sure if there's anything that can easily be done about either of these, but I thought I'd bring them to your attention and I'm curious to hear your answers :)
The text was updated successfully, but these errors were encountered:
I've been comparing using rewire and mocks to see which best suits my needs.
Using node 5.6.0, I've noticed two things when using loadFile on a module:
I think 1. is caused because vm.runInNewContext does not seem to make the const's available on the context.
I'm not sure what causes 2.---although I suspect it's related to the 'displayErrors' option for runInNewContext---but the symptom is that:
will not assert.
I'm not sure if there's anything that can easily be done about either of these, but I thought I'd bring them to your attention and I'm curious to hear your answers :)
The text was updated successfully, but these errors were encountered: