diff --git a/docs/api/config.md b/docs/api/config.md index 74b35b006..0baa99346 100644 --- a/docs/api/config.md +++ b/docs/api/config.md @@ -95,7 +95,7 @@ import VueTestUtils from '@vue/test-utils' VueTestUtils.config.logModifiedComponents = false ``` -### `silentWarnings` +### `silent` - type: `Boolean` - default: `true` @@ -106,5 +106,5 @@ Example: ```js import VueTestUtils from '@vue/test-utils' -VueTestUtils.config.silentWarnings = false +VueTestUtils.config.silent = false ``` diff --git a/packages/server-test-utils/types/index.d.ts b/packages/server-test-utils/types/index.d.ts index 1394421a4..2089bfb82 100644 --- a/packages/server-test-utils/types/index.d.ts +++ b/packages/server-test-utils/types/index.d.ts @@ -51,6 +51,7 @@ interface VueTestUtilsConfigOptions { methods?: Record provide?: object, logModifiedComponents?: Boolean + silent?: Boolean } export declare let config: VueTestUtilsConfigOptions diff --git a/packages/server-test-utils/types/test/renderToString.ts b/packages/server-test-utils/types/test/renderToString.ts index 4061a2bc6..77a0892e1 100644 --- a/packages/server-test-utils/types/test/renderToString.ts +++ b/packages/server-test-utils/types/test/renderToString.ts @@ -62,3 +62,5 @@ config.methods = { config.provide = { foo: {} } +config.logModifiedComponents = true +config.silent = true diff --git a/packages/test-utils/src/config.js b/packages/test-utils/src/config.js index d31342b0b..70734d99c 100644 --- a/packages/test-utils/src/config.js +++ b/packages/test-utils/src/config.js @@ -10,5 +10,5 @@ export default { methods: {}, provide: {}, logModifiedComponents: true, - silentWarnings: true + silent: true } diff --git a/packages/test-utils/src/wrapper.js b/packages/test-utils/src/wrapper.js index 81a9b2161..e290dd0e7 100644 --- a/packages/test-utils/src/wrapper.js +++ b/packages/test-utils/src/wrapper.js @@ -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 ` + diff --git a/packages/test-utils/types/index.d.ts b/packages/test-utils/types/index.d.ts index cce3e239c..70acd91c3 100644 --- a/packages/test-utils/types/index.d.ts +++ b/packages/test-utils/types/index.d.ts @@ -147,6 +147,7 @@ interface VueTestUtilsConfigOptions { methods?: Record provide?: object, logModifiedComponents?: Boolean + silent?: Boolean } export declare function createLocalVue (): typeof Vue diff --git a/packages/test-utils/types/test/mount.ts b/packages/test-utils/types/test/mount.ts index 890158cf3..f085f9e59 100644 --- a/packages/test-utils/types/test/mount.ts +++ b/packages/test-utils/types/test/mount.ts @@ -92,3 +92,5 @@ config.methods = { config.provide = { foo: {} } +config.logModifiedComponents = true +config.silent = true diff --git a/test/specs/config.spec.js b/test/specs/config.spec.js index fb954342b..30b5d13bb 100644 --- a/test/specs/config.spec.js +++ b/test/specs/config.spec.js @@ -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') }) @@ -26,7 +26,7 @@ describeWithShallowAndMount('config', mountingMethod => { TransitionStub.name = 'transition' config.stubs = configStubsSave config.logModifiedComponents = configLogSave - config.silentWarnings = configSilentWarningsSave + config.silent = configSilentSave consoleError.restore() }) @@ -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: { @@ -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: {