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

Having trouble with new version #36

Open
tandrewnichols opened this issue Aug 7, 2014 · 5 comments
Open

Having trouble with new version #36

tandrewnichols opened this issue Aug 7, 2014 · 5 comments

Comments

@tandrewnichols
Copy link

I've always used 0.3.0 in the past, so maybe there's just some upgrade thing I'm missing, but using 1.0.1, some (at least) of my stubs are not working. I'm using this wrapper:

SandboxedModule = require('sandboxed-module')

global.requireSubject = (path, requires, globals) ->
  console.log requires
  SandboxedModule.require("./../../#{path}",  {requires, globals})

This is in spec/helpers, so the path part isn't the problem (it does try to load the module), but then it throws [Error: Cannot find module 'ftoggleDir/.ftoggle.config'] code: 'MODULE_NOT_FOUND', but the console.log in the code above is logging (amongst other things):

'ftoggleDir/.ftoggle.config': 
   { environments: [ 'production' ],
     configDir: 'config',
     production: { path: 'ftoggle.json' } }

This is a json file, and I see that some of the recent improvements are around json files. I have tried it also with .json on the end. Is there something else I need to do to get 1.0.1 working?

@domenic
Copy link
Collaborator

domenic commented Aug 7, 2014

Can you produce an example project, preferably of minimal size, that I can use to reproduce this? I can't really debug it just from your description.

@darthmarcos
Copy link

I too had tests written using 0.3.0 of sandboxed-module but am unable to get them to run successfully using 1.0.1

Are there any changes to how I am supposed to use this sandboxed-module library in the version 1.0.1 compared with 0.3.0?

@domenic
Copy link
Collaborator

domenic commented Aug 15, 2014

So, it might be that we now recursively sandbox by default. In that, either your tests are explicitly written in a way incompatible with that behavior, or we have bugs in that new feature.

To turn that off, use the singleOnly: true options. (Huh, that's a weird name for an option.) Let me know if it works for you.

In any case, a small example project would again be extremely helpful. We don't want to cause regressions.

@tandrewnichols
Copy link
Author

Sorry, I had actually forgotten about this issue, by virtue of working on something else. I'll see if I can put a gist together sometime soon.

@darthmarcos
Copy link

Apologies for the very late reply. I have just tried the singleOnly: true option as you suggested and yes this is the solution to my problem. Thank you very much for the assistance. Much appreciated.

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

3 participants