Skip to content

feat(learn): clean up code sample & update/correct time mocking section - #8707

Merged
avivkeller merged 2 commits into
mainfrom
learn/test-runner/update-mock-module-example
Mar 12, 2026
Merged

feat(learn): clean up code sample & update/correct time mocking section#8707
avivkeller merged 2 commits into
mainfrom
learn/test-runner/update-mock-module-example

Conversation

@JakobJingleheimer

Copy link
Copy Markdown
Member

CopilotAI review requested due to automatic review settings March 8, 2026 12:59
@JakobJingleheimerJakobJingleheimer added the learn Issues/pr concerning the learn section label Mar 8, 2026
@vercel

vercelBot commented Mar 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
nodejs-orgReadyReadyPreviewMar 8, 2026 1:20pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

👋 Codeowner Review Request

The following codeowners have been identified for the changed files:

Team reviewers: @nodejs/test_runner

Please review the changes when you have a chance. Thank you! 🙏

@codecov

codecovBot commented Mar 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.10%. Comparing base (5fc6baa) to head (51af870).
⚠️ Report is 7 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@ Coverage Diff @@## main #8707 +/- ##
==========================================
+ Coverage 75.09% 75.10% +0.01% 
==========================================
Files 104 104 Lines 9161 9161 Branches 315 315 ==========================================
+ Hits 6879 6880 +1 + Misses 2280 2279 -1 
Partials 2 2 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the Node.js test-runner “Mocking” learning page to correct the time-mocking guidance and simplify the accompanying examples (per linked Node.js issue/PR).

Changes:

  • Refactors the module-mocking example to set up mock.module() and perform the consumer import in-sequence within the describe block.
  • Fixes the time-mocking example to enable mock.timers before importing the module under test, and adds an explicit explanation of why a dynamic import is required.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadapps/site/pages/en/learn/test-runner/mocking.md Outdated
@github-actions

github-actionsBot commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

📦 Build Size Comparison

Summary

MetricValue
Old Total Size3.51 MB
New Total Size3.51 MB
Delta0 B (0.00%)

Changes

➕ Added Assets (1)
NameSize
.next/static/chunks/ea489969291ac20a.js208.15 KB
➖ Removed Assets (1)
NameSize
.next/static/chunks/e30c75c2554188d5.js208.15 KB

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com>
@avivkeller
avivkeller added this pull request to the merge queueMar 12, 2026
Merged via the queue into main with commit abf5a98Mar 12, 2026
12 checks passed
@avivkeller
avivkeller deleted the learn/test-runner/update-mock-module-example branch March 12, 2026 10:52
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

learnIssues/pr concerning the learn section

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mocking builtins does not affect already-imported ESM namespace objects

4 participants

@JakobJingleheimer@avivkeller@AugustinMauroy