Skip to content

Include duration in --write snapshots#2960

Merged
lydell merged 1 commit intoprettier:masterfrom
lydell:fix-write-snapshots
Oct 6, 2017
Merged

Include duration in --write snapshots#2960
lydell merged 1 commit intoprettier:masterfrom
lydell:fix-write-snapshots

Conversation

@lydell
Copy link
Copy Markdown
Member

@lydell lydell commented Oct 2, 2017

Context: #2957 (comment)

@lydell lydell mentioned this pull request Oct 2, 2017
Comment thread src/cli-util.js Outdated
// done since otherwise the tests would only pass (match the snapshot)
// if they happened to run in the exact amount of time as when
// created.
console.log(chalk.grey(`${filename} %dms`), Date.now() - start);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we can mock Date.now() to always output 0 and replace %d/%s with their actual value?


exports[`do not write file with --write + formated file (stdout) 1`] = `
"formated.js%s %dms
"formated.jsformated.js %dms
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I just realize I removed the [2K[1G (remove line) control character in the snapshot output (strip-ansi) so that it looks weird here, I think we can add a special case for it to actually do the same thing in the mocked stdout/stderr.

@azz
Copy link
Copy Markdown
Member

azz commented Oct 5, 2017

Is this good to go, or do you want to do more ANSI changes?

@lydell
Copy link
Copy Markdown
Member Author

lydell commented Oct 5, 2017

I don't want to do more ANSI stuff, but I want to try mocking Date.now.

@lydell
Copy link
Copy Markdown
Member Author

lydell commented Oct 5, 2017

Ok, I ended up messing with the ANSI stuff anyway. @ikatyang What do you think?

@lydell
Copy link
Copy Markdown
Member Author

lydell commented Oct 5, 2017

Works locally but fails on Travis :(

@azz
Copy link
Copy Markdown
Member

azz commented Oct 5, 2017

Failure is unrelated to your changes. #2903

@lydell lydell force-pushed the fix-write-snapshots branch from a55997c to 094d5cf Compare October 6, 2017 05:44
@lydell lydell changed the title Fix/document --write snapshots Include duration in --write snapshots Oct 6, 2017
@lydell
Copy link
Copy Markdown
Member Author

lydell commented Oct 6, 2017

I scrapped my previous work and started over from master. Now, I've only added the duration to the snapshots (by mocking Date.now).

@lydell lydell merged commit bc42037 into prettier:master Oct 6, 2017
@lydell lydell deleted the fix-write-snapshots branch October 6, 2017 06:20
@lock lock Bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 19, 2019
@lock lock Bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants