Skip to content

feat: bump supports-color from 8 to 10#5482

Closed
JoshuaKGoldberg wants to merge 5 commits intomochajs:mainfrom
JoshuaKGoldberg:supports-color-10
Closed

feat: bump supports-color from 8 to 10#5482
JoshuaKGoldberg wants to merge 5 commits intomochajs:mainfrom
JoshuaKGoldberg:supports-color-10

Conversation

@JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Oct 2, 2025

PR Checklist

Overview

Bumps the package from ^8.1.1 to ^10.2.2.

Interestingly, this increases the lockfile size for local development dependencies. This is because supports-color@5.5.0 is still referenced by:

$ npm ls supports-color@5
mocha@11.7.4 /Users/josh/repos/mocha
├─┬ karma-mocha-reporter@2.2.5
│ └─┬ chalk@2.4.2
│   └── supports-color@5.5.0
└─┬ nyc@15.1.0
  └─┬ istanbul-lib-instrument@4.0.3
    └─┬ @babel/core@7.21.3
      └─┬ @babel/code-frame@7.22.13
        ├─┬ @babel/highlight@7.22.20
        │ └─┬ chalk@2.4.2
        │   └── supports-color@5.5.0
        └─┬ chalk@2.4.2
          └── supports-color@5.5.0

💖

@mark-wiemer
Copy link
Member

new test failure :(

@Uzlopak
Copy link
Member

Uzlopak commented Oct 3, 2025

@JoshuaKGoldberg
@mark-wiemer
Its because supports-color is esm only

@JoshuaKGoldberg
Copy link
Member Author

Ha yeah, I put these up as drafts with the intent of getting them to pass before requesting review. I was hoping there'd be no additional work but 🫠

@JoshuaKGoldberg JoshuaKGoldberg mentioned this pull request Oct 6, 2025
5 tasks
@JoshuaKGoldberg
Copy link
Member Author

JoshuaKGoldberg commented Nov 27, 2025

Hmm. I can reproduce the CI failure locally in all of:

  • Branch: main and this PR's
  • Node.js version: 22.18.0 and 22.21.1
npx mocha test/integration/esm.spec.js


  esm
    ✔ should pass a passing esm test that uses esm (184ms)
    ✔ should fail a failing esm test that uses esm (177ms)
    ✔ should show file location when there is a syntax error in the test (162ms)
    ✔ should recognize esm files ending with .js due to package.json type flag (178ms)
    ✔ should enable requiring/loading a cjs module with "dir" as filename (173ms)
    ✔ should throw an ERR_MODULE_NOT_FOUND and not ERR_REQUIRE_ESM if file imports a non-existing module (228ms)
    1) should throw an ERR_MODULE_NOT_FOUND and not ERR_REQUIRE_ESM if file imports a non-existing module with a loader


  6 passing (1s)
  1 failing

  1) esm
       should throw an ERR_MODULE_NOT_FOUND and not ERR_REQUIRE_ESM if file imports a non-existing module with a loader:
     UnexpectedError: 
expected '(node:3315) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:\n--import \'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("./test/integration/fixtures/esm/loader-with-module-not-found/loader-that-recognizes-ts.mjs", pathToFileURL("./"));\'\n(Use `node --trace-warnings ...` to show where the warning was created)\n\nnode:internal/modules/run_main:123\n    triggerUncaughtException(\n    ^\nTypeError [ERR_INVALID_URL_SCHEME]: The URL must be of scheme file\n    at fileURLToPath (node:internal/url:1612:11)\n    at resolve (file:///Users/josh/repos/mocha/test/integration/fixtures/esm/loader-with-module-not-found/loader-that-recognizes-ts.mjs:15:5)\n    at nextResolve (node:internal/modules/esm/hooks:748:28)\n    at Hooks.resolve (node:internal/modules/esm/hooks:240:30)\n    at MessagePort.handleMessage (node:internal/modules/esm/worker:199:24)\n    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:845:20)\n    at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28) {\n  code: \'ERR_INVALID_URL_SCHEME\'\n}\n\nNode.js v22.21.1\n'
to contain 'ERR_MODULE_NOT_FOUND'

(node:3315) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("./test/integration/fixtures/esm/loader-with-module-not-found/loader-that-recognizes-ts.mjs", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)

node:internal/modules/run_main:123
    triggerUncaughtException(
    ^
TypeError [ERR_INVALID_URL_SCHEME]: The URL must be of scheme file
    at fileURLToPath (node:internal/url:1612:11)
    at resolve (file:///Users/josh/repos/mocha/test/integration/fixtures/esm/loader-with-module-not-found/loader-that-recognizes-ts.mjs:15:5)
    at nextResolve (node:internal/modules/esm/hooks:748:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:240:30)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:199:24)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:845:20)
    at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28) {
  code: 'ERR_INVALID_URL_SCHEME'
}

Node.js v22.21.1


      at Context.<anonymous> (test/integration/esm.spec.js:100:5)
      at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
      set UNEXPECTED_FULL_TRACE=true to see the full stack trace
err.output alone

(node:37223) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("./test/integration/fixtures/esm/loader-with-module-not-found/loader-that-recognizes-ts.mjs", pathToFileURL("./"));'
    at createModuleLoader (node:internal/modules/esm/loader:970:17)
    at Object.getOrInitializeCascadedLoader (node:internal/modules/esm/loader:1014:22)
    at asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:106:65)
    at runEntryPointWithESMLoader (node:internal/modules/run_main:139:19)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:176:5)
    at node:internal/main/run_main_module:36:49

node:internal/modules/run_main:123
    triggerUncaughtException(
    ^
TypeError [ERR_INVALID_URL_SCHEME]: The URL must be of scheme file
    at fileURLToPath (node:internal/url:1612:11)
    at resolve (file:///Users/josh/repos/mocha/test/integration/fixtures/esm/loader-with-module-not-found/loader-that-recognizes-ts.mjs:15:5)
    at nextResolve (node:internal/modules/esm/hooks:748:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:240:30)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:199:24)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:845:20)
    at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28) {
  code: 'ERR_INVALID_URL_SCHEME'
}
Arguments to resolve
  • specifier: "file:///Users/josh/repos/mocha/lib/cli/cli.js"
  • context: {"conditions":["node","import","module-sync","node-addons"],"importAttributes":{}}

@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.66%. Comparing base (410ce0d) to head (03a9874).
⚠️ Report is 37 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5482      +/-   ##
==========================================
+ Coverage   93.52%   93.66%   +0.13%     
==========================================
  Files          57       57              
  Lines        4465     4465              
  Branches      918      918              
==========================================
+ Hits         4176     4182       +6     
+ Misses        289      283       -6     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JoshuaKGoldberg
Copy link
Member Author

I haven't had time for this for a while. Closing this in case someone else wants to try out the changes.

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.

📦 Package: Bump supports-color from 8 to 10

3 participants