test(dev-infra): exercise replay diagnostics
This commit is contained in:
@@ -8,12 +8,10 @@ import {
|
|||||||
formatGatePlanJson,
|
formatGatePlanJson,
|
||||||
formatGatePlanList,
|
formatGatePlanList,
|
||||||
formatGateResultReason,
|
formatGateResultReason,
|
||||||
formatOnlyNotice,
|
|
||||||
gateDependencyClosure,
|
gateDependencyClosure,
|
||||||
gatePlanForMode,
|
gatePlanForMode,
|
||||||
listedGatePlan,
|
listedGatePlan,
|
||||||
parseCliRequest,
|
parseCliRequest,
|
||||||
replayCommand,
|
|
||||||
resolvePlanConcurrency,
|
resolvePlanConcurrency,
|
||||||
runGate,
|
runGate,
|
||||||
validateGatePlan,
|
validateGatePlan,
|
||||||
@@ -284,12 +282,25 @@ describe('gate plan inspection and replay', () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders a cross-platform scheduler replay and labels focused evidence', () => {
|
it('prints focused-run context and replay through a real failure block', () => {
|
||||||
const subject = plan([gate('snapshot')])
|
const result = spawnSync(process.execPath, [
|
||||||
expect(replayCommand(subject, 'snapshot')).toBe('pnpm run check:all -- --only snapshot')
|
'--import',
|
||||||
expect(formatOnlyNotice(subject, 'snapshot')).toBe(
|
'tsx',
|
||||||
'run-gates: --only snapshot is partial diagnostic evidence; the complete owning mode is pnpm run check:all.',
|
join(repositoryRoot, 'scripts/run-gates.ts'),
|
||||||
)
|
'ci-lint',
|
||||||
|
'--only',
|
||||||
|
'duplication',
|
||||||
|
], {
|
||||||
|
cwd: repositoryRoot,
|
||||||
|
encoding: 'utf8',
|
||||||
|
env: { ...process.env, npm_execpath: join(repositoryRoot, 'scripts/missing-pnpm-entrypoint.cjs') },
|
||||||
|
timeout: 10_000,
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(result.status).toBe(1)
|
||||||
|
expect(result.stdout).toContain('partial diagnostic evidence; the complete owning mode is pnpm run check:ci:lint')
|
||||||
|
expect(result.stderr).toContain('outcome: exit 1')
|
||||||
|
expect(result.stderr).toContain('replay: pnpm run check:ci:lint -- --only duplication')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('applies append and set operations through the child spawn environment', async () => {
|
it('applies append and set operations through the child spawn environment', async () => {
|
||||||
|
|||||||
@@ -796,7 +796,7 @@ export function formatGatePlanJson(plan: GatePlan): string {
|
|||||||
* @param gateId - gate to replay with its dependencies.
|
* @param gateId - gate to replay with its dependencies.
|
||||||
* @returns a shell-independent pnpm command.
|
* @returns a shell-independent pnpm command.
|
||||||
*/
|
*/
|
||||||
export function replayCommand(plan: GatePlan, gateId: string): string {
|
function replayCommand(plan: GatePlan, gateId: string): string {
|
||||||
validateGatePlan(plan)
|
validateGatePlan(plan)
|
||||||
if (!plan.gates.some(gate => gate.id === gateId)) {
|
if (!plan.gates.some(gate => gate.id === gateId)) {
|
||||||
throw new Error(`run-gates: ${plan.mode} has no gate ${JSON.stringify(gateId)}.`)
|
throw new Error(`run-gates: ${plan.mode} has no gate ${JSON.stringify(gateId)}.`)
|
||||||
@@ -810,7 +810,7 @@ export function replayCommand(plan: GatePlan, gateId: string): string {
|
|||||||
* @param gateId - selected diagnostic gate.
|
* @param gateId - selected diagnostic gate.
|
||||||
* @returns the partial-evidence notice.
|
* @returns the partial-evidence notice.
|
||||||
*/
|
*/
|
||||||
export function formatOnlyNotice(plan: GatePlan, gateId: string): string {
|
function formatOnlyNotice(plan: GatePlan, gateId: string): string {
|
||||||
return `run-gates: --only ${gateId} is partial diagnostic evidence; the complete owning mode is pnpm run ${plan.script}.`
|
return `run-gates: --only ${gateId} is partial diagnostic evidence; the complete owning mode is pnpm run ${plan.script}.`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user