jsdom -> happy-dom migration with vitest is not simple

See original GitHub issue

Kind of a question for help, I’m trying to use happy-dom instead of jsdom using vitest, it should be as simple as changing the vitest environment setting. However, when I switch over, it comes with many issues. Such line as,

    await $radios[0].trigger('click')
    expect(wrapper.vm.modelValue).toEqual('one')

Which worked fine before, doesn’t seem to do anything.

I also get weird fails saying value.trim is not a function on vue-test-utils…

const wrapper = mount(FormSelectOptionGroup, {` 

Component mounting function.

Also, on some other mounting functions, some will fill with TypeError: Cannot set properties of undefined (setting 'hasOwnProperty'), while others in the same file seemingly have no issues.

Any help would be appreciated. Here’s the repo, if anyone wants to take a deeper look and help me figure out what I’m doing wrong. https://github.com/cdmoro/bootstrap-vue-3/tree/main/packages/bootstrap-vue-3

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
capricorn86commented, Oct 14, 2022

I believe that the issues should be fixed now.

Big thanks to for @IGx89 for helping out with this! 🙂

Feel free to re-open otherwise.

You can read more about the releases here: https://github.com/capricorn86/happy-dom/releases/tag/v7.5.12 https://github.com/capricorn86/happy-dom/releases/tag/v7.5.11

0reactions
VividLemoncommented, Oct 14, 2022

There are two bugs for that as well (#571 and #618).

I will prioritize fixing those.

Thanks for that, I do think all of the errors do happen to stem from select and options. Though some stem from the inconsistencies between jsdom and this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring Vitest
If you are running Vitest with --no-threads flag, your tests will be run in this order: node , jsdom , happy-dom , edge-runtime...
Read more >
Testing with Vitest - This Dot Labs
Vitest is a new testing framework powered by Vite. It's still in development, and some features may not be ready yet, but it's...
Read more >
Why I'm moving from Jest to Vitest - DEV Community ‍ ‍
Vitest makes migrating from Jest as easy as possible. ... As of v0.8, Vitest supports node , jsdom and happy-dom .
Read more >
Getting Started with Vitest | Vue Mastery
Vitest currently supports both happy-dom and jsdom. ... Vitest also makes it easy to migrate your existing tests from Jest to Vitest without ......
Read more >
Mirage/Pretender causes errors in Vitest - Stack Overflow
Setting the vite config test environment between happy-dom and 'jsdom' both give different errors, though they appear to be related or similar ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found