Skip to content

Commit

Permalink
Windows watch mode fix (jestjs#3563)
Browse files Browse the repository at this point in the history
* Fix interactive watch arrow selection on Windows jestjs#3516

* Refactored fix for jestjs#3516 to use replacePathSepForRegex

* Fixed the failing test on Windows for the jestjs#3516 fix

* Bump regex-slash to 1.0.1 (provides a flow lib def)

* Update watch-filename-pattern-mode-test.js

* Code review feedback

* Fixed lint errors and implemented PR feedback

* Revert yarn.lock changes
  • Loading branch information
Scott Ranger authored and orta committed May 19, 2017
1 parent ddfa1a2 commit d6a0737
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ describe('Watch mode flows', () => {
});

it('can select a specific file name from the typeahead results', () => {
const toUnixPathPattern = pathPattern => pathPattern.replace(/\\\\/g, '/');

contexts[0].config = {rootDir: ''};
watch(globalConfig, contexts, argv, pipe, hasteMapInstances, stdin);

Expand All @@ -164,7 +166,7 @@ describe('Watch mode flows', () => {

stdin.emit(KEYS.ENTER);

expect(argv.testPathPattern).toMatchSnapshot();
expect(toUnixPathPattern(argv.testPathPattern)).toMatchSnapshot();
});

it('Results in pattern mode get truncated appropriately', () => {
Expand Down
5 changes: 3 additions & 2 deletions packages/jest-cli/src/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import type {Context} from 'types/Context';

const ansiEscapes = require('ansi-escapes');
const chalk = require('chalk');
const {replacePathSepForRegex} = require('jest-regex-util');
const HasteMap = require('jest-haste-map');
const isCI = require('is-ci');
const createContext = require('./lib/createContext');
const isValidPath = require('./lib/isValidPath');
const preRunMessage = require('./preRunMessage');
const createContext = require('./lib/createContext');
const runJest = require('./runJest');
const updateArgv = require('./lib/updateArgv');
const SearchSource = require('./SearchSource');
Expand Down Expand Up @@ -201,7 +202,7 @@ const watch = (
testPathPattern => {
updateArgv(argv, 'watch', {
testNamePattern: '',
testPathPattern,
testPathPattern: replacePathSepForRegex(testPathPattern),
});

startRun();
Expand Down

0 comments on commit d6a0737

Please sign in to comment.