Skip to content

Commit 654eb08

Browse files
authored
docs: add removal of createWrapper (#2235)
Documentation about the removal of the `createWrapper()` function and how it can be replaced with `new DOMWrapper()`.
1 parent 428dd3f commit 654eb08

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

docs/migration/index.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,35 @@ wrapper.findAll('[data-test="token"]').at(0);
247247
wrapper.findAll('[data-test="token"]')[0];
248248
```
249249

250+
### `createWrapper()` removed
251+
252+
`createWrapper()` is now an internal function only and cannot be imported anymore. If you need access to a wrapper for a DOM element which isn't a Vue component, you can use `new DOMWrapper()` constructor.
253+
254+
**Before:**
255+
256+
```js
257+
import { createWrapper } from "@vue/test-utils";
258+
259+
describe('App', () => {
260+
it('renders', () => {
261+
const body = createWrapper(document.body);
262+
expect(body.exists()).toBe(true);
263+
})
264+
265+
```
266+
267+
**After:**
268+
269+
```js
270+
import { DOMWrapper } from "@vue/test-utils";
271+
272+
describe('App', () => {
273+
it('renders', () => {
274+
const body = new DOMWrapper(document.body);
275+
expect(body.exists()).toBe(true);
276+
})
277+
```
278+
250279
## Test runners upgrade notes
251280
252281
> Vue Test Utils is framework agnostic - you can use it with whichever test runner you like.

0 commit comments

Comments
 (0)