No support for test build, breaks process.env.NODE_ENV === 'test'
#167
Labels
kind: feature
New feature or request
process.env.NODE_ENV === 'test'
#167
Current Behavior
tsdx
does not create atest
build and will end up loading thedevelopment
build whenprocess.env.NODE_ENV === 'test'
. But thedevelopment
build has replacedprocess.env.NODE_ENV
with'development'
.This causes some issues if one puts a
process.env.NODE_ENV === 'test'
in their source code as it will always be false. This is what I experienced in agilgur5/mst-persist#9 (comment)The ESM build actually leaves
process.env.NODE_ENV
as is, so it causes differing behavior for ESM vs. CJS.Most tests are run in Node and require CJS support as a result (unless one is transpiling
node_modules
or using theesm
package as a loader), so this means most behavior behind atest
check just won't work for folks who build their libraries withtsdx
.Expected behavior
If someone added a
process.env.NODE_ENV === 'test'
in their source code it should work as expected in atest
environment.Suggested solution(s)
process.env.NODE_ENV
with'development'
in thedevelopment
build, ORtest
buildAdditional context
None, have linked the repo in which I experienced the problem above.
Your environment
^Also y'all might want to check out how
nyc
usesnpx envinfo@latest --preset nyc
in order to get the above table easily from all users reporting issues.The text was updated successfully, but these errors were encountered: