1 | [![Build Status](https://github.com/jest-community/jest-watch-typeahead/actions/workflows/nodejs.yml/badge.svg?branch=main)](https://github.com/jest-community/jest-watch-typeahead/actions/workflows/nodejs.yml) [![npm version](https://badge.fury.io/js/jest-watch-typeahead.svg)](https://badge.fury.io/js/jest-watch-typeahead)
|
2 |
|
3 | <div align="center">
|
4 | <a href="https://jestjs.io/">
|
5 | <img width="150" height="150" vspace="" hspace="25" src="https://jestjs.io/img/jest.png">
|
6 | </a>
|
7 | <h1>jest-watch-typeahead</h1>
|
8 | <p>Filter your tests by file name or test name</p>
|
9 | </div>
|
10 |
|
11 | ![watch](https://user-images.githubusercontent.com/574806/40672937-25dab91a-6325-11e8-965d-4e55ef23e135.gif)
|
12 |
|
13 | ## Usage
|
14 |
|
15 | ### Install
|
16 |
|
17 | Install `jest`_(it needs Jest 26+)_ and `jest-watch-typeahead`
|
18 |
|
19 | ```bash
|
20 | yarn add --dev jest jest-watch-typeahead
|
21 |
|
22 | # or with NPM
|
23 |
|
24 | npm install --save-dev jest jest-watch-typeahead
|
25 | ```
|
26 |
|
27 | ### Add it to your Jest config
|
28 |
|
29 | In your `package.json`
|
30 |
|
31 | ```json
|
32 | {
|
33 | "jest": {
|
34 | "watchPlugins": [
|
35 | "jest-watch-typeahead/filename",
|
36 | "jest-watch-typeahead/testname"
|
37 | ]
|
38 | }
|
39 | }
|
40 | ```
|
41 |
|
42 | Or in `jest.config.js`
|
43 |
|
44 | ```js
|
45 | module.exports = {
|
46 | watchPlugins: [
|
47 | 'jest-watch-typeahead/filename',
|
48 | 'jest-watch-typeahead/testname',
|
49 | ],
|
50 | };
|
51 | ```
|
52 |
|
53 | ### Configuring your key and prompt name
|
54 |
|
55 | ```js
|
56 | module.exports = {
|
57 | watchPlugins: [
|
58 | [
|
59 | 'jest-watch-typeahead/filename',
|
60 | {
|
61 | key: 'k',
|
62 | prompt: 'do something with my custom prompt',
|
63 | },
|
64 | ],
|
65 | ],
|
66 | };
|
67 | ```
|
68 |
|
69 | ### Run Jest in watch mode
|
70 |
|
71 | ```bash
|
72 | yarn jest --watch
|
73 | ```
|