Skip to content

Upgrade @vue/test-utils to latest version

Illya Klymov requested to merge xanf-vtu-30-upgrade into master

What does this MR do?

This MR upgrades @vue/test-utils to latest version. Since this MR is huge and we need all these changes to arrive simultaneously, I suggest reviewing it per-commit basics. Here's how these commits were generated:

  1. 9329ae11 - just version bump and relevant lock file changes
  2. 553d0652 - Fix the only failing test

For next steps I'm directly hacking node_modules/@vue/test-utils/dist/vue-test-utils.js to generate separate commits. New version of @vue/test-utils introduced two major changes affecting almost every snapshot in our code:

  • replaced stub naming logic (was: gllink-stub, now: gl-link-stub)
  • html() calls are automatically prettified
  1. node_modules/@vue/test-utils/dist/vue-test-utils.js line 2014 (at top of createStubFromComponent). Add
if (name !== 'router-link') { name = name.replace(/-/g, ''); }

This simulates old naming scheme, so we can verify snapshot changes

  1. node_modules/@vue/test-utils/dist/vue-test-utils.js line 8082 (start of function var pretty)
return str;

(short-circuiting function, disabling HTML prettifying)

  1. 077dbba1 - Running yarn jest -u to update snapshots. This updates just two files. ee/spec/frontend/design_management/components/list/__snapshots__/item_spec.js.snap in this commit is hard to follow due to snapshot order change in file, but this one we can't control :(. This commit ensures that migration to async tests is done properly and we do not fail our snapshots

  2. fa07e8b4 - Reverting changes in step 4, I'm updating HTML-based snapshots

  3. 242b6a3f - Reverting changes in step 3. Updating remaining snapshots

🚀 We're ready to rock

Closes #195164 (closed)

Conformity

Edited by Illya Klymov

Merge request reports