Skip to content

Add validation directive compatibility with Vue.js 3

Illya Klymov requested to merge xanf-directive-vue3-compat into master

What does this MR do and why?

This MR adds Vue.js 3 compatibility to directive validation exactly according to compat guide

https://v3-migration.vuejs.org/breaking-changes/custom-directives.html#edge-case-accessing-the-component-instance

How to set up and validate locally

  • be on master branch
  • apply following patch. This patch:
    • disables console.log/console.error throws. This is temporary workaround while Fix incorrect console handling in Jest tests (#396779) is being implemented
    • disables fresh ai test which goes infinite loop 💣
    • introduces new "skippable runner" which will allow you to skip suites, which fail in Vue.js 2
    • makes tests which mutate Vue instances throw in Vue.js 2 (they will always fail in Vue.js 3)

0001-temp-normalizr.patch

  • ensure you have recent frontend fixtures, or regenrate them with rake frontend:fixtures
  • run
yarn jest --maxWorkers 6 --json --outputFile=/tmp/jest-results.json

Note: /tmp/jest-results.json is for now hardcoded in my "custom runner" so filename is important. This will create log to detect suites, which are failing in Vue.js 2 - we will skip them

  • run following command and record results. This is your "baseline" - how many Vue.js 3 related failures are in master
VUE_VERSION=3 SKIP_VUE2_FAILING_TESTS=1 yarn jest --maxWorkers 6
  • switch to branch of this MR
  • run same command and observe the differences
VUE_VERSION=3 SKIP_VUE2_FAILING_TESTS=1 yarn jest --maxWorkers 6
Metric master This MR
Tests failed 3041 2853
Suites failed 787 785
Tests passed 40372 40560
Suites passed 2855 2857

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports