Skip to content

Conversation

@exequiel09
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

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

@netlify
Copy link

netlify bot commented Dec 2, 2025

Deploy Preview for ngrx-io canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit 2922a93
🔍 Latest deploy log https://app.netlify.com/projects/ngrx-io/deploys/69345730f1cde10007167345

@netlify
Copy link

netlify bot commented Dec 2, 2025

Deploy Preview for ngrx-site-v19 ready!

Name Link
🔨 Latest commit 2922a93
🔍 Latest deploy log https://app.netlify.com/projects/ngrx-site-v19/deploys/69345730b1550a0008911a23
😎 Deploy Preview https://deploy-preview-5036--ngrx-site-v19.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor Author

@exequiel09 exequiel09 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-comment

@exequiel09 exequiel09 marked this pull request as draft December 2, 2025 05:28
@exequiel09
Copy link
Contributor Author

exequiel09 commented Dec 2, 2025

Only type errors are left which I didn't touch and just appeared when migrated to vitest.

  1. https://github.com/ngrx/platform/actions/runs/19849232805/job/56872554303?pr=5036#step:8:407
  2. https://github.com/ngrx/platform/actions/runs/19849232805/job/56872554303?pr=5036#step:8:382 (needs to be rewritten??)

Culprit for item 1:
Screenshot 2025-12-02 at 2 59 37 PM

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 it block by using uncaughtException handler to filter the noisy error. Might be okay to create a test helper function to suppress error
  • fix option 3 = add project-wide (store) uncaughtException handler and filter errors there which will became an unwieldy list of false-positive of errors

vi.spyOn(dispatcher, 'next');
vi.spyOn(dispatcher, 'error');

store.next(<any>1);
Copy link
Contributor Author

@exequiel09 exequiel09 Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source for 1 of the remaining errors. There's a check in the utils file and throws error if type property of action is not present which leads to this error: https://github.com/ngrx/platform/actions/runs/19849232805/job/56872554303?pr=5036#step:8:382

@exequiel09
Copy link
Contributor Author

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.

@exequiel09 exequiel09 force-pushed the test/migrate-jest-to-vitest-store branch 5 times, most recently from 3dc8463 to e881ed4 Compare December 6, 2025 11:17
@exequiel09 exequiel09 force-pushed the test/migrate-jest-to-vitest-store branch from e881ed4 to 2922a93 Compare December 6, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@ngrx/store: Migrate Store Unit Tests to Vitest

1 participant