Skip to content

paullewisn/jest-projects-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🍎🍌 jest-projects-demo 🥦🥕

Simple demonstration on how to setup the Jest projects feature to work with a monorepo.

apple/banana could represent applications, and broccoli/carrot could represent libraries.

root
 |-- src
 |    |-- apple
 |    |    | -- package.json
 |    |    | -- jest.config.js
 |    |
 |    |-- banana
 |         | -- package.json
 |         | -- jest.config.js
 |
 |-- lib
 |    |-- broccoli
 |    |    | -- package.json
 |    |    | -- jest.config.js
 |    |
 |    |-- carrot
 |         | -- package.json
 |         | -- jest.config.js
 |
 | -- package.json
 | -- jest.config.js

Tests are run using the following at the root level:

$ npm run test
$ npm run test:apple
$ npm run test:banana
$ npm run test:broccoli
$ npm run test:carrot
$ npm run test:src
$ npm run test:lib

Which use these commands:

"test": "jest --projects **/src/** **/lib/**",
"test:apple": "jest --projects **/src/apple",
"test:banana": "jest --projects **/src/banana",
"test:broccoli": "jest --projects **/lib/broccoli",
"test:carrot": "jest --projects **/lib/carrot",
"test:lib": "jest --projects **/lib/**"
"test:src": "jest --projects **/src/**",

Alternatively tests can be run at the individual application/library level:

/src/apple/$ npm run test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published