jest-watch-typeahead 0.4.1 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
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
  [![Build Status](https://travis-ci.org/jest-community/jest-watch-typeahead.svg?branch=master)](https://travis-ci.org/jest-community/jest-watch-typeahead) [![npm version](https://badge.fury.io/js/jest-watch-typeahead.svg)](https://badge.fury.io/js/jest-watch-typeahead)
2
2
 
3
3
  <div align="center">
4
- <!-- replace with accurate logo e.g from https://worldvectorlogo.com/ -->
5
- <a href="https://facebook.github.io/jest/">
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 23+)_ and `jest-watch-typeahead`
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(value => {
41
+ p.run(testPathPattern => {
46
42
  updateConfigAndRun({
47
43
  mode: 'watch',
48
- testPathPattern: (0, _utils.removeTrimmingDots)(value).split('/').map(_jestRegexUtil.escapeStrForRegex).join('/')
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;
@@ -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(basename.length - maxLength - 4, basename.length)}`));
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(value => {
41
+ p.run(testNamePattern => {
46
42
  updateConfigAndRun({
47
43
  mode: 'watch',
48
- testNamePattern: (0, _jestRegexUtil.escapeStrForRegex)((0, _utils.removeTrimmingDots)(value))
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.4.1",
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 --single-quote --trailing-comma all --write \"!(build)/**/*.js\""
25
+ "format": "prettier --write \"**/*.js\" \"**/*.md\""
26
26
  },
27
27
  "dependencies": {
28
- "ansi-escapes": "^4.2.1",
29
- "chalk": "^2.4.1",
30
- "jest-regex-util": "^24.9.0",
31
- "jest-watcher": "^24.3.0",
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": "^3.1.0",
34
- "strip-ansi": "^5.0.0"
33
+ "string-length": "^4.0.1",
34
+ "strip-ansi": "^6.0.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@babel/cli": "^7.0.0",
38
- "@babel/core": "^7.0.0",
39
- "@babel/preset-env": "^7.0.0",
40
- "@babel/preset-flow": "^7.0.0",
41
- "babel-core": "^7.0.0-bridge.0",
42
- "babel-eslint": "^10.0.1",
43
- "babel-jest": "^24.3.0",
44
- "eslint": "^6.2.0",
45
- "eslint-config-airbnb-base": "^14.0.0",
46
- "eslint-config-prettier": "^6.1.0",
47
- "eslint-plugin-flowtype": "^4.2.0",
48
- "eslint-plugin-import": "^2.9.0",
49
- "eslint-plugin-jest": "^22.1.3",
50
- "eslint-plugin-prettier": "^3.0.1",
51
- "flow-bin": "^0.105.2",
52
- "jest": "^24.3.0",
53
- "prettier": "^1.13.7",
54
- "rimraf": "^3.0.0"
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
  }