Skip to content

chore(test): migrate from Jest to node:test #7623

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

Merged
merged 7 commits into from
Apr 17, 2025
Merged

Conversation

avivkeller
Copy link
Member

@avivkeller avivkeller commented Apr 5, 2025

This PR replaces Jest with node:test as the test runner. While it's currently marked as a draft, it's functionally complete (aside from some GitHub Actions that still need testing), so feel free to review it as you would a regular PR.

The new setup uses node:test with tsx, global-jsdom, and custom mocks located in apps/site/tests/mocks and /tests/mocks. The root-level mocks are shared across multiple packages.

Copy link

vercel bot commented Apr 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Apr 17, 2025 3:28pm

@avivkeller
Copy link
Member Author

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

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

first batch of review mainly on test env

@AugustinMauroy
Copy link
Member

also instead of import assert from 'node:assert'; you should use the strict version import assert from 'node:assert/strict';.

maybe take a look for an eslint rule

@avivkeller
Copy link
Member Author

avivkeller commented Apr 5, 2025

Blocked by nodejs/admin#964. Once we get codecov setup, i'll add the action into the PR.

@ovflowd ovflowd added the github_actions:pull-request Trigger Pull Request Checks label Apr 7, 2025
@ovflowd
Copy link
Member

ovflowd commented Apr 7, 2025

image

Copy link
Contributor

github-actions bot commented Apr 7, 2025

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 98 🟢 100 🟢 100 🟢 91 🔗
/en/about 🟢 100 🟢 100 🟢 100 🟢 91 🔗
/en/about/previous-releases 🟢 98 🟢 100 🟢 100 🟢 92 🔗
/en/download 🟢 98 🟢 100 🟢 100 🟢 91 🔗
/en/blog 🟢 100 🟢 100 🟢 96 🟢 92 🔗

This comment was marked as resolved.

@avivkeller avivkeller disabled auto-merge April 17, 2025 13:57
@avivkeller
Copy link
Member Author

(Misclick w/ the auto merge, meant to click on the reviews 😅)

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

I think we can get this merged. Although I'd like a codecov preview and maybe confirmation CI will work as expected.

@avivkeller
Copy link
Member Author

@avivkeller
Copy link
Member Author

avivkeller commented Apr 17, 2025

Copy link
Member

@canerakdas canerakdas left a comment

Choose a reason for hiding this comment

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

I tested it locally on macOS and added a few minor comments regarding the import order and grouping. Overall, it looks awesome 🤩

Co-authored-by: Caner Akdas <canerakdas@gmail.com>
Signed-off-by: Aviv Keller <me@aviv.sh>
@avivkeller
Copy link
Member Author

avivkeller commented Apr 17, 2025

🫡🥂

Follow-up actions:

  • chromatic should be designated a required status check
  • Codecov should be enabled on the repository as an app. Until then, @codecov-commenter will leave the comments

Merged via the queue into main with commit 162cd26 Apr 17, 2025
17 checks passed
@avivkeller avivkeller deleted the jest-to-node-test branch April 17, 2025 17:55
@bmuenzenmeyer
Copy link
Collaborator

[ ] chromatic should be designated a required status check

does this look right?
image

@avivkeller
Copy link
Member Author

Yep!

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.

Switch from Jest to Node.js's Native Test Runner
6 participants