11// Qa Lab tests cover Crabbox runtime behavior.
22import { describe , expect , it } from "vitest" ;
3- import { type CommandRunner , defaultCommandRunner , sshCommand } from "./crabbox-runtime.js" ;
3+ import {
4+ type CommandRunner ,
5+ copyCrabboxArtifacts ,
6+ defaultCommandRunner ,
7+ } from "./crabbox-runtime.js" ;
48
59describe ( "Crabbox command runner" , ( ) => {
610 it ( "preserves UTF-8 split across child-process pipe chunks" , async ( ) => {
@@ -54,7 +58,7 @@ describe("Crabbox command runner", () => {
5458 }
5559 return { stderr : "" , stdout : "" } ;
5660 } ;
57- const transport = await sshCommand ( {
61+ await copyCrabboxArtifacts ( {
5862 cwd : "/repo" ,
5963 env : { } ,
6064 inspect : {
@@ -63,21 +67,23 @@ describe("Crabbox command runner", () => {
6367 sshKey : "/tmp/key" ,
6468 sshUser : "proof" ,
6569 } ,
70+ outputDir : "/output" ,
71+ remoteOutputDir : "/remote" ,
6672 runner,
6773 } ) ;
6874
69- await runner ( "rsync" , [ "-e" , transport . sshArgs ] , { } ) ;
70-
7175 const expectedProbes = ports . length === 1 ? [ ] : ports ;
7276 expect ( calls . filter ( ( call ) => call . command === "ssh" ) . map ( ( call ) => call . args [ 3 ] ) ) . toEqual (
7377 expectedProbes ,
7478 ) ;
7579 expect ( calls . filter ( ( call ) => call . command === "ssh" ) . map ( ( call ) => call . args [ 12 ] ) ) . toEqual (
7680 expectedProbes . map ( ( ) => `proof@${ host } ` ) ,
7781 ) ;
78- expect ( transport . host ) . toBe ( host ) ;
7982 expect ( calls . filter ( ( call ) => call . command === "rsync" ) ) . toEqual ( [
80- { args : [ "-e" , expect . stringContaining ( `-p ${ ports . at ( - 1 ) } ` ) ] , command : "rsync" } ,
83+ {
84+ args : expect . arrayContaining ( [ expect . stringContaining ( `-p ${ ports . at ( - 1 ) } ` ) ] ) ,
85+ command : "rsync" ,
86+ } ,
8187 ] ) ;
8288 } ) ;
8389
@@ -92,7 +98,7 @@ describe("Crabbox command runner", () => {
9298 } ;
9399
94100 await expect (
95- sshCommand ( {
101+ copyCrabboxArtifacts ( {
96102 cwd : "/repo" ,
97103 env : { } ,
98104 inspect : {
@@ -102,6 +108,8 @@ describe("Crabbox command runner", () => {
102108 sshPort : "2222" ,
103109 sshUser : "proof" ,
104110 } ,
111+ outputDir : "/output" ,
112+ remoteOutputDir : "/remote" ,
105113 runner,
106114 } ) ,
107115 ) . rejects . toThrow ( "Permission denied" ) ;
0 commit comments