jest-watch-typeahead 0.4.1 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/README.md +3 -4
- package/build/file_name_plugin/plugin.js +2 -6
- package/build/file_name_plugin/prompt.js +8 -0
- package/build/lib/utils.js +1 -1
- package/build/test_name_plugin/plugin.js +2 -6
- package/build/test_name_plugin/prompt.js +13 -0
- package/package.json +31 -26
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,37 @@
|
|
1
|
+
## 0.6.1
|
2
|
+
|
3
|
+
### Fixes
|
4
|
+
|
5
|
+
- Provide exact pattern for selected test names
|
6
|
+
|
7
|
+
## 0.6.0
|
8
|
+
|
9
|
+
### Chore & Maintenance
|
10
|
+
|
11
|
+
- Update dependencies and drop Node 8 ([#35](https://github.com/jest-community/jest-watch-typeahead/pull/35))
|
12
|
+
|
13
|
+
## 0.5.0
|
14
|
+
|
15
|
+
### Chore & Maintenance
|
16
|
+
|
17
|
+
- Update dependencies
|
18
|
+
|
19
|
+
## 0.4.2
|
20
|
+
|
21
|
+
### Fixes
|
22
|
+
|
23
|
+
- Fix issue with overly trimmed basenames when formatting test paths ([#33](https://github.com/jest-community/jest-watch-typeahead/pull/33))
|
24
|
+
|
25
|
+
## 0.4.1
|
26
|
+
|
27
|
+
### Fixes
|
28
|
+
|
29
|
+
- Allow selecting tests and files containing regexp special characters ([#32](https://github.com/jest-community/jest-watch-typeahead/pull/32))
|
30
|
+
|
31
|
+
### Chore & Maintenance
|
32
|
+
|
33
|
+
- Remove build directory before building ([#31](https://github.com/jest-community/jest-watch-typeahead/pull/31))
|
34
|
+
|
1
35
|
## 0.4.0
|
2
36
|
|
3
37
|
### Chore & Maintenance
|
package/README.md
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
[](https://travis-ci.org/jest-community/jest-watch-typeahead) [](https://badge.fury.io/js/jest-watch-typeahead)
|
2
2
|
|
3
3
|
<div align="center">
|
4
|
-
|
5
|
-
|
6
|
-
<img width="150" height="150" vspace="" hspace="25" src="https://cdn.worldvectorlogo.com/logos/jest.svg">
|
4
|
+
<a href="https://jestjs.io/">
|
5
|
+
<img width="150" height="150" vspace="" hspace="25" src="https://jestjs.io/img/jest.png">
|
7
6
|
</a>
|
8
7
|
<h1>jest-watch-typeahead</h1>
|
9
8
|
<p>Filter your tests by file name or test name</p>
|
@@ -15,7 +14,7 @@
|
|
15
14
|
|
16
15
|
### Install
|
17
16
|
|
18
|
-
Install `jest`_(it needs Jest
|
17
|
+
Install `jest`_(it needs Jest 26+)_ and `jest-watch-typeahead`
|
19
18
|
|
20
19
|
```bash
|
21
20
|
yarn add --dev jest jest-watch-typeahead
|
@@ -2,12 +2,8 @@
|
|
2
2
|
|
3
3
|
var _jestWatcher = require("jest-watcher");
|
4
4
|
|
5
|
-
var _jestRegexUtil = require("jest-regex-util");
|
6
|
-
|
7
5
|
var _prompt = _interopRequireDefault(require("./prompt"));
|
8
6
|
|
9
|
-
var _utils = require("../lib/utils");
|
10
|
-
|
11
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
8
|
|
13
9
|
class FileNamePlugin {
|
@@ -42,10 +38,10 @@ class FileNamePlugin {
|
|
42
38
|
const p = new _prompt.default(this._stdout, this._prompt);
|
43
39
|
p.updateSearchSources(this._projects);
|
44
40
|
return new Promise((res, rej) => {
|
45
|
-
p.run(
|
41
|
+
p.run(testPathPattern => {
|
46
42
|
updateConfigAndRun({
|
47
43
|
mode: 'watch',
|
48
|
-
testPathPattern
|
44
|
+
testPathPattern
|
49
45
|
});
|
50
46
|
res();
|
51
47
|
}, rej);
|
@@ -13,6 +13,8 @@ var _stringLength = _interopRequireDefault(require("string-length"));
|
|
13
13
|
|
14
14
|
var _jestWatcher = require("jest-watcher");
|
15
15
|
|
16
|
+
var _jestRegexUtil = require("jest-regex-util");
|
17
|
+
|
16
18
|
var _utils = require("../lib/utils");
|
17
19
|
|
18
20
|
var _pattern_mode_helpers = require("../lib/pattern_mode_helpers");
|
@@ -99,6 +101,12 @@ class FileNamePatternPrompt extends _jestWatcher.PatternPrompt {
|
|
99
101
|
this._searchSources = searchSources;
|
100
102
|
}
|
101
103
|
|
104
|
+
run(onSuccess, onCancel, options) {
|
105
|
+
super.run(value => {
|
106
|
+
onSuccess((0, _utils.removeTrimmingDots)(value).split('/').map(_jestRegexUtil.escapeStrForRegex).join('/'));
|
107
|
+
}, onCancel, options);
|
108
|
+
}
|
109
|
+
|
102
110
|
}
|
103
111
|
|
104
112
|
exports.default = FileNamePatternPrompt;
|
package/build/lib/utils.js
CHANGED
@@ -58,7 +58,7 @@ const trimAndFormatPath = (pad, config, testPath, columns) => {
|
|
58
58
|
} // can't fit dirname, but can fit trimmed basename
|
59
59
|
|
60
60
|
|
61
|
-
return (0, _slash.default)(_chalk.default.bold(`${TRIMMING_DOTS}${basename.slice(
|
61
|
+
return (0, _slash.default)(_chalk.default.bold(`${TRIMMING_DOTS}${basename.slice(-maxLength + 3)}`));
|
62
62
|
};
|
63
63
|
|
64
64
|
exports.trimAndFormatPath = trimAndFormatPath;
|
@@ -2,12 +2,8 @@
|
|
2
2
|
|
3
3
|
var _jestWatcher = require("jest-watcher");
|
4
4
|
|
5
|
-
var _jestRegexUtil = require("jest-regex-util");
|
6
|
-
|
7
5
|
var _prompt = _interopRequireDefault(require("./prompt"));
|
8
6
|
|
9
|
-
var _utils = require("../lib/utils");
|
10
|
-
|
11
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
8
|
|
13
9
|
class TestNamePlugin {
|
@@ -42,10 +38,10 @@ class TestNamePlugin {
|
|
42
38
|
const p = new _prompt.default(this._stdout, this._prompt);
|
43
39
|
p.updateCachedTestResults(this._testResults);
|
44
40
|
return new Promise((res, rej) => {
|
45
|
-
p.run(
|
41
|
+
p.run(testNamePattern => {
|
46
42
|
updateConfigAndRun({
|
47
43
|
mode: 'watch',
|
48
|
-
testNamePattern
|
44
|
+
testNamePattern
|
49
45
|
});
|
50
46
|
res();
|
51
47
|
}, rej);
|
@@ -6,6 +6,8 @@ var _ansiEscapes = _interopRequireDefault(require("ansi-escapes"));
|
|
6
6
|
|
7
7
|
var _jestWatcher = require("jest-watcher");
|
8
8
|
|
9
|
+
var _jestRegexUtil = require("jest-regex-util");
|
10
|
+
|
9
11
|
var _scroll2 = _interopRequireDefault(require("../lib/scroll"));
|
10
12
|
|
11
13
|
var _utils = require("../lib/utils");
|
@@ -19,11 +21,14 @@ class TestNamePatternPrompt extends _jestWatcher.PatternPrompt {
|
|
19
21
|
super(pipe, prompt);
|
20
22
|
this._entityName = 'tests';
|
21
23
|
this._cachedTestResults = [];
|
24
|
+
this._offset = -1;
|
22
25
|
}
|
23
26
|
|
24
27
|
_onChange(pattern, options) {
|
25
28
|
super._onChange(pattern, options);
|
26
29
|
|
30
|
+
this._offset = options.offset;
|
31
|
+
|
27
32
|
this._printTypeahead(pattern, options);
|
28
33
|
}
|
29
34
|
|
@@ -82,6 +87,14 @@ class TestNamePatternPrompt extends _jestWatcher.PatternPrompt {
|
|
82
87
|
this._cachedTestResults = testResults;
|
83
88
|
}
|
84
89
|
|
90
|
+
run(onSuccess, onCancel, options) {
|
91
|
+
super.run(value => {
|
92
|
+
const preparedPattern = (0, _jestRegexUtil.escapeStrForRegex)((0, _utils.removeTrimmingDots)(value));
|
93
|
+
const useExactMatch = this._offset !== -1;
|
94
|
+
onSuccess(useExactMatch ? `^${preparedPattern}$` : preparedPattern);
|
95
|
+
}, onCancel, options);
|
96
|
+
}
|
97
|
+
|
85
98
|
}
|
86
99
|
|
87
100
|
module.exports = TestNamePatternPrompt;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "jest-watch-typeahead",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.6.1",
|
4
4
|
"main": "build/index.js",
|
5
5
|
"author": "Rogelio Guzman <rogelioguzmanh@gmail.com>",
|
6
6
|
"description": "Jest plugin for filtering by filename or test name",
|
@@ -22,36 +22,38 @@
|
|
22
22
|
"prebuild": "rimraf build",
|
23
23
|
"build": "babel src --ignore **/*.test.js,integration -d build",
|
24
24
|
"prepublish": "yarn build",
|
25
|
-
"format": "prettier --
|
25
|
+
"format": "prettier --write \"**/*.js\" \"**/*.md\""
|
26
26
|
},
|
27
27
|
"dependencies": {
|
28
|
-
"ansi-escapes": "^4.
|
29
|
-
"chalk": "^
|
30
|
-
"jest-regex-util": "^
|
31
|
-
"jest-watcher": "^
|
28
|
+
"ansi-escapes": "^4.3.1",
|
29
|
+
"chalk": "^4.0.0",
|
30
|
+
"jest-regex-util": "^26.0.0",
|
31
|
+
"jest-watcher": "^26.3.0",
|
32
32
|
"slash": "^3.0.0",
|
33
|
-
"string-length": "^
|
34
|
-
"strip-ansi": "^
|
33
|
+
"string-length": "^4.0.1",
|
34
|
+
"strip-ansi": "^6.0.0"
|
35
35
|
},
|
36
36
|
"devDependencies": {
|
37
|
-
"@babel/cli": "^7.
|
38
|
-
"@babel/core": "^7.
|
39
|
-
"@babel/preset-env": "^7.
|
40
|
-
"@babel/preset-flow": "^7.
|
41
|
-
"babel-
|
42
|
-
"babel-
|
43
|
-
"
|
44
|
-
"eslint": "^
|
45
|
-
"eslint-config-
|
46
|
-
"eslint-
|
47
|
-
"eslint-plugin-
|
48
|
-
"eslint-plugin-
|
49
|
-
"eslint-plugin-
|
50
|
-
"
|
51
|
-
"
|
52
|
-
"
|
53
|
-
"
|
54
|
-
|
37
|
+
"@babel/cli": "^7.8.4",
|
38
|
+
"@babel/core": "^7.9.6",
|
39
|
+
"@babel/preset-env": "^7.9.6",
|
40
|
+
"@babel/preset-flow": "^7.9.0",
|
41
|
+
"babel-eslint": "^10.1.0",
|
42
|
+
"babel-jest": "^26.0.0",
|
43
|
+
"eslint": "^7.8.1",
|
44
|
+
"eslint-config-airbnb-base": "^14.1.0",
|
45
|
+
"eslint-config-prettier": "^6.11.0",
|
46
|
+
"eslint-plugin-flowtype": "^5.2.0",
|
47
|
+
"eslint-plugin-import": "^2.20.2",
|
48
|
+
"eslint-plugin-jest": "^24.0.0",
|
49
|
+
"eslint-plugin-prettier": "^3.1.3",
|
50
|
+
"flow-bin": "^0.133.0",
|
51
|
+
"jest": "^26.0.0",
|
52
|
+
"prettier": "^2.1.1",
|
53
|
+
"rimraf": "^3.0.2"
|
54
|
+
},
|
55
|
+
"peerDependencies": {
|
56
|
+
"jest": "^26.0.0"
|
55
57
|
},
|
56
58
|
"jest": {
|
57
59
|
"watchPlugins": [
|
@@ -69,5 +71,8 @@
|
|
69
71
|
"/node_modules/",
|
70
72
|
"/__mocks__/"
|
71
73
|
]
|
74
|
+
},
|
75
|
+
"engines": {
|
76
|
+
"node": ">=10"
|
72
77
|
}
|
73
78
|
}
|