You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 thesrc/
folder.When the tests are running, the environment variable
NODE_ENV
is set totest
. Which will cause the method insrc/util.ts#isProd
to always always returntrue
when running the tests, and therefore use thelib/
instead of thesrc/
folder.Since I am not sure this condition was purposefully designed like this, I manually set
NODE_ENV
todevelopment
just before running the tests.Should the method
isProd()
also check if theNODE_ENV
is not equal totest
?Thanks,
FYI, we are using Jest instead of mocha.
The text was updated successfully, but these errors were encountered: