Install jest
(it needs Jest 23+) and jest-watch-select-projects
yarn add --dev jest jest-watch-select-projects
# or with NPM
npm install --save-dev jest jest-watch-select-projects
In your package.json
{
"jest": {
"watchPlugins": ["jest-watch-select-projects"]
}
}
Or in jest.config.js
module.exports = {
watchPlugins: ['jest-watch-select-projects'],
};
module.exports = {
watchPlugins: [
[
'jest-watch-select-projects',
{
key: 'X',
// function or string
prompt() {
const activeProjectsText = this._getActiveProjectsText();
return 'do something with my custom prompt';
},
},
],
],
};
yarn jest --watch
Why is this running all of my projects?
Make certain that you're using the SPACE key to toggle the selected state of projects and the ENTER key to confirm your settings.