diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 6849ed4f..00000000 --- a/.babelrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "presets": [ - ["@babel/env"] - ], - "plugins": [ - "@babel/plugin-transform-runtime" - ] -} \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js index dbdbf706..acb83293 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,7 +4,8 @@ module.exports = { }, extends: [ './node_modules/kcd-scripts/eslint.js', - 'plugin:vue/recommended', + 'plugin:vue/vue3-recommended', + 'plugin:testing-library/vue', 'prettier', ], plugins: ['vue'], @@ -17,8 +18,8 @@ module.exports = { 'testing-library/prefer-screen-queries': 'off', 'testing-library/no-manual-cleanup': 'off', 'testing-library/no-await-sync-events': 'off', - 'testing-library/await-fire-event': 'error', 'testing-library/prefer-user-event': 'off', 'testing-library/no-node-access': 'off', + 'testing-library/await-fire-event': 'off', }, } diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index fb224957..afb9a077 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -32,6 +32,9 @@ jobs: uses: bahmutov/npm-install@v1 with: useLockFile: false + # Needed because @vue/apollo-composable requires @vue/composition-api + # which has a peerDep on Vue 2. + install-command: npm i --legacy-peer-deps - name: ▶️ Run validate script run: npm run validate diff --git a/README.md b/README.md index d37f3b78..ebbd41b7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
-

Vue Testing Library

+

Vue Testing Library for Vue 3


@@ -15,11 +15,6 @@

Simple and complete Vue.js testing utilities that encourage good testing practices.

Vue Testing Library is a lightweight adapter built on top of DOM Testing Library and @vue/test-utils.

- - -
- -

If you're looking for the Vue 3 version of Vue Testing Library, check out the next branch.


@@ -66,30 +61,29 @@ This module is distributed via `npm` and should be installed as one of your project's `devDependencies`: -If using Vue 2 -``` -npm install --save-dev @testing-library/vue@5 -``` - -If using Vue 3 ``` 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 `@testing-library/jest-dom` so you can -use [the custom Jest matchers][jest-dom]. +You may also be interested in installing `jest-dom` so you can use [the custom +Jest matchers][jest-dom]. + +If you're using Vue 2, please install version 5 of the library: + +``` +npm install --save-dev @testing-library/vue@^5 +``` + ## A basic example ```html diff --git a/src/__tests__/components/Card.vue b/src/__tests__/components/Card.vue index 9174e499..c62ee1b4 100644 --- a/src/__tests__/components/Card.vue +++ b/src/__tests__/components/Card.vue @@ -1,22 +1,6 @@ - - diff --git a/src/__tests__/components/Collapsible.vue b/src/__tests__/components/Collapsible.vue index 33766853..120db8eb 100644 --- a/src/__tests__/components/Collapsible.vue +++ b/src/__tests__/components/Collapsible.vue @@ -15,7 +15,7 @@ export default { } }, methods: { - handleClick(e) { + handleClick(_) { this.displayElement = !this.displayElement }, }, diff --git a/src/__tests__/components/Form.vue b/src/__tests__/components/Form.vue index db3593ff..c3ee7452 100644 --- a/src/__tests__/components/Form.vue +++ b/src/__tests__/components/Form.vue @@ -1,65 +1,51 @@