a problem with javascript build and test environments...

One problem with having such a diverse set of build and test environments is that the environments do not always play well together. Here's a simple example:

  • webpack: Using DefinePlugin to define some DEBUG and API constants, set in the build environment based on prod or non-prod builds.
  • jest: Since DefinePlugin "inserts" constants into the modules, these constants are only defined if you use webpack. This either forces you to use webpack for test builds which I'm not even sure how that would work, or you need to mock the webpack features in some way.
That's one complaint.

The bottom line is that using features in build/test tools that do not strictly "emit" file-based javascript to be consumed consistently across toolsets will cause issues like the above to occur.

Of course, the test tools do try to some different environments but there is a limit to what they can reasonably do without becoming overly dependent on other environments. 


Popular posts from this blog

zio layers and framework integration

typescript and react types

dotty+scala.js+async: interesting options