Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fiber/record-tests to work on windows (slash differences) #8796

Merged
merged 1 commit into from
Jan 15, 2017

Conversation

tomgasson
Copy link

Running record-tests on windows modifies the output due to slash incompatibility.

image

This change ensures the output is consistent across platforms which is required since the results are committed back to the repo.

Alternatively we could use slash to do this.

const file = path.relative(root, fileResult.testFilePath);
const filePath = path.relative(root, fileResult.testFilePath);
// on windows, we still want to output forward slashes
const unixFilePath = filePath.replace(/\\/g, '/');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you use path.normalize() for this?

Copy link
Author

@tomgasson tomgasson Jan 14, 2017

Choose a reason for hiding this comment

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

No, that still uses windows slashes

path.normalize('C:\\temp\\\\foo\\bar\\..\\');
// Returns: 'C:\\temp\\foo\\'

https://nodejs.org/api/path.html#path_path_normalize_path

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, you're right.

const file = path.relative(root, fileResult.testFilePath);
const filePath = path.relative(root, fileResult.testFilePath);
// on windows, we still want to output forward slashes
const unixFilePath = filePath.replace(/\\/g, '/');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, you're right.

@gaearon
Copy link
Collaborator

gaearon commented Jan 14, 2017

Let's wait for Travis and if it passes, I'll merge.

@aweary aweary merged commit c776327 into facebook:master Jan 15, 2017
@@ -106,12 +106,14 @@ function runJest(maxWorkers) {
function formatResults(runResults, predicate) {
const formatted = [];
runResults.testResults.forEach((fileResult) => {
const file = path.relative(root, fileResult.testFilePath);
const filePath = path.relative(root, fileResult.testFilePath);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be able to just do path.posix.relative here instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants