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

process.cwd() has unexpected behaviour #259

Closed
rochdev opened this issue Sep 11, 2015 · 2 comments
Closed

process.cwd() has unexpected behaviour #259

rochdev opened this issue Sep 11, 2015 · 2 comments
Labels

Comments

@rochdev
Copy link

rochdev commented Sep 11, 2015

I am using process.cwd() in one of my project files and its corresponding test, and I am getting weird results. In some places the path seems to be correct and in some other cases it shows /Users/rochdevost/github/rochdev/.atom/packages/atom-wallaby/projects/56433095f20fa692/instrumented/tinto.conf.js.

The affected files:
https://github.com/rochdev/tinto/blob/master/lib/utils/config.js
https://github.com/rochdev/tinto/blob/master/test/utils/config.spec.js (at "should load by name")

How can I make process.cwd() always point to the correct location?

@ArtemGovorov
Copy link
Member

Thanks for providing the way to easily reproduce the issue!

When wallaby runs your node tests, process.cwd() should always be set to be the instrumented root of your project, so the /Users/rochdevost/github/rochdev/.atom/packages/atom-wallaby/projects/56433095f20fa692/instrumented value is correct in this context.

The issue was with the way wallaby replaces modules paths to look into local node modules instead of trying to search them in the instrumented root (it does it to avoid copying node modules to the instrumented folder). I have fixed it in core v1.0.103. Please let me know if your tests are passing now.

@rochdev
Copy link
Author

rochdev commented Sep 12, 2015

@ArtemGovorov Works like a charm thank you!

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

No branches or pull requests

2 participants