test: follow the headed env helper and the typecheck gate in source-shape checks

This commit is contained in:
garrytan committed 2026-09-29 14:42:11 +00:00
1 parent 42e53413da
commit 99058ee3cd
4 files changed
+8 -11

No files matched your search

+1 -1
View File
@@ -181,7 +181,7 @@ describe('runHeadedSupervisor (behavior)', () => {
describe('buildHeadedServerEnv', () => {
test('omits proxy and config hash when this invocation has none', () => {
expect(buildHeadedServerEnv({})).toEqual({ BROWSE_HEADED: '1', BROWSE_PORT: '34567', BROWSE_PARENT_PID: '0' });
expect(buildHeadedServerEnv({ proxyUrl: null, configHash: '' })).toEqual({ BROWSE_HEADED: '1', BROWSE_PORT: '34567', BROWSE_PARENT_PID: '0' });
});
});
+6 -8
View File
@@ -8,6 +8,7 @@
import { describe, test, expect } from 'bun:test';
import * as fs from 'fs';
import * as path from 'path';
import { buildHeadedServerEnv } from '../src/cli';
const SERVER_SRC = fs.readFileSync(path.join(import.meta.dir, '../src/server.ts'), 'utf-8');
const CLI_SRC = fs.readFileSync(path.join(import.meta.dir, '../src/cli.ts'), 'utf-8');
@@ -366,15 +367,12 @@ describe('Server auth security', () => {
// The connect subprocess env must override BROWSE_PARENT_PID
expect(pairBlock).toContain("BROWSE_PARENT_PID");
expect(pairBlock).toContain("'0'");
// The connect command must propagate BROWSE_PARENT_PID=0 via the
// serverEnv object literal passed to startServer. The literal text
// `serverEnv.BROWSE_PARENT_PID` is NOT in source — the value is
// assigned via object-literal syntax (`BROWSE_PARENT_PID: '0'`)
// inside the `const serverEnv: Record<string, string> = { ... }`
// declaration. Assert both pieces appear in the connect block.
// The connect command starts its server with buildHeadedServerEnv, the
// same env the --supervise respawn uses, and that env disables the
// parent-PID watchdog.
const connectBlock = sliceBetween(CLI_SRC, 'Launching headed Chromium', 'Terminal agent started');
expect(connectBlock).toContain("const serverEnv");
expect(connectBlock).toContain("BROWSE_PARENT_PID: '0'");
expect(connectBlock).toContain('startServer(buildHeadedServerEnv(globalFlags))');
expect(buildHeadedServerEnv({ proxyUrl: null, configHash: '' }).BROWSE_PARENT_PID).toBe('0');
});
// Regression: newtab returned 403 for scoped tokens because the tab ownership
-1
View File
@@ -9,7 +9,6 @@
"browse/test/browse-client.test.ts\tTS2322\tType 'number | undefined' is not assignable to type 'number'. Type 'undefined' is not assignable to type 'number'.": 1,
"browse/test/cdp-e2e.test.ts\tTS2339\tProperty 'cleanup' does not exist on type 'BrowserManager'.": 1,
"browse/test/cdp-inspector-history-cap.test.ts\tTS2741\tProperty 'sourceLine' is missing in type '{ selector: string; property: string; oldValue: string; newValue: string; source: 'inline'; timestamp: number; method: 'setProperty'; }' but required in type 'StyleModification'.": 7,
"browse/test/cli-supervisor.test.ts\tTS2739\tType '{}' is missing the following properties from type 'Pick<GlobalFlags, \"configHash\" | \"proxyUrl\">': proxyUrl, configHash": 1,
"browse/test/commands.test.ts\tTS2300\tDuplicate identifier 'os'.": 2,
"browse/test/config.test.ts\tTS2367\tThis comparison appears to be unintentional because the types '\"abc123\"' and '\"def456\"' have no overlap.": 1,
"browse/test/config.test.ts\tTS2769\tNo overload matches this call. The last overload gave the following error. Argument of type 'string | null' is not assignable to parameter of type 'string'. Type 'null' is not assignable to type 'string'.": 1,
+1 -1
View File
@@ -318,7 +318,7 @@ describe('CSO runtime staging gates', () => {
expect(gate['continue-on-error']).not.toBe(true);
const required = workflow.jobs['free-tests'];
expect(required.if).toBe('always()');
expect(required.needs).toEqual(['free-suite', 'cso-macos-launcher', 'cso-windows-launcher', 'cso-docker-integration']);
expect(required.needs).toEqual(['free-suite', 'typecheck', 'cso-macos-launcher', 'cso-windows-launcher', 'cso-docker-integration']);
expect(required.steps[0].run).toContain('test "$CSO_DOCKER_RESULT" = success');
for (const current of Object.values(workflow.jobs) as any[]) for (const step of current.steps) {
if (step.uses?.startsWith('oven-sh/setup-bun')) expect(step.uses).toBe('oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6');