From e387f0c38f1efe4518d7d4482a90442198b50d6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Fontcuberta?= Date: Fri, 20 Nov 2020 20:15:08 +0100 Subject: [PATCH 1/2] Port updates from main branch to next --- .eslintrc.js | 4 +- .github/workflows/validate.yml | 81 ++++++++++++++++++++++ .travis.yml | 28 -------- README.md | 16 ++--- package.json | 14 ++-- src/__tests__/components/Button.vue | 8 +-- src/__tests__/components/Form.vue | 71 ++++++++++--------- src/__tests__/components/NumberDisplay.vue | 14 ++-- src/__tests__/components/Select.vue | 4 +- src/__tests__/debug.js | 16 +++++ src/__tests__/fire-event.js | 34 +++++++++ src/__tests__/form.js | 3 + src/__tests__/user-event.js | 72 +++++++++++++++++++ src/vue-testing-library.js | 20 +++++- 14 files changed, 287 insertions(+), 98 deletions(-) create mode 100644 .github/workflows/validate.yml delete mode 100644 .travis.yml create mode 100644 src/__tests__/user-event.js diff --git a/.eslintrc.js b/.eslintrc.js index cf2c75f3..356e7ed8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,7 +1,8 @@ module.exports = { extends: [ './node_modules/kcd-scripts/eslint.js', - 'plugin:vue/recommended', + 'plugin:vue/vue3-recommended', + 'plugin:testing-library/vue', 'prettier/vue', ], plugins: ['vue'], @@ -12,5 +13,6 @@ module.exports = { 'testing-library/no-dom-import': 'off', 'testing-library/prefer-screen-queries': 'off', 'testing-library/no-manual-cleanup': 'off', + 'testing-library/no-await-sync-events': 'off', }, } diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 00000000..12db9d29 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,81 @@ +name: validate +on: + push: + branches: + [ + '+([0-9])?(.{+([0-9]),x}).x', + 'master', + 'next', + 'next-major', + 'beta', + 'alpha', + '!all-contributors/**', + ] + pull_request: + branches-ignore: ['all-contributors/**'] +jobs: + main: + strategy: + matrix: + node: [10.13, 12, 14, 15] + runs-on: ubuntu-latest + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v2 + + - name: ⎔ Setup node + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - name: 📥 Download deps + uses: bahmutov/npm-install@v1 + with: + useLockFile: false + + - name: ▶️ Run validate script + run: npm run validate + + - name: ⬆️ Upload coverage report + uses: codecov/codecov-action@v1 + + release: + needs: main + runs-on: ubuntu-latest + if: + ${{ github.repository == 'testing-library/vue-testing-library' && + contains('refs/heads/master,refs/heads/beta,refs/heads/next,refs/heads/alpha', + github.ref) && github.event_name == 'push' }} + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v2 + + - name: ⎔ Setup node + uses: actions/setup-node@v1 + with: + node-version: 14 + + - name: 📥 Download deps + uses: bahmutov/npm-install@v1 + with: + useLockFile: false + + - name: 🏗 Run build script + run: npm run build + + - name: 🚀 Release + uses: cycjimmy/semantic-release-action@v2 + with: + semantic_version: 17 + branches: | + [ + '+([0-9])?(.{+([0-9]),x}).x', + 'master', + 'next', + 'next-major', + {name: 'beta', prerelease: true}, + {name: 'alpha', prerelease: true} + ] + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 91989b6d..00000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -sudo: false -language: node_js -cache: npm -notifications: - email: false -node_js: - - 10.18 - - 12 - - 14 - - 15 -before_install: - - nvm install-latest-npm -install: npm install -script: - - npm run validate - - npx codecov@3 -branches: - only: - - master - - beta - - next - -jobs: - include: - - stage: release - node_js: 14 - script: kcd-scripts travis-release - if: fork = false diff --git a/README.md b/README.md index 735f0594..077ed5d3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
-

Vue Testing Library

+

Vue Testing Library for Vue 3


@@ -32,7 +32,6 @@ [![GitHub version][github-badge]][github] [![npm version][npm-badge]][npm] [![Discord][discord-badge]][discord] - [![MIT License][license-badge]][license] @@ -66,7 +65,7 @@ project's `devDependencies`: npm install --save-dev @testing-library/vue ``` -This library has `peerDependencies` listings for `Vue` and +This library has `peerDependencies` listings for `Vue 3` and `vue-template-compiler`. You may also be interested in installing `jest-dom` so you can use [the custom @@ -76,10 +75,8 @@ Jest matchers][jest-dom]. ```html diff --git a/src/__tests__/components/Form.vue b/src/__tests__/components/Form.vue index 809bf316..ffa729f2 100644 --- a/src/__tests__/components/Form.vue +++ b/src/__tests__/components/Form.vue @@ -1,44 +1,42 @@