From 58054f1c00e28b5a6008fa3867cb1223b3e44232 Mon Sep 17 00:00:00 2001 From: Illya Klymov Date: Fri, 28 Jan 2022 18:51:19 +0200 Subject: [PATCH] chore(ci): add vue3 testing to pipeline --- .github/workflows/test.yml | 6 ++++++ .gitignore | 1 + jest.config.js | 10 +++++----- tests/setup.js | 4 ++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fefe51f31e3..997bdd00099 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -122,8 +122,14 @@ jobs: - name: Test unit run: yarn run test:unit --coverage --maxWorkers=2 + - name: Test unit (Vue 3) + run: yarn run test:unit --coverage --maxWorkers=2 + env: + USE_VUE3: '1' + - name: CodeCov uses: codecov/codecov-action@v2.1.0 with: token: ${{ secrets.CODECOV_TOKEN }} flags: unittests + files: ./coverage/clover.xml,./coverage-vue3/clover.xml diff --git a/.gitignore b/.gitignore index 91a43b70be3..38d10d68e50 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ .vercel/ .vscode/ coverage/ +coverage-vue3/ dist/ docs-dist/ esm/ diff --git a/jest.config.js b/jest.config.js index c39accbb5e3..56b7921e99d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,11 +1,11 @@ -const useVue2 = 'USE_VUE2' in process.env +const useVue3 = 'USE_VUE3' in process.env -const moduleNameMapper = useVue2 - ? {} - : { +const moduleNameMapper = useVue3 + ? { '^vue$': '@vue/compat', '^@vue/test-utils$': '@vue/test-utils-vue3' } + : {} module.exports = { testRegex: 'spec.js$', @@ -15,7 +15,7 @@ module.exports = { '^.+\\.js$': 'babel-jest' }, transformIgnorePatterns: ['/node_modules(?![\\\\/]vue-test-utils-compat[\\\\/])'], - coverageDirectory: './coverage/', + coverageDirectory: useVue3 ? './coverage-vue3' : './coverage/', testEnvironmentOptions: { pretendToBeVisual: true }, diff --git a/tests/setup.js b/tests/setup.js index 36b35934858..45a63fdbf4d 100644 --- a/tests/setup.js +++ b/tests/setup.js @@ -3,8 +3,8 @@ import Vue from 'vue' import * as VTU from '@vue/test-utils' import { installCompat as installVTUCompat, fullCompatConfig } from 'vue-test-utils-compat' -const useVue2 = 'USE_VUE2' in process.env -if (!useVue2) { +const useVue3 = 'USE_VUE3' in process.env +if (useVue3) { Vue.configureCompat({ MODE: 2, ATTR_FALSE_VALUE: 'suppress-warning',