Skip to content

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

Open
JakobJingleheimer wants to merge 2 commits intomainfrom
learn/test-runner/update-mock-module-example
Open

feat(learn): clean up code sample & update/correct time mocking section#8707
JakobJingleheimer wants to merge 2 commits intomainfrom
learn/test-runner/update-mock-module-example

Conversation

@JakobJingleheimer
Copy link
Member

Copilot AI review requested due to automatic review settings March 8, 2026 12:59
@JakobJingleheimer JakobJingleheimer added the learn Issues/pr concerning the learn section label Mar 8, 2026
@vercel
Copy link

vercel bot commented Mar 8, 2026

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

Project Deployment Actions Updated (UTC)
nodejs-org Ready Ready Preview Mar 8, 2026 1:20pm

Request Review

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

👋 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
Copy link

codecov bot commented Mar 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.10%. Comparing base (5fc6baa) to head (51af870).
✅ 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.

Copy link
Contributor

Copilot AI left a comment

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.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

📦 Build Size Comparison

Summary

Metric Value
Old Total Size 3.51 MB
New Total Size 3.51 MB
Delta 0 B (0.00%)

Changes

➕ Added Assets (1)
Name Size
.next/static/chunks/ea489969291ac20a.js 208.15 KB
➖ Removed Assets (1)
Name Size
.next/static/chunks/e30c75c2554188d5.js 208.15 KB

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

learn Issues/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