Files
orca/config/scripts/test-only-source-path.test.mjs
T
Brennan Benson 508419f11e test: check structured-chat code for Electron imports even before the runtime loads it (#24988)
* test: keep structured chat free of Electron imports

* test: widen runtime Electron ratchet to structured chat

* test: check whole structured-chat directories for Electron imports

Cover src/main/{native-chat,claude,codex}, src/shared and every structured-*
or agent-session-* file under src/main/runtime, so new files are checked by
default. A lane that exists today now fails loudly if it goes missing; only
the not-yet-landed acp/ and provider-process/ may be absent.

Move the test-only file rule into one classifier shared with the
localization audit, so -test-<thing> helpers and test doubles no longer
enter the production gate.

* test: run the Electron-import CLI path in tests and retire may-be-absent lanes

Export main() so the real-tree tests exercise the entry list CI uses,
check every required lane for the missing-directory error, and fail once
acp/ or provider-process/ exists while still allowed to be absent.
2026-10-05 14:48:33 -07:00

42 lines
1.6 KiB
JavaScript

import { describe, expect, it } from 'vitest'
import { isTestOnlySourcePath } from './test-only-source-path.mjs'
describe('isTestOnlySourcePath', () => {
it('matches specs, helpers and doubles beside a spec, and test directories', () => {
for (const file of [
'src/main/a/reader.test.ts',
'src/main/a/reader.spec.tsx',
'src/main/a/reader.test-support.ts',
'src/main/a/structured-agent-session-rest-test-rig.ts',
'src/main/a/structured-agent-session-host-test-data.ts',
'src/main/a/ipc-events-test-fixtures.ts',
'src/main/a/routing-fixture.ts',
'src/main/a/codex-turn-lifecycle-fake.ts',
'src/main/a/github-ipc-module-mocks.ts',
'src/main/a/settled-pty-write-stub.ts',
'src/main/a/subscription-registry-test-double.ts',
'src/main/a/__tests__/reader.ts',
'src/main/a/__fixtures__/reader.ts',
'src/main/a/test-support/reader.ts',
'src/main/runtime/orca-runtime-tests/setup.ts',
'src/main/runtime/orca-runtime-test-mocks/store.ts'
]) {
expect(isTestOnlySourcePath(file), file).toBe(true)
}
})
it('keeps shipped modules whose names merely mention testing or fixtures', () => {
for (const file of [
'src/shared/relay-runtime-self-test-report.ts',
'src/main/ssh/ssh-relay-runtime-self-test.ts',
'src/main/ipc/local-network-connection-test.ts',
'src/main/updater/latest-release.ts',
'src/renderer/src/components/browser-pane/fixture-picker.tsx',
'src/renderer/src/components/settings/fixtures-panel.tsx',
'src/main/contest/entry.ts'
]) {
expect(isTestOnlySourcePath(file), file).toBe(false)
}
})
})