Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #248 +/- ##
==========================================
- Coverage 95.40% 95.17% -0.24%
==========================================
Files 20 20
Lines 3917 3955 +38
==========================================
+ Hits 3737 3764 +27
- Misses 180 191 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
erisu
reviewed
Jan 24, 2026
Member
erisu
left a comment
There was a problem hiding this comment.
There seems to be an issue with util.styleText when running tests.
20.9.0passes.20.20.0passes.20.12.0fails.
There appears to be a difference in the behavior of util.styleText between version 20.12.0 and newer.
The following error will appear:
CordovaLogger class instance log method Test 011 : should log everything except error messages to stdout
- TypeError: The argument 'format' must be one of: 'reset', 'bold', 'dim', 'italic', 'underline', 'blink', 'inverse', 'hidden', 'strikethrough', 'doubleunderline', 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'bgBlack', 'bgRed', 'bgGreen', 'bgYellow', 'bgBlue', 'bgMagenta', 'bgCyan', 'bgWhite', 'framed', 'overlined', 'gray', 'redBright', 'greenBright', 'yellowBright', 'blueBright', 'magentaBright', 'cyanBright', 'whiteBright', 'bgGray', 'bgRedBright', 'bgGreenBright', 'bgYellowBright', 'bgBlueBright', 'bgMagentaBright', 'bgCyanBright', 'bgWhiteBright'. Received [ 'bold', 'grey' ]
The same error will print also for Test 012 and 013
In the next major when we drop Node 20 support, we can remove the ansi dependency and refactor CordovaLogger to clean up the exposed API a bit.
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.
Platforms affected
All
Motivation and Context
Sometimes (particularly in cordova-ios test cases) it seems like the CordovaEventEmitter gets subscribed to CordovaLogger multiple times, resulting in duplicate log output lines.
Node 20.12.0 and newer include
util.styleTextfor handling console text styling. Prefer to use stdlib functionality rather than external dependencies.Description
Added a WeakMap to store subscribed emitters in CordovaLogger and no-op if the same emitter is subscribed more than once
If
util.styleTextis available, use that instead of theansimodule for formatting the CordovaLogger output.ansidependency and clean up the internals of CordovaLoggerTesting
Added new test cases for changed code.
Visually tested output with both
util.styleTextandansito confirm the output is identical.Checklist