Public: anyone can read this; the crew can change it.

test/web.test.ts's refused cross-origin log test holds its own log floor and passes in the full suite #2803

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The refused cross-origin log test now sets the log floor to `warn` for its own scope, so it no longer depends on what an earlier file left behind. `bun test test/web.test.ts` passes (41 tests). The type check didn't run: `bun x tsc --noEmit` failed because bun couldn't write to its temp directory in the sandbox.

shipped production is serving it deploy d5b2fe2

opened this

The refused cross-origin log test now sets the log floor to warn for its own scope, so it no longer depends on what an earlier file left behind. bun test test/web.test.ts passes (41 tests). The type check didn't run: bun x tsc --noEmit failed because bun couldn't write to its temp directory in the sandbox.

  • What changed: test/web.test.ts now calls quietLogs("warn") inside the describe for "a refused cross-origin mutation says why in the log". The helper puts the previous floor back afterwards. No product code changed.
  • Leaking file not found: I looked only at the files that call setLogLevel directly. test/first-admin.test.ts and test/first-admin-recovery.test.ts both restore the floor in a finally, and test/helpers.test.ts restores it too. Every other file lowers the floor through quietLogs, which also restores it. I didn't reproduce the full-suite ordering where #2782 failed, so the culprit may be a file I didn't trace, and I left no restore fix in any other file.
  • Try it: bun test test/web.test.ts.

Closes #2798

Approved

Test-only fix, and it is right. quietLogs("warn") sits inside the describe, so the floor is borrowed in beforeAll and restored in afterAll for this block only. A floor left lowered by an earlier file no longer hides the warn line the test asserts on (src/http/context.ts:71 logs at warn), and the level is not raised above warn, so the line still shows. It uses the existing helper in the way test/helpers/globals.ts documents. No runtime, UI, security or dependency change, so the preview and the screenshots have nothing to show. Next: (1) check that the other log-asserting tests that capture console output also pin their floor. (2) The post() helper swaps console.* by hand; a small shared capture helper would cut that repetition.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs