0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00

test(compiler-test-utils): read Rsbuild's logger through its API, attribute native-callback output, record each compilation report once

B5 raised the Rsbuild hosts' logLevel to 'warn' so Rsbuild-logger warnings
reached the merged channel. That also raised the HMR client's log level
(Rsbuild ties dev.client.logLevel to logLevel), so pages logged Rsbuild's
own messages. And with output printed outside any async scope sent to every
open sink (b2857ec92e), Rsbuild's logger re-printed each compile's errors
and warnings ("Build errors: ...", "build failed in 0.12s") next to the
compilation's own report: 1 ctu and 19 spc integration failures.

- Rsbuild hosts: logLevel and dev.client.logLevel are 'silent' again (the
  terminal and the page stay quiet); a customLogger (rsbuildLogger, from
  Rsbuild's public createLogger) records Rsbuild's and the plugins'
  warnings and errors in the channel, source 'rsbuild'.
- Compilation reports are recorded once, from the compilation, at an early
  `done` stage (the build host moved off onAfterBuild). reportLogged drops a
  logger message that quotes a recorded compilation message, and the
  status line of a compile that failed (a one-line error naming no file,
  in the same turn as that compile's report). Anything else is recorded.
- Output printed outside any async scope (Rolldown and Rspack native
  callbacks) goes to the channel whose claimed app root it names (hosts,
  dev servers and bundleApp claim theirs), else to all open sinks when they
  are one line of nested work, else to every open sink marked `shared`
  (expectNoProblems says so).
- budget-reporter.test.ts: concurrent tests clean up through their own
  context's onTestFinished (the global one may delete another running
  test's fixture).

Controls (each red on the old behaviour named):
- native-hook-capture.test.ts: native-callback console.warn on Vite build,
  withBuildEnvironment, Rsbuild dev and build, and "nothing reported" fails
  for it (red on B5's capture); concurrent Vite builds, Rsbuild dev servers
  and builds keep output naming their app and share unattributed output
  marked `shared` (red on B5's capture and on b2857ec92e's send-to-all).
- rsbuild-plugin-host.test.ts: a compilation warning and error appear once
  on dev and build hosts (red without the dedup; the error rows also
  without the status-line rule).
- browser.test.ts: Rsbuild's HMR client prints nothing in the page, a
  compile warning included (red with the client at B5's 'warn').

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sheraff 2026-10-21 06:09:16 +02:00
commit d7ebd24e56
No known key found for this signature in database
13 changed files with 622 additions and 92 deletions