From 38b0790aadc8c63ab4cdb0946e02abfa11f89b48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Fontcuberta?= Date: Thu, 14 May 2020 19:22:55 +0200 Subject: [PATCH 1/7] docs: improve title on deprecation warnings --- docs/api/options.md | 2 +- docs/api/wrapper-array/isEmpty.md | 2 +- docs/api/wrapper-array/isVueInstance.md | 2 +- docs/api/wrapper-array/setMethods.md | 2 +- docs/api/wrapper/emittedByOrder.md | 2 +- docs/api/wrapper/find.md | 2 +- docs/api/wrapper/findAll.md | 2 +- docs/api/wrapper/isEmpty.md | 2 +- docs/api/wrapper/isVisible.md | 2 +- docs/api/wrapper/isVueInstance.md | 2 +- docs/api/wrapper/name.md | 2 +- docs/api/wrapper/overview.md | 2 +- docs/api/wrapper/setMethods.md | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/api/options.md b/docs/api/options.md index 9c346d68b..a006d6a52 100644 --- a/docs/api/options.md +++ b/docs/api/options.md @@ -322,7 +322,7 @@ wrapper.destroy() - type: `boolean` - default: `false` -::: warning +::: warning Deprecation warning `attachToDocument` is deprecated and will be removed in future releases. Use [`attachTo`](#attachto) instead. ::: diff --git a/docs/api/wrapper-array/isEmpty.md b/docs/api/wrapper-array/isEmpty.md index ff15b972f..e767518cc 100644 --- a/docs/api/wrapper-array/isEmpty.md +++ b/docs/api/wrapper-array/isEmpty.md @@ -1,6 +1,6 @@ ## isEmpty -::: warning +::: warning Deprecation warning `isEmpty` is deprecated and will be removed in future releases. Consider a custom matcher such as those provided in [jest-dom](https://github.com/testing-library/jest-dom#tobeempty). diff --git a/docs/api/wrapper-array/isVueInstance.md b/docs/api/wrapper-array/isVueInstance.md index a27221a1b..241195976 100644 --- a/docs/api/wrapper-array/isVueInstance.md +++ b/docs/api/wrapper-array/isVueInstance.md @@ -1,6 +1,6 @@ ## isVueInstance -::: warning +::: warning Deprecation warning `isVueInstance` is deprecated and will be removed in future releases. ::: diff --git a/docs/api/wrapper-array/setMethods.md b/docs/api/wrapper-array/setMethods.md index b9e1ebc94..fd55ae6a3 100644 --- a/docs/api/wrapper-array/setMethods.md +++ b/docs/api/wrapper-array/setMethods.md @@ -1,6 +1,6 @@ ## setMethods -::: warning +::: warning Deprecation warning `setMethods` is deprecated and will be removed in future releases. ::: diff --git a/docs/api/wrapper/emittedByOrder.md b/docs/api/wrapper/emittedByOrder.md index 38f82eb77..8312eef9d 100644 --- a/docs/api/wrapper/emittedByOrder.md +++ b/docs/api/wrapper/emittedByOrder.md @@ -1,6 +1,6 @@ ## emittedByOrder -::: warning +::: warning Deprecation warning `emittedByOrder` is deprecated and will be removed in future releases. Use `wrapper.emitted` instead. diff --git a/docs/api/wrapper/find.md b/docs/api/wrapper/find.md index d4409d669..a6711c370 100644 --- a/docs/api/wrapper/find.md +++ b/docs/api/wrapper/find.md @@ -1,6 +1,6 @@ ## find -::: warning +::: warning Deprecation warning Using `find` to search for a Component is deprecated and will be removed. Use `findComponent` instead. ::: diff --git a/docs/api/wrapper/findAll.md b/docs/api/wrapper/findAll.md index 758823fbb..072d48e8f 100644 --- a/docs/api/wrapper/findAll.md +++ b/docs/api/wrapper/findAll.md @@ -1,6 +1,6 @@ ## findAll -::: warning +::: warning Deprecation warning Using `findAll` to search for Components is deprecated and will be removed. Use `findAllComponents` instead. ::: diff --git a/docs/api/wrapper/isEmpty.md b/docs/api/wrapper/isEmpty.md index 0858c4ad5..2be756157 100644 --- a/docs/api/wrapper/isEmpty.md +++ b/docs/api/wrapper/isEmpty.md @@ -1,6 +1,6 @@ ## isEmpty -::: warning +::: warning Deprecation warning `isEmpty` is deprecated and will be removed in future releases. Consider a custom matcher such as those provided in [jest-dom](https://github.com/testing-library/jest-dom#tobeempty). diff --git a/docs/api/wrapper/isVisible.md b/docs/api/wrapper/isVisible.md index f236bd74a..28a55582d 100644 --- a/docs/api/wrapper/isVisible.md +++ b/docs/api/wrapper/isVisible.md @@ -1,6 +1,6 @@ ## isVisible -::: warning +::: warning Deprecation warning `isVisible` is deprecated and will be removed in future releases. Consider a custom matcher such as those provided in [jest-dom](https://github.com/testing-library/jest-dom#tobevisible). diff --git a/docs/api/wrapper/isVueInstance.md b/docs/api/wrapper/isVueInstance.md index aa6218437..5b6a6b4ce 100644 --- a/docs/api/wrapper/isVueInstance.md +++ b/docs/api/wrapper/isVueInstance.md @@ -1,6 +1,6 @@ ## isVueInstance -::: warning +::: warning Deprecation warning `isVueInstance` is deprecated and will be removed in future releases. ::: diff --git a/docs/api/wrapper/name.md b/docs/api/wrapper/name.md index a793a7081..28be2c39c 100644 --- a/docs/api/wrapper/name.md +++ b/docs/api/wrapper/name.md @@ -1,6 +1,6 @@ ## name -::: warning +::: warning Deprecation warning `name` is deprecated and will be removed in future releases. ::: diff --git a/docs/api/wrapper/overview.md b/docs/api/wrapper/overview.md index dd3c9a650..5109b1cae 100644 --- a/docs/api/wrapper/overview.md +++ b/docs/api/wrapper/overview.md @@ -1,6 +1,6 @@ ## overview -::: warning +::: warning Deprecation warning `overview` is deprecated and will be removed in future releases. ::: diff --git a/docs/api/wrapper/setMethods.md b/docs/api/wrapper/setMethods.md index 124c0e6ac..dde3c3bcd 100644 --- a/docs/api/wrapper/setMethods.md +++ b/docs/api/wrapper/setMethods.md @@ -1,6 +1,6 @@ ## setMethods -::: warning +::: warning Deprecation warning `setMethods` is deprecated and will be removed in future releases. ::: From cda9f8ca361ee9e5cbd2eecc05a037b13fb88ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Fontcuberta?= Date: Thu, 14 May 2020 19:35:07 +0200 Subject: [PATCH 2/7] docs: add suggestion for isVueInstance --- docs/api/wrapper-array/isVueInstance.md | 4 ++++ docs/api/wrapper/isVueInstance.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/docs/api/wrapper-array/isVueInstance.md b/docs/api/wrapper-array/isVueInstance.md index 241195976..f42dc8685 100644 --- a/docs/api/wrapper-array/isVueInstance.md +++ b/docs/api/wrapper-array/isVueInstance.md @@ -2,6 +2,10 @@ ::: warning Deprecation warning `isVueInstance` is deprecated and will be removed in future releases. + +Most of the times, tests relying on `isVueInstance` provide little to no-value so you could simply remove them. + +If you want to keep these tests, a valid replacement is to assert that `wrapper.find(...).vm` exists. ::: Assert every `Wrapper` in `WrapperArray` is Vue instance. diff --git a/docs/api/wrapper/isVueInstance.md b/docs/api/wrapper/isVueInstance.md index 5b6a6b4ce..8adcf1849 100644 --- a/docs/api/wrapper/isVueInstance.md +++ b/docs/api/wrapper/isVueInstance.md @@ -2,6 +2,10 @@ ::: warning Deprecation warning `isVueInstance` is deprecated and will be removed in future releases. + +Most of the times, tests relying on `isVueInstance` provide little to no-value so you could simply remove them. + +If you want to keep these tests, a valid replacement is to assert that `wrapper.find(...).vm` exists. ::: Assert `Wrapper` is Vue instance. From 767523ace3f637aa4bea116256173e9c8aca288b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Fontcuberta?= Date: Thu, 14 May 2020 21:06:00 +0200 Subject: [PATCH 3/7] refactor: improve migration path for setMethods and options.methods --- docs/api/wrapper-array/setMethods.md | 4 +++ docs/api/wrapper/setMethods.md | 4 +++ packages/shared/merge-options.js | 5 ++- packages/test-utils/src/wrapper.js | 5 ++- test/specs/config.spec.js | 54 ++++++++++++++++++++++++++++ 5 files changed, 70 insertions(+), 2 deletions(-) diff --git a/docs/api/wrapper-array/setMethods.md b/docs/api/wrapper-array/setMethods.md index fd55ae6a3..1cd636059 100644 --- a/docs/api/wrapper-array/setMethods.md +++ b/docs/api/wrapper-array/setMethods.md @@ -2,6 +2,10 @@ ::: warning Deprecation warning `setMethods` is deprecated and will be removed in future releases. + +There's no clear path to replace `setMethods`, because it really depends on your previous usage. It easily leads to flaky tests that rely on implementation details, which [is discouraged](<(https://github.com/vuejs/rfcs/blob/668866fa71d70322f6a7689e88554ab27d349f9c/active-rfcs/0000-vtu-api.md#setmethods)>). + +Thus, we suggest to to rethink those tests using the tools Vue Test Utils provides. ::: Sets `Wrapper` `vm` methods and forces update on each `Wrapper` in `WrapperArray`. diff --git a/docs/api/wrapper/setMethods.md b/docs/api/wrapper/setMethods.md index dde3c3bcd..2d4b4694b 100644 --- a/docs/api/wrapper/setMethods.md +++ b/docs/api/wrapper/setMethods.md @@ -2,6 +2,10 @@ ::: warning Deprecation warning `setMethods` is deprecated and will be removed in future releases. + +There's no clear path to replace `setMethods`, because it really depends on your previous usage. It easily leads to flaky tests that rely on implementation details, which [is discouraged](<(https://github.com/vuejs/rfcs/blob/668866fa71d70322f6a7689e88554ab27d349f9c/active-rfcs/0000-vtu-api.md#setmethods)>). + +Thus, we suggest to to rethink those tests using the tools Vue Test Utils provides. ::: Sets `Wrapper` `vm` methods and forces update. diff --git a/packages/shared/merge-options.js b/packages/shared/merge-options.js index 93c5e6dab..c78fae789 100644 --- a/packages/shared/merge-options.js +++ b/packages/shared/merge-options.js @@ -35,7 +35,10 @@ export function mergeOptions( [key: string]: Function }) if (methods && Object.keys(methods).length) { - warnDeprecated('overwriting methods via the `methods` property') + warnDeprecated( + 'overwriting methods via the `methods` property', + 'There is no clear migration path for the `methods` property - Vue does not support arbitrarily replacement of methods, nor should VTU. If you need to stub out a method, extract it out and test it. Otherwise, the suggestion is to rethink those tests' + ) } const provide = (getOption(options.provide, config.provide): Object) diff --git a/packages/test-utils/src/wrapper.js b/packages/test-utils/src/wrapper.js index 97faae8cb..b41e5e5b5 100644 --- a/packages/test-utils/src/wrapper.js +++ b/packages/test-utils/src/wrapper.js @@ -632,7 +632,10 @@ export default class Wrapper implements BaseWrapper { * @deprecated */ setMethods(methods: Object): void { - warnDeprecated(`setMethods`) + warnDeprecated( + `setMethods`, + `There is no clear migration path for setMethods - Vue does not support arbitrarily replacement of methods, nor should VTU. If you need to stub out a method, extract it out and test it. Otherwise, the suggestion is to rethink those tests` + ) if (!this.vm) { throwError(`wrapper.setMethods() can only be called on a Vue instance`) diff --git a/test/specs/config.spec.js b/test/specs/config.spec.js index 59acabaed..4cdf3281a 100644 --- a/test/specs/config.spec.js +++ b/test/specs/config.spec.js @@ -144,4 +144,58 @@ describeWithShallowAndMount('config', mountingMethod => { ) }) }) + + describe('methods overriding deprecation warning', () => { + const expectedErrorMessage = `There is no clear migration path` + const Component = { + template: '
', + methods: { + foo() {} + } + } + + it('should show warning for options.methods if config is enabled', () => { + config.showDeprecationWarnings = true + + mountingMethod(Component, { + methods: { foo: () => {} } + }) + + expect(console.error).to.be.calledWith( + sandbox.match(expectedErrorMessage) + ) + }) + + it('should not show warning for options.methods if config is disabled', () => { + config.showDeprecationWarnings = false + + mountingMethod(Component, { + methods: { foo: () => {} } + }) + + expect(console.error).not.to.be.calledWith( + sandbox.match(expectedErrorMessage) + ) + }) + + it('should show warning for setMethods if config is enabled', () => { + config.showDeprecationWarnings = true + + mountingMethod(Component).setMethods({ foo: () => {} }) + + expect(console.error).to.be.calledWith( + sandbox.match(expectedErrorMessage) + ) + }) + + it('should not show warning for setMethods if config is disabled', () => { + config.showDeprecationWarnings = false + + mountingMethod(Component).setMethods({ foo: () => {} }) + + expect(console.error).not.to.be.calledWith( + sandbox.match(expectedErrorMessage) + ) + }) + }) }) From 97a8e5c1aaa5127c57eefec5917741b1cf9339dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Fontcuberta?= Date: Fri, 15 May 2020 09:12:31 +0200 Subject: [PATCH 4/7] docs: fix link format --- docs/api/wrapper-array/setMethods.md | 2 +- docs/api/wrapper/setMethods.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/wrapper-array/setMethods.md b/docs/api/wrapper-array/setMethods.md index 1cd636059..e54a521fd 100644 --- a/docs/api/wrapper-array/setMethods.md +++ b/docs/api/wrapper-array/setMethods.md @@ -3,7 +3,7 @@ ::: warning Deprecation warning `setMethods` is deprecated and will be removed in future releases. -There's no clear path to replace `setMethods`, because it really depends on your previous usage. It easily leads to flaky tests that rely on implementation details, which [is discouraged](<(https://github.com/vuejs/rfcs/blob/668866fa71d70322f6a7689e88554ab27d349f9c/active-rfcs/0000-vtu-api.md#setmethods)>). +There's no clear path to replace `setMethods`, because it really depends on your previous usage. It easily leads to flaky tests that rely on implementation details, which [is discouraged](https://github.com/vuejs/rfcs/blob/668866fa71d70322f6a7689e88554ab27d349f9c/active-rfcs/0000-vtu-api.md#setmethods). Thus, we suggest to to rethink those tests using the tools Vue Test Utils provides. ::: diff --git a/docs/api/wrapper/setMethods.md b/docs/api/wrapper/setMethods.md index 2d4b4694b..e67703eaa 100644 --- a/docs/api/wrapper/setMethods.md +++ b/docs/api/wrapper/setMethods.md @@ -3,7 +3,7 @@ ::: warning Deprecation warning `setMethods` is deprecated and will be removed in future releases. -There's no clear path to replace `setMethods`, because it really depends on your previous usage. It easily leads to flaky tests that rely on implementation details, which [is discouraged](<(https://github.com/vuejs/rfcs/blob/668866fa71d70322f6a7689e88554ab27d349f9c/active-rfcs/0000-vtu-api.md#setmethods)>). +There's no clear path to replace `setMethods`, because it really depends on your previous usage. It easily leads to flaky tests that rely on implementation details, which [is discouraged](https://github.com/vuejs/rfcs/blob/668866fa71d70322f6a7689e88554ab27d349f9c/active-rfcs/0000-vtu-api.md#setmethods). Thus, we suggest to to rethink those tests using the tools Vue Test Utils provides. ::: From ae204cd1bac706fa39bca1ee4715ead6d9b872aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Fontcuberta?= Date: Fri, 15 May 2020 10:49:39 +0200 Subject: [PATCH 5/7] docs: add more hints to replace setMethods and options.methods --- docs/api/wrapper-array/setMethods.md | 2 ++ docs/api/wrapper/setMethods.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/api/wrapper-array/setMethods.md b/docs/api/wrapper-array/setMethods.md index e54a521fd..7692f4383 100644 --- a/docs/api/wrapper-array/setMethods.md +++ b/docs/api/wrapper-array/setMethods.md @@ -6,6 +6,8 @@ There's no clear path to replace `setMethods`, because it really depends on your previous usage. It easily leads to flaky tests that rely on implementation details, which [is discouraged](https://github.com/vuejs/rfcs/blob/668866fa71d70322f6a7689e88554ab27d349f9c/active-rfcs/0000-vtu-api.md#setmethods). Thus, we suggest to to rethink those tests using the tools Vue Test Utils provides. + +If you need to stub out a complex method, extract it out from the component and test it in isolation. On the other hand, if you want to assert that a method is called, use your test runner to spy on it. ::: Sets `Wrapper` `vm` methods and forces update on each `Wrapper` in `WrapperArray`. diff --git a/docs/api/wrapper/setMethods.md b/docs/api/wrapper/setMethods.md index e67703eaa..f336b3b35 100644 --- a/docs/api/wrapper/setMethods.md +++ b/docs/api/wrapper/setMethods.md @@ -6,6 +6,8 @@ There's no clear path to replace `setMethods`, because it really depends on your previous usage. It easily leads to flaky tests that rely on implementation details, which [is discouraged](https://github.com/vuejs/rfcs/blob/668866fa71d70322f6a7689e88554ab27d349f9c/active-rfcs/0000-vtu-api.md#setmethods). Thus, we suggest to to rethink those tests using the tools Vue Test Utils provides. + +If you need to stub out a complex method, extract it out from the component and test it in isolation. On the other hand, if you want to assert that a method is called, use your test runner to spy on it. ::: Sets `Wrapper` `vm` methods and forces update. From 7c0e6275c28a8b1de99728955c3cfe1903cf70a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Fontcuberta?= Date: Sat, 16 May 2020 21:17:17 +0200 Subject: [PATCH 6/7] docs: reword messages --- docs/api/wrapper-array/isVueInstance.md | 4 ++-- docs/api/wrapper-array/setMethods.md | 4 ++-- docs/api/wrapper/isVueInstance.md | 4 ++-- docs/api/wrapper/setMethods.md | 4 ++-- packages/shared/merge-options.js | 2 +- packages/test-utils/src/wrapper.js | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/api/wrapper-array/isVueInstance.md b/docs/api/wrapper-array/isVueInstance.md index f42dc8685..8c0dddebd 100644 --- a/docs/api/wrapper-array/isVueInstance.md +++ b/docs/api/wrapper-array/isVueInstance.md @@ -3,9 +3,9 @@ ::: warning Deprecation warning `isVueInstance` is deprecated and will be removed in future releases. -Most of the times, tests relying on `isVueInstance` provide little to no-value so you could simply remove them. +Tests relying on the `isVueInstance` assertion provide little to no value. We suggest replacing them with purposeful assertions. -If you want to keep these tests, a valid replacement is to assert that `wrapper.find(...).vm` exists. +To keep these tests, a valid replacement for `isVueInstance()` is a truthy assertion of `wrapper.find(...).vm`. ::: Assert every `Wrapper` in `WrapperArray` is Vue instance. diff --git a/docs/api/wrapper-array/setMethods.md b/docs/api/wrapper-array/setMethods.md index 7692f4383..a251d27aa 100644 --- a/docs/api/wrapper-array/setMethods.md +++ b/docs/api/wrapper-array/setMethods.md @@ -5,9 +5,9 @@ There's no clear path to replace `setMethods`, because it really depends on your previous usage. It easily leads to flaky tests that rely on implementation details, which [is discouraged](https://github.com/vuejs/rfcs/blob/668866fa71d70322f6a7689e88554ab27d349f9c/active-rfcs/0000-vtu-api.md#setmethods). -Thus, we suggest to to rethink those tests using the tools Vue Test Utils provides. +We suggest rethinking those tests using the tools Vue Test Utils provides. -If you need to stub out a complex method, extract it out from the component and test it in isolation. On the other hand, if you want to assert that a method is called, use your test runner to spy on it. +To stub a complex method extract it from the component and test it in isolation. To assert that a method is called, use your test runner to spy on it. ::: Sets `Wrapper` `vm` methods and forces update on each `Wrapper` in `WrapperArray`. diff --git a/docs/api/wrapper/isVueInstance.md b/docs/api/wrapper/isVueInstance.md index 8adcf1849..16d976d17 100644 --- a/docs/api/wrapper/isVueInstance.md +++ b/docs/api/wrapper/isVueInstance.md @@ -3,9 +3,9 @@ ::: warning Deprecation warning `isVueInstance` is deprecated and will be removed in future releases. -Most of the times, tests relying on `isVueInstance` provide little to no-value so you could simply remove them. +Tests relying on the `isVueInstance` assertion provide little to no value. We suggest replacing them with purposeful assertions. -If you want to keep these tests, a valid replacement is to assert that `wrapper.find(...).vm` exists. +To keep these tests, a valid replacement for `isVueInstance()` is a truthy assertion of `wrapper.find(...).vm`. ::: Assert `Wrapper` is Vue instance. diff --git a/docs/api/wrapper/setMethods.md b/docs/api/wrapper/setMethods.md index f336b3b35..00893465e 100644 --- a/docs/api/wrapper/setMethods.md +++ b/docs/api/wrapper/setMethods.md @@ -5,9 +5,9 @@ There's no clear path to replace `setMethods`, because it really depends on your previous usage. It easily leads to flaky tests that rely on implementation details, which [is discouraged](https://github.com/vuejs/rfcs/blob/668866fa71d70322f6a7689e88554ab27d349f9c/active-rfcs/0000-vtu-api.md#setmethods). -Thus, we suggest to to rethink those tests using the tools Vue Test Utils provides. +We suggest rethinking those tests using the tools Vue Test Utils provides. -If you need to stub out a complex method, extract it out from the component and test it in isolation. On the other hand, if you want to assert that a method is called, use your test runner to spy on it. +To stub a complex method extract it from the component and test it in isolation. To assert that a method is called, use your test runner to spy on it. ::: Sets `Wrapper` `vm` methods and forces update. diff --git a/packages/shared/merge-options.js b/packages/shared/merge-options.js index c78fae789..bf8d97418 100644 --- a/packages/shared/merge-options.js +++ b/packages/shared/merge-options.js @@ -37,7 +37,7 @@ export function mergeOptions( if (methods && Object.keys(methods).length) { warnDeprecated( 'overwriting methods via the `methods` property', - 'There is no clear migration path for the `methods` property - Vue does not support arbitrarily replacement of methods, nor should VTU. If you need to stub out a method, extract it out and test it. Otherwise, the suggestion is to rethink those tests' + 'There is no clear migration path for the `methods` property - Vue does not support arbitrarily replacement of methods, nor should VTU. To stub a complex method extract it from the component and test it in isolation. Otherwise, the suggestion is to rethink those tests' ) } diff --git a/packages/test-utils/src/wrapper.js b/packages/test-utils/src/wrapper.js index b41e5e5b5..8ca08a7e0 100644 --- a/packages/test-utils/src/wrapper.js +++ b/packages/test-utils/src/wrapper.js @@ -634,7 +634,7 @@ export default class Wrapper implements BaseWrapper { setMethods(methods: Object): void { warnDeprecated( `setMethods`, - `There is no clear migration path for setMethods - Vue does not support arbitrarily replacement of methods, nor should VTU. If you need to stub out a method, extract it out and test it. Otherwise, the suggestion is to rethink those tests` + `There is no clear migration path for setMethods - Vue does not support arbitrarily replacement of methods, nor should VTU. To stub a complex method extract it from the component and test it in isolation. Otherwise, the suggestion is to rethink those tests` ) if (!this.vm) { From 7808bf84f8b8e1ca335e72549b4d313dda4a192d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Fontcuberta?= Date: Sat, 16 May 2020 21:20:03 +0200 Subject: [PATCH 7/7] docs: remove implicit statement --- docs/api/wrapper-array/setMethods.md | 2 +- docs/api/wrapper/setMethods.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/wrapper-array/setMethods.md b/docs/api/wrapper-array/setMethods.md index a251d27aa..14567b337 100644 --- a/docs/api/wrapper-array/setMethods.md +++ b/docs/api/wrapper-array/setMethods.md @@ -5,7 +5,7 @@ There's no clear path to replace `setMethods`, because it really depends on your previous usage. It easily leads to flaky tests that rely on implementation details, which [is discouraged](https://github.com/vuejs/rfcs/blob/668866fa71d70322f6a7689e88554ab27d349f9c/active-rfcs/0000-vtu-api.md#setmethods). -We suggest rethinking those tests using the tools Vue Test Utils provides. +We suggest rethinking those tests. To stub a complex method extract it from the component and test it in isolation. To assert that a method is called, use your test runner to spy on it. ::: diff --git a/docs/api/wrapper/setMethods.md b/docs/api/wrapper/setMethods.md index 00893465e..8c9090f4f 100644 --- a/docs/api/wrapper/setMethods.md +++ b/docs/api/wrapper/setMethods.md @@ -5,7 +5,7 @@ There's no clear path to replace `setMethods`, because it really depends on your previous usage. It easily leads to flaky tests that rely on implementation details, which [is discouraged](https://github.com/vuejs/rfcs/blob/668866fa71d70322f6a7689e88554ab27d349f9c/active-rfcs/0000-vtu-api.md#setmethods). -We suggest rethinking those tests using the tools Vue Test Utils provides. +We suggest rethinking those tests. To stub a complex method extract it from the component and test it in isolation. To assert that a method is called, use your test runner to spy on it. :::