Closed ehmicky closed 3 years ago
Oh interesting, I've never noticed that before. We should sort by test title, like we do for the Markdown files:
We should sort by test title, like we do for the Markdown files:
We're looking at sorting by declaration order instead, see #2324. That said, this issue is primarily about having a stable sort order, and we could still use test titles for that.
Sweet, thanks!
Description
When a test file has several parallel async tests and each of those tests call
t.snapshot()
, the resulting*.snap
file is non-deterministic. The contents of the*.snap
file depends on the order in which tests finished.In such cases, tests pass correctly. However the
*.snap
files contents keep being updated, which means they are shown as dirty files bygit status
and they result in merge conflicts, especially in PRs.Making
*.snap
file contents independent of test execution order would solve this issue.Test Source
test.js
Running
ava -u
on this file produces different*.snap
depending on whetherone
ortwo
finishes first.Command-Line Arguments
Copy your npm build scripts or the
ava
command used:Environment
Tell us which operating system you are using, as well as which versions of Node.js, npm, and AVA. Run the following to get it quickly: