Skip to content

Commit be4033e

Browse files
authored
chore: format code with Prettier (#1111)
1 parent ade4398 commit be4033e

File tree

326 files changed

+3004
-3157
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

326 files changed

+3004
-3157
lines changed

Diff for: .eslintrc

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"rules": {
1616
"no-debugger": 2,
1717
"no-proto": 0,
18-
"max-len": 2
18+
"space-before-function-paren": 0,
19+
"object-curly-spacing": 0,
20+
"indent": 0
1921
}
2022
}

Diff for: .github/CONTRIBUTING.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Hi! I’m really excited that you are interested in contributing to Vue Test Uti
2525
- Make sure `npm test` passes. (see [development setup](#development-setup))
2626

2727
- If adding new feature:
28+
2829
- Add accompanying test case.
2930
- Provide convincing reason to add this feature. Ideally you should open a suggestion issue first and have it greenlighted before working on it.
3031

@@ -41,7 +42,7 @@ Vue Test Utils is a monorepo. It contains a root package.json for running script
4142

4243
After cloning the repo, run:
4344

44-
``` bash
45+
```bash
4546
$ yarn
4647
```
4748

@@ -50,9 +51,10 @@ Or with npm:
5051
```bash
5152
npm i && npm run bootstrap
5253
```
54+
5355
### Commonly used NPM scripts
5456

55-
``` bash
57+
```bash
5658
# run unit tests with mocha-webpack
5759
$ npm run test:unit
5860

@@ -90,4 +92,4 @@ The default test script will do the following: lint with ESLint -> type check wi
9092

9193
- **`types`**: contains TypeScript type definitions
9294

93-
- **`test`**: type definitions tests
95+
- **`test`**: type definitions tests

Diff for: .prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package.json
2+
package-lock.json
3+
**/dist/**
4+
CHANGELOG.md

Diff for: README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
This repository provides the following two packages.
66
They are currently in beta.
77

8-
* [Vue Test Utils](./packages/test-utils)
9-
* [Vue Server Test Utils](./packages/server-test-utils)
8+
- [Vue Test Utils](./packages/test-utils)
9+
- [Vue Server Test Utils](./packages/server-test-utils)
1010

1111
You can install these packages by the following command.
1212

@@ -16,6 +16,7 @@ npm install --save-dev @vue/server-test-utils
1616
```
1717

1818
## Peer Dependencies
19+
1920
You need to install `vue-template-compiler` which is used to compile components. It should be the same version as the version of Vue you are using.
2021

2122
```

Diff for: docs/.vuepress/config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ module.exports = {
128128
'/ru/api/options',
129129
'/ru/api/components/'
130130
]
131-
},
131+
}
132132
}
133133
},
134134
markdown: {

Diff for: docs/README.md

+67-67
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22

33
Vue Test Utils is the official unit testing utility library for Vue.js.
44

5-
* [Guides](./guides/)
6-
* [Getting Started](./guides/getting-started.md)
7-
* [Common Tips](guides/common-tips.md)
8-
* [Mouse, Key and other DOM Events](guides/dom-events.md)
9-
* [Choosing a test runner](guides/choosing-a-test-runner.md)
10-
* [Testing Single-File Components with Jest](guides/testing-single-file-components-with-jest.md)
11-
* [Testing Single-File Components with Mocha + webpack](guides/testing-single-file-components-with-mocha-webpack.md)
12-
* [Testing Single-File Components with Karma](guides/testing-single-file-components-with-karma.md)
13-
* [Testing Asynchronous Behavior](guides/testing-async-components.md)
14-
* [Using with TypeScript](guides/using-with-typescript.md)
15-
* [Using with Vue Router](guides/using-with-vue-router.md)
16-
* [Using with Vuex](guides/using-with-vuex.md)
17-
* [API](api/)
18-
* [mount](api/mount.md)
19-
* [shallowMount](api/shallowMount.md)
20-
* [render](api/render.md)
21-
* [renderToString](api/renderToString.md)
22-
* [Mounting Options](api/options.md)
5+
- [Guides](./guides/)
6+
- [Getting Started](./guides/getting-started.md)
7+
- [Common Tips](guides/common-tips.md)
8+
- [Mouse, Key and other DOM Events](guides/dom-events.md)
9+
- [Choosing a test runner](guides/choosing-a-test-runner.md)
10+
- [Testing Single-File Components with Jest](guides/testing-single-file-components-with-jest.md)
11+
- [Testing Single-File Components with Mocha + webpack](guides/testing-single-file-components-with-mocha-webpack.md)
12+
- [Testing Single-File Components with Karma](guides/testing-single-file-components-with-karma.md)
13+
- [Testing Asynchronous Behavior](guides/testing-async-components.md)
14+
- [Using with TypeScript](guides/using-with-typescript.md)
15+
- [Using with Vue Router](guides/using-with-vue-router.md)
16+
- [Using with Vuex](guides/using-with-vuex.md)
17+
- [API](api/)
18+
- [mount](api/mount.md)
19+
- [shallowMount](api/shallowMount.md)
20+
- [render](api/render.md)
21+
- [renderToString](api/renderToString.md)
22+
- [Mounting Options](api/options.md)
2323
- [context](api/options.md#context)
2424
- [slots](api/options.md#slots)
2525
- [scopedSlots](api/options.md#scopedslots)
@@ -34,52 +34,52 @@ Vue Test Utils is the official unit testing utility library for Vue.js.
3434
- [provide](api/options.md#provide)
3535
- [sync](api/options.md#sync)
3636
- [other options](api/options.md#other-options)
37-
* [Wrapper](api/wrapper/)
38-
* [attributes](api/wrapper/attributes.md)
39-
* [classes](api/wrapper/classes.md)
40-
* [contains](api/wrapper/contains.md)
41-
* [emitted](api/wrapper/emitted.md)
42-
* [emittedByOrder](api/wrapper/emittedByOrder.md)
43-
* [exists](api/wrapper/exists.md)
44-
* [destroy](api/wrapper/destroy.md)
45-
* [find](api/wrapper/find.md)
46-
* [findAll](api/wrapper/findAll.md)
47-
* [html](api/wrapper/html.md)
48-
* [is](api/wrapper/is.md)
49-
* [isEmpty](api/wrapper/isEmpty.md)
50-
* [isVueInstance](api/wrapper/isVueInstance.md)
51-
* [name](api/wrapper/name.md)
52-
* [props](api/wrapper/props.md)
53-
* [setChecked](api/wrapper/setChecked.md)
54-
* [setData](api/wrapper/setData.md)
55-
* [setMethods](api/wrapper/setMethods.md)
56-
* [setProps](api/wrapper/setProps.md)
57-
* [setSelected](api/wrapper/setSelected.md)
58-
* [setValue](api/wrapper/setValue.md)
59-
* [text](api/wrapper/text.md)
60-
* [trigger](api/wrapper/trigger.md)
61-
* [isVisible](api/wrapper/isVisible.md)
62-
* [WrapperArray](api/wrapper-array/)
63-
* [at](api/wrapper-array/at.md)
64-
* [contains](api/wrapper-array/contains.md)
65-
* [exists](api/wrapper/exists.md)
66-
* [destroy](api/wrapper-array/destroy.md)
67-
* [filter](api/wrapper-array/filter.md)
68-
* [is](api/wrapper-array/is.md)
69-
* [isEmpty](api/wrapper-array/isEmpty.md)
70-
* [isVueInstance](api/wrapper-array/isVueInstance.md)
71-
* [setChecked](api/wrapper-array/setChecked.md)
72-
* [setData](api/wrapper-array/setData.md)
73-
* [setMethods](api/wrapper-array/setMethods.md)
74-
* [setProps](api/wrapper-array/setProps.md)
75-
* [setValue](api/wrapper-array/setValue.md)
76-
* [trigger](api/wrapper-array/trigger.md)
77-
* [isVisible](api/wrapper-array/isVisible.md)
78-
* [components](api/components/)
79-
* [TransitionStub](api/components/TransitionStub.md)
80-
* [TransitionGroupStub](api/components/TransitionGroupStub.md)
81-
* [RouterLinkStub](api/components/RouterLinkStub.md)
82-
* [Selectors](api/selectors.md)
83-
* [createWrapper](api/createWrapper.md)
84-
* [createLocalVue](api/createLocalVue.md)
85-
* [config](api/config.md)
37+
- [Wrapper](api/wrapper/)
38+
- [attributes](api/wrapper/attributes.md)
39+
- [classes](api/wrapper/classes.md)
40+
- [contains](api/wrapper/contains.md)
41+
- [emitted](api/wrapper/emitted.md)
42+
- [emittedByOrder](api/wrapper/emittedByOrder.md)
43+
- [exists](api/wrapper/exists.md)
44+
- [destroy](api/wrapper/destroy.md)
45+
- [find](api/wrapper/find.md)
46+
- [findAll](api/wrapper/findAll.md)
47+
- [html](api/wrapper/html.md)
48+
- [is](api/wrapper/is.md)
49+
- [isEmpty](api/wrapper/isEmpty.md)
50+
- [isVueInstance](api/wrapper/isVueInstance.md)
51+
- [name](api/wrapper/name.md)
52+
- [props](api/wrapper/props.md)
53+
- [setChecked](api/wrapper/setChecked.md)
54+
- [setData](api/wrapper/setData.md)
55+
- [setMethods](api/wrapper/setMethods.md)
56+
- [setProps](api/wrapper/setProps.md)
57+
- [setSelected](api/wrapper/setSelected.md)
58+
- [setValue](api/wrapper/setValue.md)
59+
- [text](api/wrapper/text.md)
60+
- [trigger](api/wrapper/trigger.md)
61+
- [isVisible](api/wrapper/isVisible.md)
62+
- [WrapperArray](api/wrapper-array/)
63+
- [at](api/wrapper-array/at.md)
64+
- [contains](api/wrapper-array/contains.md)
65+
- [exists](api/wrapper/exists.md)
66+
- [destroy](api/wrapper-array/destroy.md)
67+
- [filter](api/wrapper-array/filter.md)
68+
- [is](api/wrapper-array/is.md)
69+
- [isEmpty](api/wrapper-array/isEmpty.md)
70+
- [isVueInstance](api/wrapper-array/isVueInstance.md)
71+
- [setChecked](api/wrapper-array/setChecked.md)
72+
- [setData](api/wrapper-array/setData.md)
73+
- [setMethods](api/wrapper-array/setMethods.md)
74+
- [setProps](api/wrapper-array/setProps.md)
75+
- [setValue](api/wrapper-array/setValue.md)
76+
- [trigger](api/wrapper-array/trigger.md)
77+
- [isVisible](api/wrapper-array/isVisible.md)
78+
- [components](api/components/)
79+
- [TransitionStub](api/components/TransitionStub.md)
80+
- [TransitionGroupStub](api/components/TransitionGroupStub.md)
81+
- [RouterLinkStub](api/components/RouterLinkStub.md)
82+
- [Selectors](api/selectors.md)
83+
- [createWrapper](api/createWrapper.md)
84+
- [createLocalVue](api/createLocalVue.md)
85+
- [config](api/config.md)

Diff for: docs/api/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
!!!include(docs/api/selectors.md)!!!
88
!!!include(docs/api/createLocalVue.md)!!!
99
!!!include(docs/api/createWrapper.md)!!!
10-
!!!include(docs/api/config.md)!!!
10+
!!!include(docs/api/config.md)!!!

Diff for: docs/api/components/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ Vue Test Utils includes utility components you can use to stub components.
44

55
!!!include(docs/api/components/RouterLinkStub.md)!!!
66
!!!include(docs/api/components/TransitionStub.md)!!!
7-
!!!include(docs/api/components/TransitionGroupStub.md)!!!
7+
!!!include(docs/api/components/TransitionGroupStub.md)!!!

Diff for: docs/api/components/TransitionGroupStub.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A component to stub the `transition-group` component. Instead of performing transitions asynchronously, it returns the child components synchronously.
44

5-
This is set to stub all `transition-group` components by default in the Vue Test Utils config. To use the built-in `transition-group` component set `config.stubs['transition-group']` to false:
5+
This is set to stub all `transition-group` components by default in the Vue Test Utils config. To use the built-in `transition-group` component set `config.stubs['transition-group']` to false:
66

77
```js
88
import { config } from '@vue/test-utils'
@@ -28,4 +28,4 @@ mount(Component, {
2828
'transition-group': TransitionGroupStub
2929
}
3030
})
31-
```
31+
```

Diff for: docs/api/components/TransitionStub.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ config.stubs.transition = false
1111
```
1212

1313
To reset it to stub `transition` components:
14+
1415
```js
1516
import { config, TransitionStub } from '@vue/test-utils'
1617

Diff for: docs/api/config.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ Vue Test Utils includes a config object to defined options used by Vue Test Util
77
### `stubs`
88

99
- type: `{ [name: string]: Component | boolean | string }`
10-
- default: `{
11-
transition: TransitionStub,
12-
'transition-group': TransitionGroupStub
13-
}`
10+
- default: `{ transition: TransitionStub, 'transition-group': TransitionGroupStub }`
1411

1512
The stub stored in `config.stubs` is used by default.
1613
Stubs to use in components. These are overwritten by `stubs` passed in the mounting options.

Diff for: docs/api/createLocalVue.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## createLocalVue()
22

33
- **Returns:**
4+
45
- `{Component}`
56

67
- **Usage:**

Diff for: docs/api/createWrapper.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- `{Boolean} attachedToDocument`
99

1010
- **Returns:**
11+
1112
- `{Wrapper}`
1213

1314
- **Usage:**
@@ -23,4 +24,3 @@ const vm = new Constructor().$mount()
2324
const wrapper = createWrapper(vm)
2425
expect(wrapper.vm.foo).toBe(true)
2526
```
26-

Diff for: docs/api/mount.md

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ describe('Foo', () => {
6262
})
6363
})
6464
```
65+
6566
**Default and named slots:**
6667

6768
```js

Diff for: docs/api/options.md

+12-14
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ You can also pass a function that takes the props as an argument:
9999
```js
100100
shallowMount(Component, {
101101
scopedSlots: {
102-
foo: function (props) {
102+
foo: function(props) {
103103
return this.$createElement('div', props.index)
104104
}
105105
}
@@ -111,8 +111,8 @@ Or you can use JSX. If you write JSX in a method, `this.$createElement` is auto-
111111
```js
112112
shallowMount(Component, {
113113
scopedSlots: {
114-
foo (props) {
115-
return <div>{ props.text }</div>
114+
foo(props) {
115+
return <div>{props.text}</div>
116116
}
117117
}
118118
})
@@ -179,9 +179,7 @@ import Foo from './Foo.vue'
179179
const localVue = createLocalVue()
180180
localVue.use(VueRouter)
181181

182-
const routes = [
183-
{ path: '/foo', component: Foo }
184-
]
182+
const routes = [{ path: '/foo', component: Foo }]
185183

186184
const router = new VueRouter({
187185
routes
@@ -228,11 +226,11 @@ const wrapper = mount(Component, {
228226
expect(wrapper.text()).toBe('aBC')
229227
```
230228

231-
::: tip
232-
It's worth noting that `propsData` is actually a [Vue API](https://vuejs.org/v2/api/#propsData), not a
229+
::: tip
230+
It's worth noting that `propsData` is actually a [Vue API](https://vuejs.org/v2/api/#propsData), not a
233231
Vue Test Utils mounting option. It is processed through [`extends`](https://vuejs.org/v2/api/#extends).
234232
Please see [Other options](#other-options).
235-
:::
233+
:::
236234

237235
## listeners
238236

@@ -273,7 +271,7 @@ const Component = {
273271

274272
const wrapper = shallowMount(Component, {
275273
provide: {
276-
foo () {
274+
foo() {
277275
return 'fooValue'
278276
}
279277
}
@@ -298,20 +296,20 @@ When the options for `mount` and `shallowMount` contain the options other than t
298296
const Component = {
299297
template: '<div>{{ foo() }}{{ bar() }}{{ baz() }}</div>',
300298
methods: {
301-
foo () {
299+
foo() {
302300
return 'a'
303301
},
304-
bar () {
302+
bar() {
305303
return 'b'
306304
}
307305
}
308306
}
309307
const options = {
310308
methods: {
311-
bar () {
309+
bar() {
312310
return 'B'
313311
},
314-
baz () {
312+
baz() {
315313
return 'C'
316314
}
317315
}

Diff for: docs/api/render.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
- `{Object} context`
88
- `{Array<Component|Object>|Component} children`
99
- `{Object} slots`
10-
- `{Array<Component|Object>|Component|String} default`
11-
- `{Array<Component|Object>|Component|String} named`
10+
- `{Array<Component|Object>|Component|String} default`
11+
- `{Array<Component|Object>|Component|String} named`
1212
- `{Object} mocks`
1313
- `{Object|Array<string>} stubs`
1414
- `{Vue} localVue`

0 commit comments

Comments
 (0)