Skip to content
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

docs: Add removal of createWrapper #2235

Merged
merged 1 commit into from Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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