Skip to content

Commit

Permalink
try slash to fix Windows CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jeysal committed May 7, 2019
1 parent 61dea2c commit ca06354
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 2 additions & 0 deletions packages/jest-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"pirates": "^4.0.1",
"realpath-native": "^1.1.0",
"rimraf": "^2.5.4",
"slash": "^2.0.0",
"strip-ansi": "^5.0.0"
},
"devDependencies": {
Expand All @@ -41,6 +42,7 @@
"@types/micromatch": "^3.1.0",
"@types/p-each-series": "^1.0.0",
"@types/rimraf": "^2.0.2",
"@types/slash": "^2.0.0",
"@types/strip-ansi": "^3.0.0"
},
"engines": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ Watch Usage
`;

exports[`Watch mode flows makes watch plugin initialization errors look nice 1`] = `
"Error: Failed to initialize watch plugin \\"packages/jest-core/src/__tests__/__fixtures__/watch_plugin_throws\\":
[Error: Failed to initialize watch plugin "packages/jest-core/src/__tests__/__fixtures__/watch_plugin_throws":
● Test suite failed to run
initialization error
at Object.<anonymous> (__fixtures__/watch_plugin_throws.js:3:7)
"
]
`;
exports[`Watch mode flows shows prompts for WatchPlugins in alphabetical order 1`] = `
Expand Down
11 changes: 4 additions & 7 deletions packages/jest-core/src/__tests__/watch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,8 @@ describe('Watch mode flows', () => {
it('makes watch plugin initialization errors look nice', async () => {
const pluginPath = `${__dirname}/__fixtures__/watch_plugin_throws`;

expect.assertions(1);
try {
await watch(
await expect(
watch(
{
...globalConfig,
rootDir: __dirname,
Expand All @@ -591,10 +590,8 @@ describe('Watch mode flows', () => {
pipe,
hasteMapInstances,
stdin,
);
} catch (error) {
expect(error.toString().replace(/\\/, '/')).toMatchSnapshot();
}
),
).rejects.toMatchSnapshot();
});

it.each`
Expand Down
3 changes: 2 additions & 1 deletion packages/jest-core/src/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import path from 'path';
import ansiEscapes from 'ansi-escapes';
import chalk from 'chalk';
import exit from 'exit';
import slash from 'slash';
import HasteMap, {HasteChangeEvent} from 'jest-haste-map';
import {formatExecError} from 'jest-message-util';
import {isInteractive, preRunMessage, specialChars} from 'jest-util';
Expand Down Expand Up @@ -183,7 +184,7 @@ export default function watch(
} catch (error) {
const errorWithContext = new Error(
`Failed to initialize watch plugin "${chalk.bold(
path.relative(process.cwd(), pluginWithConfig.path),
slash(path.relative(process.cwd(), pluginWithConfig.path)),
)}":\n\n${formatExecError(error, contexts[0].config, {
noStackTrace: false,
})}`,
Expand Down

0 comments on commit ca06354

Please sign in to comment.