-
Notifications
You must be signed in to change notification settings - Fork 42
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
add parent to module constructor #24
Conversation
Test please? |
Damn you silly git add -u. |
test attached. |
|
||
var exports = SandboxedModule.load('../fixture/parent'); | ||
console.log("exports", exports) | ||
assert.ok(exports.module.parent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should exports.module.parent
be? Are there any properties of it you can test?
currently module.parent is node-sandboxed-module. But it might should be the parent module of node-sandboxed-module? |
Shouldn't it be the module that requires the module under test? |
it is now. |
I don't think I'm quite communicating clearly. Let's say you have module A which requires module B. Then you sandboxed-module require module A. Inside module B, From what I can tell of your patch, it makes |
i see your point, but what is the use case. sandbox-module won't load the tree, just loads the module which you required via It would be a use case, if sandboxed-module would require fake modules, but it doesn't. As you can see fake module's are required by test.js. |
Ah, you are of course right! Thank you for having the patience to walk me through it. Merging momentarily, and will push a new release. |
Merged as c3df0b5 with a slightly updated test; thanks! |
cool, thx. |
Pass parent module to module constructor.
Here a use case:
https://github.com/oroce/pin-clone/blob/master/app.js#L100-L103
https://github.com/oroce/pin-clone/blob/master/test/server/api.js#L24