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

Testing with HappyDOM #513

Closed
nandi95 opened this issue Apr 1, 2021 · 2 comments
Closed

Testing with HappyDOM #513

nandi95 opened this issue Apr 1, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@nandi95
Copy link
Contributor

nandi95 commented Apr 1, 2021

By default jest uses JSDOM. I wanted to try out HappyDOM for the sick performance gainz, but unfortunately I'm getting an error:

TypeError: Reflect.ownKeys called on non-object

The error is coming from https://github.com/vuejs/vue-test-utils-next/blob/master/src/mount.ts#L451
Now, I don't know if this is an incorrect implementation on HappyDOM's part altough this seems to work as expected:

const obj = { hi: 1 };

console.log(Reflect.ownKeys(obj)); // [ 'hi' ]

but can we perhaps also test with other jest environments?

I imagine this would could work something like

// package.json
"test:happy-dom": "JEST_ENV=happy-dom jest",

// jest.config.js
testEnvironment: process.env.JEST_ENV === 'happy-dom' ? '@happy-dom/jest-environment' : 'jsdom',

I understand if this isn't desired as this would add additional time to gh actions and if testing another implementation, then where does the list of implementations to test stops...

@lmiller1990
Copy link
Member

The GH actions run so fast, I think it's fine to add another step. I didn't know there was a jsdom alternative, that's cool.

I'd like to know why this isn't working, if you do find a fix, we can definitely add HappyDOM testing to CI in the manner you proposed (or something similar, whatever is fine).

@cexbrayat
Copy link
Member

I tried again and we still have 10% of the tests failing with happy-dom (but there are no errors with VTU code as far as I can see).

There are issues with the way HappyDOM handles the visibility, selected options are not iterable, etc. We also had some issues opened by developers on VTU that were in fact from happy-dom

So I don't think we can add this to our CI, but feel free to use in project if that works for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants