Implement custom snapshot serializer for Vue.js v3
What does this MR do and why?
Related to Port custom snapshot serializer for Vue from gi... (#386757 - closed)
This one implements custom snapshot serializer to unify differences between Vue.js 2 and Vue.js 3:
- drop extra attributes
- normalize ids
- normalize text nodes
Based on work by @f_caplette and @ntepluhina in !116001 (closed)
How to set up and validate locally
Note! Full functionality is based on multiple merge-requests to be merged before testing this:
- Workaround missing slots in $scopedSlots in @vu... (!128533 - merged)
- Add default configuration to VueRouter compat (!128544 - merged)
- Improve stubs generation for Vue.js 3 (!128548 - merged)
(gitlab-ui, note that this should not be both merged and upgraded in gitlab project):
- fix(button): correctly detect empty slot for ic... (gitlab-ui!3604 - merged)
- chore: remove double-passing attributes to GlDr... (gitlab-ui!3606 - merged)
- Let's prepare required version of gitlab-ui and merge all required branches (if you're receiving message that some of them does not exists - just skip it)
git merge origin/xanf-fix-ugly-vue
git merge origin/xanf-fix-router-v2
git merge origin/xanf-improve-stubbing-once-again-v2
# install version of gitlab-ui with all needed fixes
yarn add https://gitlab.com/gitlab-org/gitlab-ui/-/jobs/4809835526/artifacts/raw/gitlab-ui.xanf-fix-emptiness-check.tgz
# required to kick-in patch-package
yarn
- Let's regenerate all snapshots (integration too!) in Vue.js 2 mode (ensure you have up-to-date fixtures!):
yarn jest --maxWorkers 6 -u $(grep -rlE 'toMatchSnapshot|toMatchInlineSnapshot' spec/frontend ee/spec/frontend)
these should complete successfully
Now let's see how many differences we have between Vue.js 2 and 3:
export VUE_VERSION=3
yarn jest --maxWorkers 6 -u $(grep -rlE 'toMatchSnapshot|toMatchInlineSnapshot' spec/frontend ee/spec/frontend)
Snapshot Summary
› 15 snapshots failed from 7 test suites. Inspect your code changes or run `yarn run jest -u` to update them.
All of them require just tiny nitpicking changes and will be addressed outside of this MR in Fix remaining Vue.js 2/3 snapshot specs differe... (!128554 - merged)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.