Skip to content

Commit

Permalink
chore(ci): add vue3 testing to pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
xanf committed Jan 29, 2022
1 parent 0934f74 commit 58054f1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Expand Up @@ -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
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,6 +4,7 @@
.vercel/
.vscode/
coverage/
coverage-vue3/
dist/
docs-dist/
esm/
Expand Down
10 changes: 5 additions & 5 deletions 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$',
Expand All @@ -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
},
Expand Down
4 changes: 2 additions & 2 deletions tests/setup.js
Expand Up @@ -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',
Expand Down

0 comments on commit 58054f1

Please sign in to comment.