Skip to content

Commit ce869df

Browse files
committed
try slash to fix Windows CI
1 parent 450eb11 commit ce869df

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

packages/jest-core/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
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": {
@@ -41,6 +42,7 @@
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": {

packages/jest-core/src/__tests__/__snapshots__/watch.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ Watch Usage
5151
`;
5252

5353
exports[`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
6464
exports[`Watch mode flows shows prompts for WatchPlugins in alphabetical order 1`] = `

packages/jest-core/src/__tests__/watch.test.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff 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`

packages/jest-core/src/watch.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import path from 'path';
99
import ansiEscapes from 'ansi-escapes';
1010
import chalk from 'chalk';
1111
import exit from 'exit';
12+
import slash from 'slash';
1213
import HasteMap, {HasteChangeEvent} from 'jest-haste-map';
1314
import {formatExecError} from 'jest-message-util';
1415
import {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
})}`,

0 commit comments

Comments
 (0)