# red run: ServerBrowser.ts from ff525478e2, test from working tree (head 78a6377679 + new test) $ vp test run apps/server/src/preview/ServerBrowser.test.ts -t 'closing' note: You are running `vp test` as a Vite+ built-in command. If you meant to run the test npm script, use `vpr test` instead. RUN v5.0.5 ~/wt/issue-23513 stdout | src/preview/ServerBrowser.test.ts > closing a tab runs the page's beforeunload handlers [09:46:45.507] ERROR (#1): Error [AssertionError]: expected [ 'pagehide', 'visibilitychange' ] to deeply equal [ 'beforeunload', 'pagehide', …(1) ] at ~/wt/issue-23513/apps/server/src/preview/ServerBrowser.test.ts:716:33 { actual: [ 'pagehide', 'visibilitychange' ], expected: [ 'beforeunload', 'pagehide', 'visibilitychange' ], showDiff: true, operator: 'deepStrictEqual', [cause]: undefined } stdout | src/preview/ServerBrowser.test.ts > closing an isolated tab closes its context only after the page closes [09:46:45.527] ERROR (#47): Error [AssertionError]: expected "vi.fn()" to not be called at all, but actually been called 1 times Received: 1st vi.fn() call: Array [] Number of calls: 1 at Proxy. (file://~/wt/issue-23513/node_modules/.pnpm/vitest@5.0.5_@tsc-rs+typescript@0.8.0_@types+node@24.12.4_@vitest+browser-playwright@5._a4090df6c7be8012d869871fb8a7445d/node_modules/vitest/dist/chunks/index.aTZaPVhf.js:2230:51) at Proxy. (file://~/wt/issue-23513/node_modules/.pnpm/vitest@5.0.5_@tsc-rs+typescript@0.8.0_@types+node@24.12.4_@vitest+browser-playwright@5._a4090df6c7be8012d869871fb8a7445d/node_modules/vitest/dist/chunks/index.aTZaPVhf.js:1958:14) at Proxy.methodWrapper (file://~/wt/issue-23513/node_modules/.pnpm/chai@6.3.0/node_modules/chai/index.js:1737:25) at ~/wt/issue-23513/apps/server/src/preview/ServerBrowser.test.ts:730:33 { [cause]: undefined } stdout | src/preview/ServerBrowser.test.ts > closing a tab with an unsaved-changes guard still closes it [09:46:45.544] ERROR (#93): Error [AssertionError]: expected null not to be null at ~/wt/issue-23513/apps/server/src/preview/ServerBrowser.test.ts:762:43 { actual: null, expected: null, showDiff: true, operator: 'notStrictEqual', [cause]: undefined } ❯ |t3| src/preview/ServerBrowser.test.ts (25 tests | 3 failed | 22 skipped) 111ms × closing a tab runs the page's beforeunload handlers 76ms × closing an isolated tab closes its context only after the page closes 15ms × closing a tab with an unsaved-changes guard still closes it 17ms ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 3 ⎯⎯⎯⎯⎯⎯⎯ FAIL |t3| src/preview/ServerBrowser.test.ts > closing a tab runs the page's beforeunload handlers AssertionError: expected [ 'pagehide', 'visibilitychange' ] to deeply equal [ 'beforeunload', 'pagehide', …(1) ] - Expected + Received [ - "beforeunload", "pagehide", "visibilitychange", ] ❯ src/preview/ServerBrowser.test.ts:716:33 714| yield* broker.invoke({ scope, tabId, operation: "close", input: … 715| expect(page.isClosed()).toBe(true); 716| expect(page.unloadEvents).toEqual(["beforeunload", "pagehide", "… | ^ 717| }), 718| ).pipe(Effect.provide(layer)), ❯ ~effect/Effect/successCont ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:1422:28 ❯ ~effect/Effect/evaluate ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/core.ts:585:30 ❯ FiberImpl.runLoop ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:654:41 ❯ FiberImpl.evaluate ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:595:23 ❯ FiberImpl.evaluate ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:589:27 ❯ ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:1159:17 ❯ Array. ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:1697:11 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/3]⎯ FAIL |t3| src/preview/ServerBrowser.test.ts > closing an isolated tab closes its context only after the page closes AssertionError: expected "vi.fn()" to not be called at all, but actually been called 1 times Received: 1st vi.fn() call: Array [] Number of calls: 1 ❯ src/preview/ServerBrowser.test.ts:730:33 728| page.unloadGate = Promise.withResolvers(); 729| yield* broker.invoke({ scope, tabId, operation: "close", input: … 730| expect(context.close).not.toHaveBeenCalled(); | ^ 731| expect(page.isClosed()).toBe(false); 732| page.unloadGate.resolve(); ❯ ~effect/Effect/successCont ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:1422:28 ❯ ~effect/Effect/evaluate ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/core.ts:585:30 ❯ FiberImpl.runLoop ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:654:41 ❯ FiberImpl.evaluate ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:595:23 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/3]⎯ FAIL |t3| src/preview/ServerBrowser.test.ts > closing a tab with an unsaved-changes guard still closes it AssertionError: expected null not to be null ❯ src/preview/ServerBrowser.test.ts:762:43 760| yield* broker.invoke({ scope, tabId, operation: "close", input: … 761| // The mock raises the dialog inside `close`, so an unanswered g… 762| expect(page.beforeUnloadDialog).not.toBeNull(); | ^ 763| expect(page.beforeUnloadDialog!.accept).toHaveBeenCalledTimes(1); 764| expect(page.isClosed()).toBe(true); ❯ ~effect/Effect/successCont ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:1422:28 ❯ ~effect/Effect/evaluate ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/core.ts:585:30 ❯ FiberImpl.runLoop ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:654:41 ❯ FiberImpl.evaluate ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:595:23 ❯ FiberImpl.evaluate ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:589:27 ❯ ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:1159:17 ❯ Array. ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:1697:11 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/3]⎯ Test Files 1 failed (1) Tests 3 failed | 22 skipped (25) Start at 09:46:36 Duration 9.20s (transform 65%, import 23%, setup 10%, tests 1%) exit=1