avajs / ava

Node.js test runner that lets you develop with confidence 🚀
MIT License
20.74k stars 1.41k forks source link

Cannot update snapshots #2357

Closed sramam closed 4 years ago

sramam commented 4 years ago

I am trying out ava@3.0.0-beta.1 and noticed that update-snapshots is broken. The tests run, but the snapshots are not updated, and it reports a snapshot mismatch failure.

Config

Copy the relevant section from package.json:

"ava": {
    "files": [
      "dist/**/test.js",
      "dist/**/test/**/*.js",
      "!dist/**/test/fixtures/**/*.js",
      "!dist/**/helpers/**"
    ],
    "serial": false,
    "ignoredByWatcher": [
      "dist/**/*.js"
    ]
  }

Command-Line Arguments

I upgraded @types/node, per #2332

-    "@types/node": "^12.12.24",
-    "ava": "^2.4.0",
+    "@types/node": "^13.1.6",
+    "ava": "3.0.0-beta.1",

& "sources" -> "ignoredByWatcher" per the warning reported.

Environment

$ npx ava --version
3.0.0-beta.1
novemberborn commented 4 years ago

The tests run, but the snapshots are not updated, and it reports a snapshot mismatch failure.

How are you running the tests? By default, snapshots aren't updated. But perhaps we broke something in how you're telling AVA to update them.


& "sources" -> "ignoredByWatcher" per the warning reported.

Note though that this "ignored by watcher" is the inverse of sources. Your configuration now says to ignore all JS files in dist which is probably not what you intended.

sramam commented 4 years ago

Here's a minimal reproduction

novemberborn commented 4 years ago

Ah! There's a typo in lib/cli.js:

https://github.com/avajs/ava/blob/090884b5040a1d4b02a18939245f7c2305228e00/lib/cli.js#L163