What is jest-watch-typeahead?
The jest-watch-typeahead npm package is a set of watch plugins for Jest that provides typeahead filtering for tests and source files. It allows developers to quickly filter and run specific tests or test suites by typing patterns, filenames, or test names.
What are jest-watch-typeahead's main functionalities?
Filename typeahead
Allows developers to filter the list of files to run tests from by typing a pattern. As the developer types, the list of files is narrowed down, making it easier to find the desired file.
n/a
Test name typeahead
Enables developers to filter tests by their names. As you type the name of a test, only the tests that match the input pattern are shown, allowing for quick selection and execution of individual tests.
n/a
Other packages similar to jest-watch-typeahead
jest-watch-select-projects
This package allows you to select which Jest projects to run using the watch mode. It's similar to jest-watch-typeahead in that it helps you filter and run specific parts of your test suite, but it operates on a project level rather than individual files or tests.
jest-watch-suspend
This package provides the ability to temporarily suspend watch mode in Jest. While it doesn't offer typeahead functionality, it complements the workflow by allowing you to pause test execution without stopping the Jest watch process.
jest-runner-groups
Allows you to define groups of test suites and execute them as a group. This is somewhat similar to jest-watch-typeahead in that it helps you run a subset of your tests, but it does so based on predefined groups rather than dynamic typeahead filtering.

jest-watch-typeahead
Filter your tests by file name or test name

Usage
Install
Install jest
(it needs Jest 27+) and jest-watch-typeahead
yarn add --dev jest jest-watch-typeahead
npm install --save-dev jest jest-watch-typeahead
Add it to your Jest config
In your package.json
{
"jest": {
"watchPlugins": [
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname"
]
}
}
Or in jest.config.js
module.exports = {
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
};
Configuring your key and prompt name
module.exports = {
watchPlugins: [
[
'jest-watch-typeahead/filename',
{
key: 'k',
prompt: 'do something with my custom prompt',
},
],
],
};
Run Jest in watch mode
yarn jest --watch