Skip to content

refactor: silentWarnings -> silent #727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 17, 2018
Merged
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
4 changes: 2 additions & 2 deletions docs/api/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ import VueTestUtils from '@vue/test-utils'
VueTestUtils.config.logModifiedComponents = false
```

### `silentWarnings`
### `silent`

- type: `Boolean`
- default: `true`
Expand All @@ -106,5 +106,5 @@ Example:
```js
import VueTestUtils from '@vue/test-utils'

VueTestUtils.config.silentWarnings = false
VueTestUtils.config.silent = false
```
1 change: 1 addition & 0 deletions packages/server-test-utils/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ interface VueTestUtilsConfigOptions {
methods?: Record<string, Function>
provide?: object,
logModifiedComponents?: Boolean
silent?: Boolean
}

export declare let config: VueTestUtilsConfigOptions
Expand Down
2 changes: 2 additions & 0 deletions packages/server-test-utils/types/test/renderToString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ config.methods = {
config.provide = {
foo: {}
}
config.logModifiedComponents = true
config.silent = true
2 changes: 1 addition & 1 deletion packages/test-utils/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ export default {
methods: {},
provide: {},
logModifiedComponents: true,
silentWarnings: true
silent: true
}
2 changes: 1 addition & 1 deletion packages/test-utils/src/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ export default class Wrapper implements BaseWrapper {
*/
setProps (data: Object) {
const originalConfig = Vue.config.silent
Vue.config.silent = config.silentWarnings
Vue.config.silent = config.silent
if (this.isFunctionalComponent) {
throwError(
`wrapper.setProps() cannot be called on a ` +
Expand Down
1 change: 1 addition & 0 deletions packages/test-utils/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ interface VueTestUtilsConfigOptions {
methods?: Record<string, Function>
provide?: object,
logModifiedComponents?: Boolean
silent?: Boolean
}

export declare function createLocalVue (): typeof Vue
Expand Down
2 changes: 2 additions & 0 deletions packages/test-utils/types/test/mount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,5 @@ config.methods = {
config.provide = {
foo: {}
}
config.logModifiedComponents = true
config.silent = true
14 changes: 7 additions & 7 deletions test/specs/config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import {
import Vue from 'vue'

describeWithShallowAndMount('config', mountingMethod => {
let configStubsSave, consoleError, configLogSave, configSilentWarningsSave
let configStubsSave, consoleError, configLogSave, configSilentSave

beforeEach(() => {
TransitionGroupStub.name = 'another-temp-name'
TransitionStub.name = 'a-temp-name'
configStubsSave = config.stubs
configLogSave = config.logModifiedComponents
configSilentWarningsSave = config.silentWarnings
configSilentSave = config.silent
consoleError = sinon.stub(console, 'error')
})

Expand All @@ -26,7 +26,7 @@ describeWithShallowAndMount('config', mountingMethod => {
TransitionStub.name = 'transition'
config.stubs = configStubsSave
config.logModifiedComponents = configLogSave
config.silentWarnings = configSilentWarningsSave
config.silent = configSilentSave
consoleError.restore()
})

Expand Down Expand Up @@ -141,8 +141,8 @@ describeWithShallowAndMount('config', mountingMethod => {
expect(wrapper.contains(TransitionStub)).to.equal(false)
})

it("doesn't throw Vue warning when silentWarnings is set to true", () => {
config.silentWarnings = true
it("doesn't throw Vue warning when silent is set to true", () => {
config.silent = true
const localVue = createLocalVue()
const wrapper = mountingMethod(ComponentWithProps, {
propsData: {
Expand All @@ -157,8 +157,8 @@ describeWithShallowAndMount('config', mountingMethod => {
expect(consoleError.called).to.equal(false)
})

it('does throw Vue warning when silentWarnings is set to false', () => {
config.silentWarnings = false
it('does throw Vue warning when silent is set to false', () => {
config.silent = false
const localVue = createLocalVue()
const wrapper = mountingMethod(ComponentWithProps, {
propsData: {
Expand Down