mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 12:16:38 +00:00
fix(browser): address platform and port review
This commit is contained in:
1 parent
06f6f5485f
commit
8a17410f96
7 files changed
+87
-18
No files matched your search
@@ -199,4 +199,45 @@ describe('browser status', () => {
|
||||
codexSpy.mockRestore();
|
||||
}
|
||||
});
|
||||
|
||||
it('always forwards an explicit port for config-backed browser attach sessions', async () => {
|
||||
mutateUnifiedConfig((config) => {
|
||||
config.browser = {
|
||||
claude: {
|
||||
enabled: true,
|
||||
user_data_dir: '/tmp/config-browser',
|
||||
devtools_port: 9222,
|
||||
},
|
||||
codex: {
|
||||
enabled: true,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
const runtimeSpy = spyOn(chromeReuse, 'resolveBrowserRuntimeEnv').mockResolvedValue({
|
||||
CCS_BROWSER_USER_DATA_DIR: '/tmp/config-browser',
|
||||
CCS_BROWSER_DEVTOOLS_HOST: '127.0.0.1',
|
||||
CCS_BROWSER_DEVTOOLS_PORT: '9222',
|
||||
CCS_BROWSER_DEVTOOLS_HTTP_URL: 'http://127.0.0.1:9222',
|
||||
CCS_BROWSER_DEVTOOLS_WS_URL: 'ws://127.0.0.1/devtools/browser/config',
|
||||
});
|
||||
const codexSpy = spyOn(codexDetector, 'getCodexBinaryInfo').mockReturnValue({
|
||||
path: '/usr/local/bin/codex',
|
||||
needsShell: false,
|
||||
version: 'codex-cli 0.120.0',
|
||||
features: ['config-overrides'],
|
||||
});
|
||||
|
||||
try {
|
||||
await getBrowserStatus();
|
||||
|
||||
expect(runtimeSpy.mock.calls[0]?.[0]).toEqual({
|
||||
profileDir: '/tmp/config-browser',
|
||||
devtoolsPort: '9222',
|
||||
});
|
||||
} finally {
|
||||
runtimeSpy.mockRestore();
|
||||
codexSpy.mockRestore();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
import { describe, expect, it } from 'bun:test';
|
||||
import { getNodePlatformKey } from '../../../../src/utils/browser/platform';
|
||||
|
||||
describe('browser platform helper', () => {
|
||||
it('maps darwin explicitly', () => {
|
||||
expect(getNodePlatformKey('darwin')).toBe('darwin');
|
||||
});
|
||||
|
||||
it('maps win32 explicitly', () => {
|
||||
expect(getNodePlatformKey('win32')).toBe('win32');
|
||||
});
|
||||
|
||||
it('falls back to linux for other node platforms', () => {
|
||||
expect(getNodePlatformKey('linux')).toBe('linux');
|
||||
expect(getNodePlatformKey('freebsd')).toBe('linux');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user