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

Tests run against lib, not src #367

Closed
y-lakhdar opened this issue Feb 9, 2022 · 0 comments · Fixed by #368
Closed

Tests run against lib, not src #367

y-lakhdar opened this issue Feb 9, 2022 · 0 comments · Fixed by #368

Comments

@y-lakhdar
Copy link
Contributor

y-lakhdar commented Feb 9, 2022

Hi,

After we bumped our CLI to @oclif/core, the tests are no longer running against the src/ folder. Instead, they are using the transpiled JavaScript from the lib folder.

This is absolutely fine for testing basic commands. However, mocking modules no longer works if the tested commands are coming from the lib/ and not the src/ folder.

When the tests are running, the environment variable NODE_ENV is set to test. Which will cause the method in src/util.ts#isProd to always always return true when running the tests, and therefore use the lib/ instead of the src/ folder.

Since I am not sure this condition was purposefully designed like this, I manually set NODE_ENV to development just before running the tests.

Should the method isProd() also check if the NODE_ENV is not equal to test?

Thanks,

FYI, we are using Jest instead of mocha.

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

Successfully merging a pull request may close this issue.

1 participant