Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jest-watch-typeahead

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-watch-typeahead - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0-0

build/filename_plugin.js

50

build/lib/utils.js

@@ -6,3 +6,3 @@ 'use strict';

});
exports.highlight = exports.getTerminalWidth = exports.trimAndFormatPath = undefined;
exports.formatTestNameByPattern = exports.highlight = exports.getTerminalWidth = exports.trimAndFormatPath = undefined;

@@ -35,2 +35,6 @@ var _path = require('path');

var colorize = function colorize(str, start, end) {
return _chalk2.default.dim(str.slice(0, start)) + _chalk2.default.reset(str.slice(start, end)) + _chalk2.default.dim(str.slice(end));
};
var trimAndFormatPath = exports.trimAndFormatPath = function trimAndFormatPath(pad, config, testPath, columns) {

@@ -73,6 +77,2 @@ var maxLength = columns - pad;

var colorize = function colorize(str, start, end) {
return _chalk2.default.dim(str.slice(0, start)) + _chalk2.default.reset(str.slice(start, end)) + _chalk2.default.dim(str.slice(end));
};
var regexp = void 0;

@@ -111,2 +111,42 @@

return colorize(filePath, Math.max(start, 0), Math.max(end, trimLength));
};
var DOTS = '...';
var ENTER = '⏎';
var formatTestNameByPattern = exports.formatTestNameByPattern = function formatTestNameByPattern(testName, pattern, width) {
var inlineTestName = testName.replace(/(\r\n|\n|\r)/gm, ENTER);
var regexp = void 0;
try {
regexp = new RegExp(pattern, 'i');
} catch (e) {
return _chalk2.default.dim(inlineTestName);
}
var match = inlineTestName.match(regexp);
if (!match) {
return _chalk2.default.dim(inlineTestName);
}
// $FlowFixMe
var startPatternIndex = Math.max(match.index, 0);
var endPatternIndex = startPatternIndex + match[0].length;
if (inlineTestName.length <= width) {
return colorize(inlineTestName, startPatternIndex, endPatternIndex);
}
var slicedTestName = inlineTestName.slice(0, width - DOTS.length);
if (startPatternIndex < slicedTestName.length) {
if (endPatternIndex > slicedTestName.length) {
return colorize(slicedTestName + DOTS, startPatternIndex, slicedTestName.length + DOTS.length);
}
return colorize(slicedTestName + DOTS, Math.min(startPatternIndex, slicedTestName.length), endPatternIndex);
}
return `${_chalk2.default.dim(slicedTestName)}${_chalk2.default.reset(DOTS)}`;
};

@@ -21,2 +21,4 @@ 'use strict';

require('./scroll');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -61,5 +63,8 @@

}
// eslint-disable-next-line no-unused-vars
}, {
key: '_onChange',
value: function _onChange() {
value: function _onChange(pattern, options) {
this._pipe.write(_ansiEscapes2.default.eraseLine);

@@ -66,0 +71,0 @@ this._pipe.write(_ansiEscapes2.default.cursorLeft);

## master
### Features
* Add test name typeahead ([#1](https://github.com/jest-community/jest-watch-typeahead/pull/1))
* Rename to jest-watch-typeahead
### 0.0.1
Initial Release

9

package.json
{
"name": "jest-watch-typeahead",
"version": "0.0.1",
"version": "0.1.0-0",
"main": "build/index.js",
"author": "Rogelio Guzman <rogelioguzmanh@gmail.com>",
"description": "Jest plugin for filtering by filename",
"description": "Jest plugin for filtering by filename or test name",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/rogeliog/jest-plugin-filename.git"
"url": "https://github.com/jest-community/jest-watch-typeahead.git"
},
"homepage": "https://github.com/rogeliog/jest-plugin-filename",
"homepage": "https://github.com/jest-community/jest-watch-typeahead",
"files": [

@@ -28,3 +28,2 @@ "build/"

"lodash": "4.17.5",
"prompts": "git://github.com/terkelg/prompts.git#792824f8e5bfe3d632da0e48be23ab718b8f6646",
"slash": "^1.0.0",

@@ -31,0 +30,0 @@ "string-length": "^2.0.0",

@@ -1,2 +0,2 @@

[![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-runner-eslint)
[![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)

@@ -9,6 +9,6 @@ <div align="center">

<h1>jest-watch-typeahead</h1>
<p>Filter your tests by filename</p>
<p>Filter your tests by file name or test name</p>
</div>
![watch](https://user-images.githubusercontent.com/574806/40588608-daf320f4-6194-11e8-99c4-dd1f63903208.gif)
![watch](https://user-images.githubusercontent.com/574806/40672937-25dab91a-6325-11e8-965d-4e55ef23e135.gif)

@@ -36,3 +36,6 @@ ## Usage

"jest": {
"watchPlugins": ["jest-watch-typeahead"]
"watchPlugins": [
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname"
]
}

@@ -46,3 +49,6 @@ }

module.exports = {
watchPlugins: ['jest-watch-typeahead'],
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
};

@@ -49,0 +55,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc