Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property 'default' added to stubs when proxying using rewiremock/node #22

Closed
atorma opened this issue Apr 25, 2018 · 3 comments
Closed
Assignees

Comments

@atorma
Copy link

atorma commented Apr 25, 2018

I'm doing something like this in a Node.js Mocha test

const rewiremock = require('rewiremock/node').default
const myService = rewiremock.proxy('path/to/service', {
   'path/to/data': dataStub
});

where dataStub is an data object. myService goes through each key of dataStub. Now, rewiremock adds an extra property default to the stubs. This interferes with what the service is doing.

Is there a way to prevent rewiremock from adding that extra default property to a stub? Should it do this at all in a Node.js environment?

@theKashey theKashey self-assigned this Apr 25, 2018
@theKashey
Copy link
Owner

That's my bad. It is a logic to partially mimic webpack behaviour, and that is needed only for dynamic imports.
There is no way to disable it now, but I will make it possible asap.

@atorma
Copy link
Author

atorma commented Apr 25, 2018

Excellent, thanks!

theKashey added a commit that referenced this issue May 14, 2018
@theKashey
Copy link
Owner

Should be fixed in 3.7.2.
Not actually "fixed" - default will still exists, but will be not enumerated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants