mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
Extract subprocess execution and process contracts into @orca/process-host with explicit public entry points, independent checks, and one Node 18 compatible CommonJS runtime. Migrate application consumers and integrate package builds, dependency selection, import enforcement, and runtime resource staging. Preserve daemon startup ownership and profile isolation, and qualify development rebuild recovery and concurrent output publication. Remove unnecessary aliases, test forwarding exports, and a duplicate output scan. Validation: full typechecks, changed-code quality, package and artifact checks, native Windows builds/types plus 306 runtime tests, and independent native reviews. Matched full E2E controls on original main and unchanged reviewed head both pass all 17 applicable tests (nine skips). Earlier intermittent E2E failures are documented in the PR; no assertions were weakened. The final combined-tree audit preserves both branches with no import-boundary violations.
74 lines
2.7 KiB
JavaScript
74 lines
2.7 KiB
JavaScript
import { mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
|
|
import { createRequire } from 'node:module'
|
|
import { tmpdir } from 'node:os'
|
|
import { dirname, join } from 'node:path'
|
|
import { expect, it } from 'vitest'
|
|
import { runProcess } from '@orca/process-host'
|
|
import { planE2e, verifyE2eSelection } from './ci-e2e-shard-plan.mjs'
|
|
|
|
const require = createRequire(import.meta.url)
|
|
|
|
it('native Playwright test-list preserves full discovery, serial suites, skips and headful filtering', async () => {
|
|
const directory = realpathSync(mkdtempSync(join(tmpdir(), 'orca-playwright-shards-')))
|
|
const testPackage = JSON.stringify(require.resolve('@stablyai/playwright-test'))
|
|
const config = join(directory, 'playwright.config.cjs')
|
|
writeFileSync(
|
|
config,
|
|
`module.exports = { testDir: '.', fullyParallel: true, projects: [{ name: 'electron-headless', grepInvert: /@headful/ }] }`
|
|
)
|
|
for (let index = 0; index < 17; index++) {
|
|
writeFileSync(
|
|
join(directory, `file-${index}.spec.cjs`),
|
|
`
|
|
const { test } = require(${testPackage});
|
|
test('normal', () => {});
|
|
test.skip('skipped', () => {});
|
|
test('visible @headful', () => {});
|
|
test.describe.serial('serial', () => {
|
|
test('first', () => {});
|
|
test('second', () => {});
|
|
});
|
|
`
|
|
)
|
|
}
|
|
async function discover(extra = []) {
|
|
const result = await runProcess({
|
|
program: process.execPath,
|
|
cwd: directory,
|
|
args: [
|
|
join(dirname(require.resolve('playwright/package.json')), 'cli.js'),
|
|
'test',
|
|
'--config',
|
|
config,
|
|
'--list',
|
|
'--reporter=json',
|
|
...extra
|
|
],
|
|
env: { ...process.env, ORCA_BACKGROUND_LAUNCH: '1' },
|
|
timeoutMs: 20000
|
|
})
|
|
expect(result.code, result.stderr).toBe(0)
|
|
return JSON.parse(result.stdout)
|
|
}
|
|
try {
|
|
const full = await discover()
|
|
const assignment = planE2e(full, 3, { timings: {} })
|
|
const ids = []
|
|
for (let index = 0; index < 3; index++) {
|
|
const path = join(directory, 'selected.txt')
|
|
writeFileSync(path, `${assignment.shards[index].files.join('\n')}\n`)
|
|
const selected = await discover(['--test-list', path])
|
|
verifyE2eSelection({ ...assignment, selectedShard: index + 1 }, selected)
|
|
for (const suite of selected.suites) {
|
|
expect(suite.specs.some((spec) => spec.title.includes('@headful'))).toBe(false)
|
|
}
|
|
ids.push(...assignment.shards[index].files.flatMap((file) => assignment.testsByFile[file]))
|
|
}
|
|
expect(ids).toHaveLength(17 * 4)
|
|
expect(new Set(ids).size).toBe(ids.length)
|
|
expect(() => verifyE2eSelection({ ...assignment, selectedShard: 1 }, full)).toThrow('differs')
|
|
} finally {
|
|
rmSync(directory, { recursive: true, force: true })
|
|
}
|
|
}, 60000)
|