Skip to content

Commit

Permalink
docs: add removal of createWrapper (#2235)
Browse files Browse the repository at this point in the history
Documentation about the removal of the `createWrapper()` function and how it can be replaced with `new DOMWrapper()`.
  • Loading branch information
AntonioDell committed Nov 9, 2023
1 parent 428dd3f commit 654eb08
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/migration/index.md
Expand Up @@ -247,6 +247,35 @@ wrapper.findAll('[data-test="token"]').at(0);
wrapper.findAll('[data-test="token"]')[0];
```

### `createWrapper()` removed

`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.

**Before:**

```js
import { createWrapper } from "@vue/test-utils";

describe('App', () => {
it('renders', () => {
const body = createWrapper(document.body);
expect(body.exists()).toBe(true);
})

```
**After:**
```js
import { DOMWrapper } from "@vue/test-utils";

describe('App', () => {
it('renders', () => {
const body = new DOMWrapper(document.body);
expect(body.exists()).toBe(true);
})
```
## Test runners upgrade notes
> Vue Test Utils is framework agnostic - you can use it with whichever test runner you like.
Expand Down

0 comments on commit 654eb08

Please sign in to comment.