Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
normalize slashes in in test filenames and log output
  • Loading branch information
SimenB committed May 27, 2018
commit 3085fcc93b6374801497c89e03f2bebf3ba6a52e
2 changes: 1 addition & 1 deletion packages/jest-cli/src/reporters/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const formatTestPath = (
testPath: Path,
) => {
const {dirname, basename} = relativePath(config, testPath);
return chalk.dim(dirname + path.sep) + chalk.bold(basename);
return slash(chalk.dim(dirname + path.sep) + chalk.bold(basename));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anybody with a Windows computer can confirm you can Ctrl+Click to get to test location? If it actually ever worked earlier of course

Copy link
Member Author

@SimenB SimenB May 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't work from cmd at least (before or after). I didn't test in e.g. git bash or commandr (or what it's called, it's been years since I developed on windows)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this should work with VSCode and terminals like git bash already use such paths. microsoft/vscode#27082

};

export const relativePath = (
Expand Down
1 change: 1 addition & 0 deletions packages/jest-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"is-ci": "^1.0.10",
"jest-message-util": "^23.0.0",
"mkdirp": "^0.5.1",
"slash": "^1.0.0",
"source-map": "^0.6.0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/jest-util/src/get_console_output.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import type {ConsoleBuffer} from 'types/Console';

import path from 'path';
import chalk from 'chalk';
import slash from 'slash';

export default (root: string, verbose: boolean, buffer: ConsoleBuffer) => {
const TITLE_INDENT = verbose ? ' ' : ' ';
const CONSOLE_INDENT = TITLE_INDENT + ' ';

return buffer.reduce((output, {type, message, origin}) => {
origin = path.relative(root, origin);
origin = slash(path.relative(root, origin));
message = message
.split(/\n/)
.map(line => CONSOLE_INDENT + line)
Expand Down