chore: convert lib/utils.js to ESM#6071
Open
arun-357 wants to merge 1 commit into
Open
Conversation
|
|
mark-wiemer
requested changes
Jun 16, 2026
| Suite = sinon.stub(Mocha, "Suite").returns(suite); | ||
| Suite.constants = {}; | ||
|
|
||
| sinon.stub(utils, "isString"); |
Member
There was a problem hiding this comment.
Can you explain how these tests aren't false negatives with this change?
Author
There was a problem hiding this comment.
nothing ever asserted on these stubs, so they weren't testing anything
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6071 +/- ##
==========================================
- Coverage 78.12% 72.33% -5.80%
==========================================
Files 63 63
Lines 4590 4587 -3
Branches 977 981 +4
==========================================
- Hits 3586 3318 -268
- Misses 1004 1269 +265 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
lib/utils.jsto ESM #5964status: accepting prsOverview
Part of #5400. Renames
lib/utils.js→lib/utils.mjsand converts it to ESM named exports, updating every runtime call site and test in the same change. No behavior change.exports.X = …becomes an inlineexport function/export const; internalexports.Xself-references are now direct calls. No default/aggregate export (perAGENTS.md).require("./utils.mjs"), ESM named-import consumersfrom "./utils.mjs", and namespace consumers switched fromimport utils fromtoimport * as utils from(a default import of a named-export module isundefined).sinoncannot stub ES modules, so thesinon.stub(utils, …)calls were reworked — the unassertedisString/noopstubs were removed, and theisBrowserstubs were replaced withprocess.browsertoggling (isBrowser()isBoolean(process.browser), so the same code path and assertions run).rewiremockkeys/import paths were repointed to.mjs.Verified:
test-nodesuites,test-smoke,eslint,tsc, and aclean+buildbrowser bundle all pass;lib/utils.jswas not listed inpackage.json'sbrowsermap, so no config change was needed.