-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Revamp snapshot tests #2351
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
Revamp snapshot tests #2351
Conversation
@jridgewell is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 5 Ignored Deployments
|
6282dfe
to
b58b0ae
Compare
let mut p = PathBuf::from(&path.await?.path); | ||
if p.extension() == Some(OsStr::new("map")) { | ||
p.set_extension(""); | ||
debug_assert_ne!(p.extension(), Some(OsStr::new("js"))); |
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.
In what case is this possible, since we set the extension to "" just before?
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.
It recomputes afterwards, inheriting the next .abc123
that still remains. I think it's implemented like an rfind
.
diff.unified_diff() | ||
.context_radius(3) | ||
.header("expected", "actual") | ||
); |
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.
Perhaps use eprintln
instead of println
in the above?
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.
Done.
The only effect is that we don't emit source maps for the individual chunk items, reducing the total number of output files considerably.
Co-authored-by: Alex Kirszenberg <a.kirszenberg@gmail.com>
4070315
to
5589628
Compare
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.
Any chance we could merge the snapshot output into a single file?
Does this make it easier? I really dislike jests file format, because there's cruft alongside the snapshot outputs. |
Would make git diffs a bit nicer if we don't have 10 changed files for every snapshot test all the time But that doesn't have to be in this PR |
* chore: typo * Remove hot_module_replacement from snapshot tests Re: #2351 Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
* chore: typo * Remove hot_module_replacement from snapshot tests Re: vercel/turborepo#2351 Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
* chore: typo * Remove hot_module_replacement from snapshot tests Re: vercel/turborepo#2351 Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
* Disable HMR for snapshot tests The only effect is that we don't emit source maps for the individual chunk items, reducing the total number of output files considerably. * Extract snapshot tests into separate crate * Strip annoying file hash fingerprints * Reduce deps * Update old references to turbopack/test/snapshot * Move node_modules out of snapshot dir * Only un-fingerprint EcmascriptChunkSourceMapAssetVc source maps * Fix gitignore * Remove dbg * TAPLO * Apply suggestions from code review Co-authored-by: Alex Kirszenberg <a.kirszenberg@gmail.com> * Use eprintln Co-authored-by: Alex Kirszenberg <a.kirszenberg@gmail.com>
* chore: typo * Remove hot_module_replacement from snapshot tests Re: vercel/turborepo#2351 Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
* Disable HMR for snapshot tests The only effect is that we don't emit source maps for the individual chunk items, reducing the total number of output files considerably. * Extract snapshot tests into separate crate * Strip annoying file hash fingerprints * Reduce deps * Update old references to turbopack/test/snapshot * Move node_modules out of snapshot dir * Only un-fingerprint EcmascriptChunkSourceMapAssetVc source maps * Fix gitignore * Remove dbg * TAPLO * Apply suggestions from code review Co-authored-by: Alex Kirszenberg <a.kirszenberg@gmail.com> * Use eprintln Co-authored-by: Alex Kirszenberg <a.kirszenberg@gmail.com>
* chore: typo * Remove hot_module_replacement from snapshot tests Re: vercel/turborepo#2351 Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
This fixes quite a few warts with out snapshot tests:
.map
file is renamed, making git show it as a new/deleted file instead of a changed one.build.rs
, we had to rebuild theturbopack
crate whenever a test file changedturbopack
(read, everything) needed to recompileturbopack-tests
crate rebuilds, and everything else stays constant