Skip to content

Commit

Permalink
fix: migrate to use jest-watcher (#6)
Browse files Browse the repository at this point in the history
Closes #3
  • Loading branch information
SimenB committed May 31, 2018
1 parent 18f351a commit 6a2a73d
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 404 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"useBuiltIns": true,
"targets": {
"node": "4"
"node": "6"
}
}
],
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@
"format": "prettier --single-quote --trailing-comma all --write \"!(build)/**/*.js\""
},
"dependencies": {
"ansi-escapes": "^3.0.0",
"chalk": "^2.3.1",
"lodash": "4.17.5",
"jest-watcher": "^23.1.0",
"slash": "^1.0.0",
"string-length": "^2.0.0",
"strip-ansi": "^4.0.0"
Expand Down
48 changes: 0 additions & 48 deletions src/__tests__/__snapshots__/jest_prompt.test.js.snap

This file was deleted.

105 changes: 0 additions & 105 deletions src/__tests__/jest_prompt.test.js

This file was deleted.

12 changes: 7 additions & 5 deletions src/file_name_pattern_prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@

import chalk from 'chalk';
import stringLength from 'string-length';
import {
Prompt,
PatternPrompt,
printPatternCaret,
printRestoredPatternCaret,
} from 'jest-watcher';
import { highlight, getTerminalWidth, trimAndFormatPath } from './lib/utils';
import Prompt from './shared/Prompt';
import {
formatTypeaheadSelection,
printMore,
printPatternCaret,
printPatternMatches,
printRestoredPatternCaret,
printStartTyping,
printTypeaheadItem,
} from './shared/pattern_mode_helpers';
import scroll, { type ScrollOptions } from './shared/scroll';
import PatternPrompt from './shared/pattern_prompt';
import type { ProjectConfig } from './types/Config';

export type SearchSources = Array<{|
Expand Down Expand Up @@ -52,7 +54,7 @@ export default class FileNamePatternPrompt extends PatternPrompt {
const width = getTerminalWidth();
const { start, end, index } = scroll(total, options);

prompt.setTypeaheadLength(total);
prompt.setPromptLength(total);

matchedTests
.slice(start, end)
Expand Down
2 changes: 1 addition & 1 deletion src/file_name_plugin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import Prompt from './shared/Prompt';
import { Prompt } from 'jest-watcher';
import FileNamePatternPrompt, {
type SearchSources,
} from './file_name_pattern_prompt';
Expand Down
10 changes: 10 additions & 0 deletions src/lib/__tests__/utils.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import stripAnsi from 'strip-ansi';
import { trimAndFormatPath } from '../utils';

test('trimAndFormatPath', () => {
expect(
stripAnsi(
trimAndFormatPath(2, { cwd: '/hello/there' }, '/hello/there/to/you', 80),
),
).toEqual('to/you');
});
102 changes: 0 additions & 102 deletions src/shared/Prompt.js

This file was deleted.

38 changes: 0 additions & 38 deletions src/shared/constants.js

This file was deleted.

Loading

0 comments on commit 6a2a73d

Please sign in to comment.