jest-watch-typeahead 0.2.1 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +24 -1
- package/build/index.js +10 -0
- package/build/lib/utils.js +10 -9
- package/build/test_name_plugin/prompt.js +4 -4
- package/build/test_utils/pluginTester.js +18 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
@@ -1,4 +1,27 @@
|
|
1
|
-
##
|
1
|
+
## 0.3.1
|
2
|
+
|
3
|
+
### Fixes
|
4
|
+
|
5
|
+
- Helpful error message when attempting to use the package main file ([#29](https://github.com/jest-community/jest-watch-typeahead/pull/29))
|
6
|
+
|
7
|
+
## 0.3.0
|
8
|
+
|
9
|
+
### Chore & Maintenance
|
10
|
+
|
11
|
+
- Bump dated dependencies ([#25](https://github.com/jest-community/jest-watch-typeahead/pull/25))
|
12
|
+
- Get better truncation for testname typeahead by truncating the start and not the end ([#28](https://github.com/jest-community/jest-watch-typeahead/pull/28))
|
13
|
+
|
14
|
+
### Fixes
|
15
|
+
|
16
|
+
- Use fullName(to show ancestor titles) for test name pattern plugin ([#26](https://github.com/jest-community/jest-watch-typeahead/pull/26))
|
17
|
+
|
18
|
+
## 0.2.1
|
19
|
+
|
20
|
+
- Fix cursor in terminal app ([#21](https://github.com/jest-community/jest-watch-typeahead/pull/21))
|
21
|
+
|
22
|
+
### Chore & Maintenance
|
23
|
+
|
24
|
+
- Bump dated dependencies ([#23](https://github.com/jest-community/jest-watch-typeahead/pull/23))
|
2
25
|
|
3
26
|
## 0.2.0
|
4
27
|
|
package/build/index.js
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
throw new Error(`
|
4
|
+
jest-watch-typeahead includes two watch plugins: The filename plugin and the testname plugin.
|
5
|
+
Please configure Jest as follows:
|
6
|
+
"watchPlugins": [
|
7
|
+
"jest-watch-typeahead/filename",
|
8
|
+
"jest-watch-typeahead/testname"
|
9
|
+
]
|
10
|
+
`);
|
package/build/lib/utils.js
CHANGED
@@ -125,22 +125,23 @@ const formatTestNameByPattern = (testName, pattern, width) => {
|
|
125
125
|
|
126
126
|
const startPatternIndex = Math.max(match.index, 0);
|
127
127
|
const endPatternIndex = startPatternIndex + match[0].length;
|
128
|
+
const testNameFitsInTerminal = inlineTestName.length <= width;
|
128
129
|
|
129
|
-
if (
|
130
|
+
if (testNameFitsInTerminal) {
|
130
131
|
return colorize(inlineTestName, startPatternIndex, endPatternIndex);
|
131
132
|
}
|
132
133
|
|
133
|
-
const
|
134
|
+
const numberOfTruncatedChars = DOTS.length + inlineTestName.length - width;
|
135
|
+
const end = Math.max(endPatternIndex - numberOfTruncatedChars, 0);
|
136
|
+
const truncatedTestName = inlineTestName.slice(numberOfTruncatedChars);
|
137
|
+
const shouldHighlightDots = startPatternIndex <= numberOfTruncatedChars;
|
134
138
|
|
135
|
-
if (
|
136
|
-
|
137
|
-
return colorize(slicedTestName + DOTS, startPatternIndex, slicedTestName.length + DOTS.length);
|
138
|
-
}
|
139
|
-
|
140
|
-
return colorize(slicedTestName + DOTS, Math.min(startPatternIndex, slicedTestName.length), endPatternIndex);
|
139
|
+
if (shouldHighlightDots) {
|
140
|
+
return colorize(DOTS + truncatedTestName, 0, end + DOTS.length);
|
141
141
|
}
|
142
142
|
|
143
|
-
|
143
|
+
const start = startPatternIndex - numberOfTruncatedChars;
|
144
|
+
return colorize(DOTS + truncatedTestName, start + DOTS.length, end + DOTS.length);
|
144
145
|
};
|
145
146
|
|
146
147
|
exports.formatTestNameByPattern = formatTestNameByPattern;
|
@@ -71,10 +71,10 @@ class TestNamePatternPrompt extends _jestWatcher.PatternPrompt {
|
|
71
71
|
testResults
|
72
72
|
}) => {
|
73
73
|
return matchedTests.concat(testResults.filter(({
|
74
|
-
|
75
|
-
}) => regex.test(
|
76
|
-
|
77
|
-
}) =>
|
74
|
+
fullName
|
75
|
+
}) => regex.test(fullName)).map(({
|
76
|
+
fullName
|
77
|
+
}) => fullName));
|
78
78
|
}, []);
|
79
79
|
}
|
80
80
|
|
@@ -15,6 +15,24 @@ expect.addSnapshotSerializer({
|
|
15
15
|
test: val => typeof val === 'string',
|
16
16
|
print: val => (0, _stripAnsi.default)(val)
|
17
17
|
});
|
18
|
+
/**
|
19
|
+
* See https://github.com/facebook/jest/pull/7523 for more details
|
20
|
+
*/
|
21
|
+
|
22
|
+
const CLEAR = '\x1B[2J\x1B[3J\x1B[H';
|
23
|
+
expect.addSnapshotSerializer({
|
24
|
+
test: val => val.includes(CLEAR),
|
25
|
+
print: val => (0, _stripAnsi.default)(val.replace(CLEAR, '[MOCK - clear]'))
|
26
|
+
});
|
27
|
+
/**
|
28
|
+
* See https://github.com/facebook/jest/pull/7523 for more details
|
29
|
+
*/
|
30
|
+
|
31
|
+
const WINDOWS_CLEAR = '\x1B[2J\x1B[0f';
|
32
|
+
expect.addSnapshotSerializer({
|
33
|
+
test: val => val.includes(WINDOWS_CLEAR),
|
34
|
+
print: val => (0, _stripAnsi.default)(val.replace(WINDOWS_CLEAR, '[MOCK - clear]'))
|
35
|
+
});
|
18
36
|
jest.mock('ansi-escapes', () => ({
|
19
37
|
clearScreen: '[MOCK - clearScreen]',
|
20
38
|
cursorDown: (count = 1) => `[MOCK - cursorDown(${count})]`,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "jest-watch-typeahead",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.3.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",
|
@@ -26,7 +26,7 @@
|
|
26
26
|
"dependencies": {
|
27
27
|
"ansi-escapes": "^3.0.0",
|
28
28
|
"chalk": "^2.4.1",
|
29
|
-
"jest-watcher": "^
|
29
|
+
"jest-watcher": "^24.3.0",
|
30
30
|
"slash": "^2.0.0",
|
31
31
|
"string-length": "^2.0.0",
|
32
32
|
"strip-ansi": "^5.0.0"
|
@@ -38,16 +38,16 @@
|
|
38
38
|
"@babel/preset-flow": "^7.0.0",
|
39
39
|
"babel-core": "^7.0.0-bridge.0",
|
40
40
|
"babel-eslint": "^10.0.1",
|
41
|
-
"babel-jest": "^
|
41
|
+
"babel-jest": "^24.3.0",
|
42
42
|
"eslint": "^5.12.1",
|
43
43
|
"eslint-config-airbnb-base": "^13.1.0",
|
44
|
-
"eslint-config-prettier": "^
|
44
|
+
"eslint-config-prettier": "^4.1.0",
|
45
45
|
"eslint-plugin-flowtype": "^3.2.1",
|
46
46
|
"eslint-plugin-import": "^2.9.0",
|
47
47
|
"eslint-plugin-jest": "^22.1.3",
|
48
48
|
"eslint-plugin-prettier": "^3.0.1",
|
49
|
-
"flow-bin": "^0.
|
50
|
-
"jest": "^
|
49
|
+
"flow-bin": "^0.94.0",
|
50
|
+
"jest": "^24.3.0",
|
51
51
|
"prettier": "^1.13.7"
|
52
52
|
},
|
53
53
|
"jest": {
|
@@ -56,7 +56,7 @@
|
|
56
56
|
"<rootDir>/testname"
|
57
57
|
],
|
58
58
|
"snapshotSerializers": [
|
59
|
-
"<rootDir>/node_modules/pretty-format/build/plugins/
|
59
|
+
"<rootDir>/node_modules/pretty-format/build/plugins/ConvertAnsi"
|
60
60
|
],
|
61
61
|
"testPathIgnorePatterns": [
|
62
62
|
"<rootDir>/build/.*",
|