This project is archived. Its data is read-only.

Change: "Jest uses custom config" to "Jest uses webpack"

Change pattern proposal: "Jest uses custom config" to "Jest uses webpack"

Old Pattern

Currently our Jest config does not use webpack for transpiling. This causes a bit of duplication in configuration between webpack configuration and jest configuraiton. Where there is duplication, there is risk of deviation. It's a little scary to think that our unit test transpiler could be different than our production transpiler.

New Pattern

What if we used webpack in Jest? Is there a way we can target webpack's build for a NodeJS testing environment?

Advantages of switching patterns

  1. Increase maintainability by removing duplication between webpack config and jest config.
  2. Increase reliability of unit test environment. It would eliminate any false positives we get because of potential differences in our test / production environment.

Disadvantages of switching patterns

  1. (Under investigation) Possible reduction in speed of unit tests. Webpack builds and bundles much more than jest does. For instance, jest converts ES6 imports into CommonJS (since it runs in Node), while Webpack creates bundles (meant to run in the browser).
  2. (Under investigation) Possible difficulty to debug tests since Webpack bundles its assets.

What is the impact on our existing codebase?

Shouldn't affect our tests. Just the configuration files.

Edited Jul 16, 2019 by Simon Knox
Assignee Loading
Time tracking Loading