wip(store): migrate testing suite from jest to vitest
PR Checklist
Please check if your PR fulfills the following requirements:
- [x] The commit message follows our guidelines: https://github.com/ngrx/platform/blob/main/CONTRIBUTING.md#commit
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
PR Type
What kind of change does this PR introduce?
[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[x] Other... Please describe:
Updates to testing to ensure compatibility to `vitest`
What is the current behavior?
The current behavior is that tests are running perfectly fine on jest. This PR ensures that it runs smoothly on vitest without any errors.
Closes #5018
What is the new behavior?
No new behavior. Just ensures to maintain parity when it runs using vitest
Does this PR introduce a breaking change?
[ ] Yes
[x] No
Other information
Deploy Preview for ngrx-io canceled.
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | 5a52eb9ca7258e90829f2d0eb00f67fd0491a0f7 |
| Latest deploy log | https://app.netlify.com/projects/ngrx-io/deploys/6940f654402ed400088c6cff |
Deploy Preview for ngrx-site-v19 ready!
| Name | Link |
|---|---|
| Latest commit | 5a52eb9ca7258e90829f2d0eb00f67fd0491a0f7 |
| Latest deploy log | https://app.netlify.com/projects/ngrx-site-v19/deploys/6940f656d707bb0008778e30 |
| Deploy Preview | https://deploy-preview-5036--ngrx-site-v19.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
Only type errors are left which I didn't touch and just appeared when migrated to vitest.
- https://github.com/ngrx/platform/actions/runs/19849232805/job/56872554303?pr=5036#step:8:407 (should handle
undefinedvalue for thereducer?) - https://github.com/ngrx/platform/actions/runs/19849232805/job/56872554303?pr=5036#step:8:382 (needs to be rewritten??)
Culprit for item 1:
Thinking of how to fix this 🤔
- fix option 1 = add https://vitest.dev/config/dangerouslyignoreunhandlederrors.html to project-wide(store) vite config 🤷🏻
- fix option 2 = suppress error in each
itblock by usinguncaughtExceptionhandler to filter the noisy error. Might be okay to create a test helper function to suppress error (similar to this https://gist.github.com/exequiel09/3eb99dfcdcfbc0d1fdb3bef4d538d79d) - fix option 3 = add project-wide (store)
uncaughtExceptionhandler and filter errors there which will became an unwieldy list of false-positive of errors
Would love to ask for some feedback on the PR @markostanimirovic and @brandonroberts especially on the issues that arised upon migrating to vitest. Thank you.
Hi @timdeschryver would love also your feedback here. Just a couple issues then I think it's good to go. Thank you.
Hi @timdeschryver would love also your feedback here. Just a couple issues then I think it's good to go. Thank you.
I will take a look at it later this week (probably at the end of it)
The failing type tests can be fixed by updating the timeout to
8_000within the describe block (this will be passed down to each test case), similar to what's done in #5044.
Addressed this in https://github.com/ngrx/platform/pull/5036/commits/35b9962c71e83374ffcb7139fab8f590f918a6de
The remaining CI errors are not caused by this PR => they should be resolved in #5044.
There are 2 errors that's related to vitest uncaught exceptions.
-
I mentioned in this comment as problem item 1 (https://github.com/ngrx/platform/pull/5036#issuecomment-3600383044) which is reflected as well in this CI run (https://github.com/ngrx/platform/actions/runs/20217503698/job/58033009122?pr=5036#step:8:2150)
-
I mention in this comment as problem item 2 (https://github.com/ngrx/platform/pull/5036#issuecomment-3600383044) which is reflected as well in this CI run (https://github.com/ngrx/platform/actions/runs/20217503698/job/58033009122?pr=5036#step:8:2127)
From looking at the PR, I think you addressed all of the issues yourself, or is there still something left where you're waiting for input?
@timdeschryver I was looking for inputs on how to resolve this. Also, I tried to propose solutions in the comment (https://github.com/ngrx/platform/pull/5036#issuecomment-3600383044), that needs to be discussed since the solutions I have thought of might not be up to the team's liking.
The remaining CI errors are not caused by this PR => they should be resolved in #5044.
There are 2 errors that's related to vitest uncaught exceptions.
- I mentioned in this comment as problem item 1 (wip(store): migrate testing suite from jest to vitest #5036 (comment)) which is reflected as well in this CI run (https://github.com/ngrx/platform/actions/runs/20217503698/job/58033009122?pr=5036#step:8:2150)
2. I mention in this comment as problem item 2 ([wip(store): migrate testing suite from jest to vitest #5036 (comment)](https://github.com/ngrx/platform/pull/5036#issuecomment-3600383044)) which is reflected as well in this CI run (https://github.com/ngrx/platform/actions/runs/20217503698/job/58033009122?pr=5036#step:8:2127)
> From looking at the PR, I think you addressed all of the issues yourself, or is there still something left where you're waiting for input?
@timdeschryver I was looking for inputs on how to resolve this. Also, I tried to propose solutions in the comment (#5036 (comment)), that needs to be discussed since the solutions I have thought of might not be up to the team's liking.
Oh sorry, I missed those comments while reviewing. The latest commit should resolve these, the only failing ones are not store related and shouldn't be addressed in this PR. We can publish the PR and I'll review it once more with a fresh head, I suppose it's good to be merged though.
We can publish the PR and I'll review it once more with a fresh head, I suppose it's good to be merged though.
Hey @timdeschryver I removed the "draft" status and changed the title to use the type refactor instead of wip.
@exequiel09 could you pull the latest main branch into your branch please? This should resolve the remaining errors.
I just rebased the PR just moments ago based on the latest commits on the main branch. Did something change again or got merged?
I just rebased the PR just moments ago based on the latest commits on the main branch. Did something change again or got merged?
Thanks 👍 You can ignore my comment then.
I just rebased the PR just moments ago based on the latest commits on the main branch. Did something change again or got merged?
Checked. PR is still on top of the commits of main branch.
I see one of the issues exceeded 8000ms. That's why something failed.
https://github.com/ngrx/platform/actions/runs/20258235781/job/58164627027?pr=5036#step:8:1558
2. I mention in this comment as problem item 2 ([wip(store): migrate testing suite from jest to vitest #5036 (comment)](https://github.com/ngrx/platform/pull/5036#issuecomment-3600383044)) which is reflected as well in this CI run (https://github.com/ngrx/platform/actions/runs/20217503698/job/58033009122?pr=5036#step:8:2127)
> From looking at the PR, I think you addressed all of the issues yourself, or is there still something left where you're waiting for input?