Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

strange sandbox behavior with mongoose #9

ericchaves opened this Issue · 2 comments

3 participants

Eric Paschoalick Chaves Domenic Denicola moizr
Eric Paschoalick Chaves

Hi Felix,

I'm facing a very odd behavior that I can't track down due to my beginner level on node.js. I use mocha to test my code and your's sandboxed-module ( for dependency injection in some required modules for the code I'm testing.

Whenever I load a module that uses mongoose inside a sandbox all mongoose calls like or model.find times-out unless I load the module twice. For example, in a piece of code like this (chopped for clarity):

    var User = sandbox.require('../../models/users', {
        requires: { // define some mocks... }

    User = require('../../models/users');   

    var user = new User(user_data);, doc){
            //do something on callback

Without the User = require('../../models/users') the call goes away and never callbacks. Including it makes everything works and the model class stils have the mocks injected just as if it was loaded by the sandbox.require call.

Have you heard about this before? Am I doing something wrong here?

Thanks for any help.

Domenic Denicola

If this is still a problem, let me know, and we'll be sure to look into it!

Domenic Denicola domenic closed this

I'm facing a similar problem. When I use sandboxed module to require a module - mongoose seems to timeout. @ericchaves if you found a solution to the problem please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.