File tree Expand file tree Collapse file tree 4 files changed +10
-10
lines changed Expand file tree Collapse file tree 4 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 3131 "pirates" : " ^4.0.1" ,
3232 "realpath-native" : " ^1.1.0" ,
3333 "rimraf" : " ^2.5.4" ,
34+ "slash" : " ^2.0.0" ,
3435 "strip-ansi" : " ^5.0.0"
3536 },
3637 "devDependencies" : {
4142 "@types/micromatch" : " ^3.1.0" ,
4243 "@types/p-each-series" : " ^1.0.0" ,
4344 "@types/rimraf" : " ^2.0.2" ,
45+ "@types/slash" : " ^2.0.0" ,
4446 "@types/strip-ansi" : " ^3.0.0"
4547 },
4648 "engines" : {
Original file line number Diff line number Diff line change @@ -51,14 +51,14 @@ Watch Usage
5151` ;
5252
5353exports [` Watch mode flows makes watch plugin initialization errors look nice 1` ] = `
54- " Error: Failed to initialize watch plugin \\ "packages/jest-core/src/__tests__/__fixtures__/watch_plugin_throws\\ ":
54+ [ Error: Failed to initialize watch plugin "packages/jest-core/src/__tests__/__fixtures__/watch_plugin_throws":
5555
5656 ● Test suite failed to run
5757
5858 initialization error
5959
6060 at Object.<anonymous > (__fixtures__/watch_plugin_throws.js:3:7)
61- "
61+ ]
6262`;
6363
6464exports[`Watch mode flows shows prompts for WatchPlugins in alphabetical order 1`] = `
Original file line number Diff line number Diff line change @@ -579,9 +579,8 @@ describe('Watch mode flows', () => {
579579 it ( 'makes watch plugin initialization errors look nice' , async ( ) => {
580580 const pluginPath = `${ __dirname } /__fixtures__/watch_plugin_throws` ;
581581
582- expect . assertions ( 1 ) ;
583- try {
584- await watch (
582+ await expect (
583+ watch (
585584 {
586585 ...globalConfig ,
587586 rootDir : __dirname ,
@@ -591,10 +590,8 @@ describe('Watch mode flows', () => {
591590 pipe ,
592591 hasteMapInstances ,
593592 stdin ,
594- ) ;
595- } catch ( error ) {
596- expect ( error . toString ( ) . replace ( / \\ / , '/' ) ) . toMatchSnapshot ( ) ;
597- }
593+ ) ,
594+ ) . rejects . toMatchSnapshot ( ) ;
598595 } ) ;
599596
600597 it . each `
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import path from 'path';
99import ansiEscapes from 'ansi-escapes' ;
1010import chalk from 'chalk' ;
1111import exit from 'exit' ;
12+ import slash from 'slash' ;
1213import HasteMap , { HasteChangeEvent } from 'jest-haste-map' ;
1314import { formatExecError } from 'jest-message-util' ;
1415import { isInteractive , preRunMessage , specialChars } from 'jest-util' ;
@@ -183,7 +184,7 @@ export default function watch(
183184 } catch ( error ) {
184185 const errorWithContext = new Error (
185186 `Failed to initialize watch plugin "${ chalk . bold (
186- path . relative ( process . cwd ( ) , pluginWithConfig . path ) ,
187+ slash ( path . relative ( process . cwd ( ) , pluginWithConfig . path ) ) ,
187188 ) } ":\n\n${ formatExecError ( error , contexts [ 0 ] . config , {
188189 noStackTrace : false ,
189190 } ) } `,
You can’t perform that action at this time.
0 commit comments