Skip to content

Commit daa82e4

Browse files
committed
Rename main file to properly get types
1 parent c231627 commit daa82e4

33 files changed

+39
-242
lines changed

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
module.exports = {
2+
parserOptions: {
3+
parser: '@typescript-eslint/parser',
4+
},
25
extends: [
36
'./node_modules/kcd-scripts/eslint.js',
47
'plugin:vue/vue3-recommended',

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ light-weight, simple, and understandable.
171171

172172
## Typings
173173

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

177176
## ESLint support
178177

@@ -247,7 +246,6 @@ instead of filing an issue on GitHub.
247246
[license]: https://github.com/testing-library/vue-testing-library/blob/master/LICENSE
248247
[discord]: https://testing-library.com/discord
249248
[discord-badge]: https://img.shields.io/discord/723559267868737556.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2&style=flat-square
250-
[types]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/testing-library__vue
251249
[jest-dom]: https://github.com/testing-library/jest-dom
252250
[which-query]: https://testing-library.com/docs/guide-which-query
253251
[guiding-principle]: https://twitter.com/kentcdodds/status/977018512689455106
@@ -261,6 +259,7 @@ instead of filing an issue on GitHub.
261259
[add-issue-bug]: https://github.com/testing-library/vue-testing-library/issues/new?assignees=&labels=bug&template=bug_report.md&title=
262260
[add-issue]: (https://github.com/testing-library/vue-testing-library/issues/new)
263261

262+
[types-directory]: https://github.com/testing-library/vue-testing-library/blob/master/types
264263
[test-directory]: https://github.com/testing-library/vue-testing-library/blob/master/src/__tests__
265264
[vuex-example]: https://github.com/testing-library/vue-testing-library/blob/master/src/__tests__/vuex.js
266265
[vue-router-example]: https://github.com/testing-library/vue-testing-library/blob/master/src/__tests__/vue-router.js

jest.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ const config = require('kcd-scripts/jest')
44
module.exports = merge(config, {
55
testEnvironment: 'jsdom',
66
moduleFileExtensions: ['js', 'vue'],
7-
moduleNameMapper: {
8-
'@testing-library/vue': '<rootDir>/src/vue-testing-library.js',
9-
},
107
coverageDirectory: './coverage',
118
collectCoverageFrom: ['**/src/**/*.js', '!**/src/__tests__/**'],
129
transform: {

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,23 @@
22
"name": "@testing-library/vue",
33
"version": "0.0.0-semantically-released",
44
"description": "Simple and complete Vue DOM testing utilities that encourage good testing practices.",
5-
"main": "dist/vue-testing-library.js",
5+
"main": "dist/index.js",
6+
"types": "types/index.d.ts",
67
"scripts": {
78
"format": "kcd-scripts format",
89
"build": "kcd-scripts build",
910
"lint": "kcd-scripts lint",
1011
"test": "kcd-scripts test",
1112
"test:update": "npm test -- --updateSnapshot --coverage",
1213
"validate": "kcd-scripts validate",
14+
"typecheck": "dtslint ./types/",
1315
"setup": "npm install && npm run validate -s"
1416
},
1517
"engines": {
1618
"node": ">10.18"
1719
},
1820
"files": [
21+
"types",
1922
"dist",
2023
"cleanup-after-each.js"
2124
],
@@ -53,11 +56,13 @@
5356
"@babel/plugin-transform-runtime": "^7.12.1",
5457
"@testing-library/jest-dom": "^5.11.5",
5558
"@testing-library/user-event": "^12.2.2",
59+
"@types/estree": "0.0.45",
5660
"@vue/compiler-sfc": "^3.0.2",
5761
"apollo-boost": "^0.4.9",
5862
"apollo-cache-inmemory": "^1.6.6",
5963
"apollo-client": "^2.6.10",
6064
"axios": "^0.20.0",
65+
"dtslint": "^4.0.6",
6166
"eslint-plugin-vue": "^7.1.0",
6267
"graphql": "^15.4.0",
6368
"graphql-tag": "^2.11.0",

src/__tests__/auto-cleanup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {render} from '@testing-library/vue'
1+
import {render} from '..'
22
import '@testing-library/jest-dom'
33

44
// This verifies that by importing VTL in an environment which supports

src/__tests__/axios-mock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import '@testing-library/jest-dom'
22
import axiosMock from 'axios'
3-
import {render, fireEvent} from '@testing-library/vue'
3+
import {render, fireEvent} from '..'
44
import Component from './components/Fetch.vue'
55

66
test('mocks an API call when load-greeting is clicked', async () => {

src/__tests__/cleanup-throw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
test.todo('check if this test still makes sense')
22

3-
// import {render, cleanup} from '@testing-library/vue'
3+
// import {render, cleanup} from '..'
44
// import {nextTick} from 'vue'
55

66
// test('cleanup re-throws errors from async lifecycle hooks', async () => {

src/__tests__/debug.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable testing-library/no-debug */
2-
import {render} from '@testing-library/vue'
2+
import {render} from '..'
33
import HelloWorld from './components/HelloWorld'
44

55
beforeEach(() => {

src/__tests__/directive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {render} from '@testing-library/vue'
1+
import {render} from '..'
22
import '@testing-library/jest-dom'
33
import {uppercaseDirective} from './directives/uppercase-directive'
44
import ComponentUsingDirective from './components/Directive'

src/__tests__/disappearance.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {render, waitForElementToBeRemoved} from '@testing-library/vue'
1+
import {render, waitForElementToBeRemoved} from '..'
22
import Disappearance from './components/Disappearance'
33
import '@testing-library/jest-dom'
44

src/__tests__/fire-event.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {h} from 'vue'
2-
import {render, fireEvent} from '@testing-library/vue'
2+
import {render, fireEvent} from '..'
33
import Button from './components/Button'
44

55
const eventTypes = [

src/__tests__/form.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {render, fireEvent} from '@testing-library/vue'
1+
import {render, fireEvent} from '..'
22
import '@testing-library/jest-dom'
33
import Form from './components/Form'
44

src/__tests__/functional.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {render} from '@testing-library/vue'
1+
import {render} from '..'
22
import '@testing-library/jest-dom'
33
import {h} from 'vue'
44

src/__tests__/render.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {render} from '@testing-library/vue'
1+
import {render} from '..'
22
import '@testing-library/jest-dom'
33

44
test('baseElement defaults to document.body', () => {

src/__tests__/rerender.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import '@testing-library/jest-dom'
22
import {defineComponent, h, computed} from 'vue'
3-
import {render} from '@testing-library/vue'
3+
import {render} from '..'
44
import NumberDisplay from './components/NumberDisplay'
55

66
// It'd probably be better if you test the component that's doing the rerendering

src/__tests__/select.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {render, fireEvent} from '@testing-library/vue'
1+
import {render, fireEvent} from '..'
22
import '@testing-library/jest-dom'
33
import Select from './components/Select'
44

src/__tests__/simple-button.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {render, fireEvent} from '@testing-library/vue'
1+
import {render, fireEvent} from '..'
22
import Button from './components/Button'
33
import '@testing-library/jest-dom'
44

src/__tests__/slots.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import '@testing-library/jest-dom'
2-
import {render} from '@testing-library/vue'
2+
import {render} from '..'
33
import Card from './components/Card'
44

55
// Usage is the same as Vue Test Utils, since slots values are passed using the `slots`

src/__tests__/stopwatch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import '@testing-library/jest-dom'
2-
import {render, waitFor, fireEvent} from '@testing-library/vue'
2+
import {render, waitFor, fireEvent} from '..'
33
import StopWatch from './components/StopWatch.vue'
44

55
const sleep = ms =>

src/__tests__/stubs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {render} from '@testing-library/vue'
1+
import {render} from '..'
22
import '@testing-library/jest-dom'
33
import Stubs from './components/Stubs'
44

src/__tests__/user-event.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import '@testing-library/jest-dom'
2-
import {render} from '@testing-library/vue'
2+
import {render} from '..'
33
import userEvent from '@testing-library/user-event'
44
import Form from './components/Form'
55
import Select from './components/Select'

src/__tests__/validate-plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import '@testing-library/jest-dom'
22

3-
import {render, fireEvent} from '@testing-library/vue'
3+
import {render, fireEvent} from '..'
44
import VeeValidate from './components/Validate'
55

66
test('can validate using plugin', async () => {

src/__tests__/visibility.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {render, fireEvent} from '@testing-library/vue'
1+
import {render, fireEvent} from '..'
22
import '@testing-library/jest-dom'
33
import Collapsible from './components/Collapsible'
44

src/__tests__/vue-apollo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
test.todo('Your test suite must contain at least one test.')
22
// import '@testing-library/jest-dom'
33
// import fetch from 'isomorphic-unfetch'
4-
// import {render, fireEvent, screen} from '@testing-library/vue'
4+
// import {render, fireEvent, screen} from '..'
55
// import VueApollo from 'vue-apollo'
66
// import {InMemoryCache} from 'apollo-cache-inmemory'
77
// import ApolloClient from 'apollo-boost'

src/__tests__/vue-i18n.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import '@testing-library/jest-dom'
2-
import {render, fireEvent} from '@testing-library/vue'
2+
import {render, fireEvent} from '..'
33
import {createI18n} from 'vue-i18n'
44
import Translations from './components/Translations'
55

src/__tests__/vue-portal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
test.todo('Your test suite must contain at least one test.')
22

3-
// import {render, waitFor} from '@testing-library/vue'
3+
// import {render, waitFor} from '..'
44
// import '@testing-library/jest-dom/extend-expect'
55
// import PortalVue from 'portal-vue'
66

src/__tests__/vue-router-mocha.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
test.todo('Your test suite must contain at least one test.')
22

33
// import '@testing-library/jest-dom'
4-
// import {render} from '@testing-library/vue'
4+
// import {render} from '..'
55

66
// import About from './components/Router/About.vue'
77

src/__tests__/vue-router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ test.todo('Your test suite must contain at least one test.')
55
// // Related issue on Vue Test Utils: https://github.com/vuejs/vue-test-utils-next/issues/152
66

77
// import '@testing-library/jest-dom'
8-
// import {render, fireEvent} from '@testing-library/vue'
8+
// import {render, fireEvent} from '..'
99
// import App from './components/Router/App.vue'
1010
// import Home from './components/Router/Home.vue'
1111
// import About from './components/Router/About.vue'

src/__tests__/vueI18n.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
test.todo('Your test suite must contain at least one test.')
22

33
// import '@testing-library/jest-dom'
4-
// import {render, fireEvent} from '@testing-library/vue'
4+
// import {render, fireEvent} from '..'
55
// import Vuei18n from 'vue-i18n'
66
// import VueI18n from './components/VueI18n'
77

src/__tests__/vuetify.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
test.todo('Your test suite must contain at least one test.')
22
// import '@testing-library/jest-dom'
33
// import Vue from 'vue'
4-
// import {render, fireEvent} from '@testing-library/vue'
4+
// import {render, fireEvent} from '..'
55
// import Vuetify from 'vuetify'
66
// import VuetifyDemoComponent from './components/Vuetify'
77

src/__tests__/vuex.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import '@testing-library/jest-dom'
2-
import {render, fireEvent} from '@testing-library/vue'
2+
import {render, fireEvent} from '..'
33
import VuexTest from './components/Store/VuexTest'
44
import {store} from './components/Store/store'
55

src/__tests__/within.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {render, within} from '@testing-library/vue'
1+
import {render, within} from '..'
22

33
test('within() returns an object with all queries bound to the DOM node', () => {
44
const {getByTestId, getByText} = render({

0 commit comments

Comments
 (0)