-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
chore: migrate from Jest to Vitest for ESM support #1663
Conversation
Run & review this pull request in StackBlitz Codeflow. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1663 +/- ##
========================================
- Coverage 99.7% 99.7% -0.0%
========================================
Files 199 187 -12
Lines 21895 31085 +9190
Branches 7319 9782 +2463
========================================
+ Hits 21827 30987 +9160
- Misses 68 98 +30 ☔ View full report in Codecov by Sentry. |
@zewa666
So it's a little weird, I have to go with a mix of both, I'll take another look at it tonight but so far the testing only works with the mix config... so are you using happy-dom and/or jsdom? EDIT as per this open issue but it looks like it's a known problem with Vite and happy-dom was suggested as an alternative. However I find happy-dom is still kind of incomplete (for example, DOM elements don't include |
I did not have that issue. besides are you sure jsdom is the problem since you already had it working with jest? I personally would stay away from happydom due to even less coverage than jsdom, which shows itself especially with testing-library. but if it works for the slickgrid lib itself ... well why not ;) |
I wouldn't mind using strictly JSDOM but like I said above when I set it as the environment in Vitest, then some tests aren't passing but when I set it to happy-dom and still use jsdom-global then all is good... It's kinda weird but like you said, if it works then let's keep that setup and forget about it :) slickgrid-universal/test/vitest-pretest.ts Lines 1 to 2 in 0bee209
|
would you mind creating a branch where only jsdom is acitvated? I'd really like to give it a closer look as it might also show some potential blockers for my own app |
it's just this line to change from - environment: 'happy-dom',
+ environment: 'jsdom', slickgrid-universal/test/vitest.config.mts Lines 3 to 9 in 0bee209
|
oh ok thought you mentioned adding additional stuff for happydom. I'll give it a try |
@ghiscoding so I've tried switching to jsdom and all tests are passing nicely for me. I dunno, perhaps try to nuke the node_modules folder and a fresh install could be the difference? |
@zewa666 hmm that's strange because I tried on work laptop today and same results, I have 202 tests failing with this error
I didn't think of nuking the node_modules, so I just tried it and still the same result on my side. I think the problem is that I use Custom Events in the project and JSDOM doesn't work well with EventTarget properly with Custom Events because of this JDOM issue, I tried to mock it via this post from the same issue but that doesn't help. So I think that when I set happy-dom, its EventTarget mock is better and so when I mix them both then it passes. it's also a lot quicker when it passes 85sec vs 171sec |
v8-to-istanbul
reporter is acting differently and line counts is different, for example the coverage with Istanbul is for anif
and its content but doesn't include the termination}
(however it's included with v8) and so for that reason the new codecov report shows nearly 10k more lines