-
Notifications
You must be signed in to change notification settings - Fork 45.6k
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
Conversation
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, '/'); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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\\'
There was a problem hiding this comment.
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, '/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you're right.
Let's wait for Travis and if it passes, I'll merge. |
@@ -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); |
There was a problem hiding this comment.
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
Running record-tests on windows modifies the output due to slash incompatibility.
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.