Skip to content

fix(jest): accept debug: "verbose" in registerCSS and keep a given logger - #595

Merged
danstepanov merged 1 commit into
nativewind:mainfrom
Chandra-Prakash-TS:fix/register-css-debug-logger
Dec 3, 2026
Merged

danstepanov merged 1 commit into
nativewind:mainfrom
Chandra-Prakash-TS:fix/register-css-debug-logger

Conversation

@Chandra-Prakash-TS

Copy link
Copy Markdown
Contributor

Fixes #562

Problem

  • registerCSS typed options.debug as boolean, although it passes the options straight to compileWithAutoDebug, which accepts boolean | "verbose" and only prints the rule log for "verbose". registerCSS(css, { debug: "verbose" }) failed to type-check.
  • compileWithAutoDebug always called compile(css, { ...options, logger }) with its own debug logger (or undefined), replacing any logger passed in CompilerOptions. A logger given to registerCSS or compileWithAutoDebug was never called.

Fix

  • Widen registerCSS's debug option to boolean | "verbose" | undefined, matching compileWithAutoDebug.
  • In compileWithAutoDebug, use options.logger when one is given, and fall back to the existing debug logger otherwise. Behaviour without a logger is unchanged.

Tests

Added src/__tests__/native/jest-helpers.test.ts:

  • registerCSS and compileWithAutoDebug call a given logger with the same messages compile sends it. Both fail on main (the logger receives nothing) and pass with the fix.
  • registerCSS(css, { debug: "verbose" }) logs the rules and the compiled output. On main this line fails yarn typecheck with Type 'string' is not assignable to type 'boolean | undefined'.

yarn typecheck, yarn lint on the changed files and the full yarn test suite (109 suites, 2184 tests) pass locally.

@sammoore sammoore 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.

Thanks for the contribution! Solid fix.

@danstepanov
danstepanov force-pushed the fix/register-css-debug-logger branch from 5819991 to 7fb5131 Compare December 3, 2026 01:36
@danstepanov
danstepanov merged commit 3c314b7 into nativewind:main Dec 3, 2026
6 checks passed
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.

registerCSS rejects the debug: "verbose" it passes on, and never calls a logger it is given

3 participants