-
Notifications
You must be signed in to change notification settings - Fork 552
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
tests fails if I there is global configuration #211
Comments
This seems like a bug with our tests not being sandboxed properly. They are leaking. This is one of the tricky things with our current test suite. Since the loader being run during the tests actually hits disk and walks the directory tree we need a way of sandboxing the upmost directory during tests only. This is to say, we need some way of saying to the loader: hey you're testing so you should never search higher than ~/path/to/cz-cli/tests Currently the loader sees your global config even during tests. We should have some way of ignoring it. This currently does not exist and thus this is somewhere between a feature and a bugfix. I think at one point we had something like this but it was removed to simplify the loader. Since a global config was not a use case at the time, we went for simplicity over added features. I am totally fine with this coming back in so tests can be run properly. Good catch. |
I guess, if we set
(Haven't tried it, just wild guess) |
"report-coverage": "nyc report --reporter=lcov | codecov",
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
"start": "npm run test:watch",
- "test": "nyc --require babel-core/register _mocha -- test/tests/index.js",
+ "test": "USERPROFILE=test HOMEPATH=test HOME=test nyc --require babel-core/register _mocha -- test/tests/index.js",
"test:watch": "nodemon -q --ignore test/.tmp/ --ignore test/artifacts/ --ignore coverage/ --exec \"npm run test\" --",
"test:windows": "node ./test/tools/trigger-appveyor-tests.js" It works, but, fs.js:634
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT: no such file or directory, open 'test/.babel.json'
at Error (native)
at Object.fs.openSync (fs.js:634:18)
at Object.fs.writeFileSync (fs.js:1327:33)
at process.save (/Users/sabandyo/GitHub/cz-cli/node_modules/babel-core/node_modules/babel-register/lib/cache.js:48:19)
at emitOne (events.js:96:13)
at process.emit (events.js:188:7)
at processEmit [as emit] (/Users/sabandyo/GitHub/cz-cli/node_modules/nyc/node_modules/signal-exit/index.js:140:35)
at process.exit (internal/process.js:79:15)
at done (/Users/sabandyo/GitHub/cz-cli/node_modules/mocha/bin/_mocha:416:32)
at afterWrite (_stream_writable.js:360:3)
at _combinedTickCallback (internal/process/next_tick.js:80:20)
at process._tickCallback (internal/process/next_tick.js:98:9) I guess code change is required. |
If I remove or rename
~/.czrc
, all the tests passes.The text was updated successfully, but these errors were encountered: