Search code examples
jestjslerna

Run specific jest project


I'm setting up a lerna monorepo with jest, I'm using jest's projects like so: projects: ['<rootDir>/packages/*'].

Running tests work as expected, however, I'm not sure how can I run a specific project? Say I have:

/packages
  jest.config.js
  /core
      jest.config.js
  /blog
      jest.config.js

Currently jest runs tests in both packages using their specific configs, however, I'm not sure how can I tell jest to just run tests in one of those packages?


Solution

  • You can call jest with the name of a test that you want to run. You can also use just parts of the path to the test, or even a regular expression. So in your case, you could run tests in the core package like this:

    jest packages/core