Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .babelrc

This file was deleted.

7 changes: 6 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
module.exports = {
parserOptions: {
parser: '@typescript-eslint/parser',
},
extends: [
'./node_modules/kcd-scripts/eslint.js',
'plugin:vue/recommended',
'plugin:vue/vue3-recommended',
'plugin:testing-library/vue',
'prettier/vue',
],
plugins: ['vue'],
Expand All @@ -12,5 +16,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',
},
}
81 changes: 81 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -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]
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 }}
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align="center">
<h1>Vue Testing Library</h1>
<h1>Vue Testing Library for Vue 3</h1>

<br />

Expand Down Expand Up @@ -32,7 +32,6 @@
[![GitHub version][github-badge]][github]
[![npm version][npm-badge]][npm]
[![Discord][discord-badge]][discord]

[![MIT License][license-badge]][license]
<!-- prettier-ignore-end -->

Expand Down Expand Up @@ -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
Expand All @@ -76,10 +75,8 @@ Jest matchers][jest-dom].

```html
<template>
<div>
<p>Times clicked: {{ count }}</p>
<button @click="increment">increment</button>
</div>
<p>Times clicked: {{ count }}</p>
<button @click="increment">increment</button>
</template>

<script>
Expand Down Expand Up @@ -174,8 +171,7 @@ light-weight, simple, and understandable.

## Typings

The TypeScript type definitions are in the [DefinitelyTyped repo][types] and
bundled with Vue Testing Library.
The TypeScript type definitions are in the [types][types-directory] directory.

## ESLint support

Expand Down Expand Up @@ -235,10 +231,11 @@ instead of filing an issue on GitHub.
[![mediafreakch](https://avatars2.githubusercontent.com/u/777093?v=3&s=120)](https://github.com/mediafreakch)
[![afenton90](https://avatars2.githubusercontent.com/u/8963736?v=3&s=120)](https://github.com/afenton90)
[![cilice](https://avatars2.githubusercontent.com/u/835588?v=3&s=120)](https://github.com/cilice)
[![ITenthusiasm](https://avatars2.githubusercontent.com/u/47364027?v3&s=120)](https://github.com/ITenthusiasm)

<!-- prettier-ignore-start -->
[build-badge]: https://travis-ci.org/testing-library/vue-testing-library.svg?branch=master
[build]: https://travis-ci.org/testing-library/vue-testing-library
[build-badge]: https://img.shields.io/github/workflow/status/testing-library/vue-testing-library/validate?logo=github
[build]: https://github.com/testing-library/vue-testing-library/actions?query=workflow%3Avalidate
[coverage-badge]: https://img.shields.io/codecov/c/github/testing-library/vue-testing-library.svg
[coverage]: https://codecov.io/github/testing-library/vue-testing-library
[github-badge]: https://badge.fury.io/gh/testing-library%2Fvue-testing-library.svg
Expand All @@ -249,7 +246,6 @@ instead of filing an issue on GitHub.
[license]: https://github.com/testing-library/vue-testing-library/blob/master/LICENSE
[discord]: https://testing-library.com/discord
[discord-badge]: https://img.shields.io/discord/723559267868737556.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2&style=flat-square
[types]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/testing-library__vue
[jest-dom]: https://github.com/testing-library/jest-dom
[which-query]: https://testing-library.com/docs/guide-which-query
[guiding-principle]: https://twitter.com/kentcdodds/status/977018512689455106
Expand All @@ -263,10 +259,11 @@ instead of filing an issue on GitHub.
[add-issue-bug]: https://github.com/testing-library/vue-testing-library/issues/new?assignees=&labels=bug&template=bug_report.md&title=
[add-issue]: (https://github.com/testing-library/vue-testing-library/issues/new)

[types-directory]: https://github.com/testing-library/vue-testing-library/blob/master/types
[test-directory]: https://github.com/testing-library/vue-testing-library/blob/master/src/__tests__
[vuex-example]: https://github.com/testing-library/vue-testing-library/blob/master/src/__tests__/vuex.js
[vue-router-example]: https://github.com/testing-library/vue-testing-library/blob/master/src/__tests__/vue-router.js
[vee-validate-example]: https://github.com/testing-library/vue-testing-library/blob/master/src/__tests__/validate-plugin.js
[vue-i18n-example]: https://github.com/testing-library/vue-testing-library/blob/master/src/__tests__/vueI18n.js
[vue-i18n-example]: https://github.com/testing-library/vue-testing-library/blob/master/src/__tests__/vue-i18n.js
[vuetify-example]: https://github.com/testing-library/vue-testing-library/blob/master/src/__tests__/vuetify.js
<!-- prettier-ignore-end -->
14 changes: 14 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
sourceType: 'module',
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
esmodules: true,
},
},
],
],
}
34 changes: 34 additions & 0 deletions compatibility-scripts/vue-apollo-patch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// This patch is run from post-install script and it is a temporary hack until a pending PR is merged
// More details here:
// https://github.com/vuejs/vue-apollo/issues/1011
const fs = require('fs')
const path = require('path')

const useQueryPath = path.resolve(
__dirname,
'../node_modules/@vue/apollo-composable/dist/useQuery.js',
)

const vueApolloComposablePath = path.resolve(
__dirname,
'../node_modules/@vue/apollo-composable/dist/vue-apollo-composable.js',
)

fs.writeFileSync(
useQueryPath,
fs.readFileSync(useQueryPath, 'utf8').replace(/^onServerPrefetch, /mu, ''),
)

fs.writeFileSync(
useQueryPath,
fs
.readFileSync(useQueryPath, 'utf8')
.replace(/onServerPrefetch === null.*?\}\);/msu, ''),
)

fs.writeFileSync(
vueApolloComposablePath,
fs
.readFileSync(vueApolloComposablePath, 'utf8')
.replace(/vue_demi_5.onServerPrefetch === null.*?\}\);/msu, ''),
)
11 changes: 7 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ const config = require('kcd-scripts/jest')
module.exports = merge(config, {
testEnvironment: 'jsdom',
moduleFileExtensions: ['js', 'vue'],
moduleNameMapper: {
'@testing-library/vue': '<rootDir>/src/vue-testing-library.js',
},
coverageDirectory: './coverage',
collectCoverageFrom: ['**/src/**/*.js', '!**/src/__tests__/**'],
transform: {
Expand All @@ -15,8 +12,14 @@ module.exports = merge(config, {
},
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
testPathIgnorePatterns: [
'<rootDir>/node_modules',
'<rootDir>/node_modules/',
'<rootDir>/src/__tests__/components',
'<rootDir>/src/__tests__/directives',
],
moduleNameMapper: {
'@vue/apollo-composable': [
'<rootDir>/node_modules/@vue/apollo-composable/dist/index.js',
],
},
transformIgnorePatterns: ['node_modules/(?!(@vue/apollo-composable)/)'],
})
Loading