mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 00:57:45 +00:00
* fix(ci): run only selected managed SSH specs on pull requests * fix(ci): retain full SSH coverage for routed shared helpers
40 lines
1.5 KiB
JavaScript
40 lines
1.5 KiB
JavaScript
import { describe, expect, it } from 'vitest'
|
|
import { readdirSync } from 'node:fs'
|
|
import { join, resolve, sep } from 'node:path'
|
|
import { testImportClosure } from './e2e-test-import-closure.mjs'
|
|
import { MANUAL_ONLY_E2E_SPECS, selectPrE2eSpecs } from './pr-e2e-source-routing.mjs'
|
|
|
|
const projectDir = resolve(import.meta.dirname, '../..')
|
|
const MANAGED_SSH_SPEC = /^tests\/e2e\/ssh-orcad-.*\.spec\.ts$/
|
|
|
|
const allSpecs = readdirSync(join(projectDir, 'tests/e2e'), { encoding: 'utf8', recursive: true })
|
|
.map((name) => `tests/e2e/${name.split(sep).join('/')}`)
|
|
.filter((file) => file.endsWith('.spec.ts') && !MANUAL_ONLY_E2E_SPECS.includes(file))
|
|
|
|
/** Test files only managed-SSH specs import: nothing else runs when they change. */
|
|
function managedSshOnlyHarness() {
|
|
const importers = new Map()
|
|
for (const spec of allSpecs) {
|
|
for (const file of testImportClosure(projectDir, [spec])) {
|
|
if (file !== spec) {
|
|
importers.set(file, [...(importers.get(file) ?? []), spec])
|
|
}
|
|
}
|
|
}
|
|
return [...importers]
|
|
.filter(([, specs]) => specs.every((spec) => MANAGED_SSH_SPEC.test(spec)))
|
|
.map(([file]) => file)
|
|
.sort()
|
|
}
|
|
|
|
describe('managed-SSH harness route contract', () => {
|
|
it('starts the managed-SSH lane for every harness file only its specs import', () => {
|
|
const harness = managedSshOnlyHarness()
|
|
expect(harness.length).toBeGreaterThan(5)
|
|
const unrouted = harness.filter(
|
|
(file) => !selectPrE2eSpecs([file]).some((spec) => MANAGED_SSH_SPEC.test(spec))
|
|
)
|
|
expect(unrouted).toEqual([])
|
|
})
|
|
})
|