This is an example of how to use the babel-jest
transformer in a monorepo where each package uses its own .babelrc.js
configuration-file.
This is especially useful when the projects in your workspace do not share the same babel-preset or plugins but you still want to use the multi runner to run all test in your monorepo.
The structure of this repository is as follows:
fixtures/
├── angular-js/ # Workspace 1
│ ├── .babelrc.js
│ ├── jest.config.js
│ └── package.json
└── react/ # Workspace 2
├── .babelrc.js
├── jest.config.js
└── package.json
jest.config.js # Workspace root
package.json
The tests can be run from the workspace root, which uses the jest projects config or individually from each package which uses the local jest config from each project.
# Install dependencies
yarn
# Run all tests from workspace root
yarn test
# Run tests in a workspace
cd fixtures/react
yarn test
Felix Haus Website • Twitter |
---|
MIT - see LICENSE for details.