@@ -6,13 +6,22 @@ import { juliaTransportFile } from "../../../../../src/execute/julia.ts";
66const sleepQmd = docs ( "call/engine/julia/sleep.qmd" ) ;
77assert ( existsSync ( sleepQmd ) ) ;
88
9+ function assertSuccess ( output : Deno . CommandOutput ) {
10+ if ( ! output . success ) {
11+ console . error ( "Command failed:" ) ;
12+ console . error ( "stdout:\n" + new TextDecoder ( ) . decode ( output . stdout ) ) ;
13+ console . error ( "stderr:\n" + new TextDecoder ( ) . decode ( output . stderr ) ) ;
14+ throw new Error ( "Command execution was not successful" ) ;
15+ }
16+ }
17+
918// make sure we don't have a server process running by sending a kill command
1019// and then also try to remove the transport file in case one still exists
1120const killcmd = new Deno . Command (
1221 quartoDevCmd ( ) ,
1322 { args : [ "call" , "engine" , "julia" , "kill" ] }
1423) . outputSync ( ) ;
15- assert ( killcmd . success ) ;
24+ assertSuccess ( killcmd ) ;
1625try {
1726 await Deno . remove ( juliaTransportFile ( ) ) ;
1827} catch {
@@ -23,7 +32,7 @@ Deno.test("kill without server running", () => {
2332 quartoDevCmd ( ) ,
2433 { args : [ "call" , "engine" , "julia" , "kill" ] }
2534 ) . outputSync ( ) ;
26- assert ( output . success ) ;
35+ assertSuccess ( output ) ;
2736 const stderr = new TextDecoder ( ) . decode ( output . stderr ) ;
2837 assertStringIncludes ( stderr , "Julia control server is not running." ) ;
2938} ) ;
@@ -33,7 +42,7 @@ Deno.test("status without server running", () => {
3342 quartoDevCmd ( ) ,
3443 { args : [ "call" , "engine" , "julia" , "status" ] }
3544 ) . outputSync ( ) ;
36- assert ( output . success ) ;
45+ assertSuccess ( output ) ;
3746 const stderr = new TextDecoder ( ) . decode ( output . stderr ) ;
3847 assertStringIncludes ( stderr , "Julia control server is not running." ) ;
3948} ) ;
@@ -43,17 +52,16 @@ Deno.test("status with server and worker running", () => {
4352 quartoDevCmd ( ) ,
4453 { args : [ "render" , sleepQmd , "-P" , "sleep_duration:0" , "--execute-daemon" , "60" ] }
4554 ) . outputSync ( ) ;
46- assert ( render_output . success ) ;
55+ assertSuccess ( render_output ) ;
4756
4857 const status_output = new Deno . Command (
4958 quartoDevCmd ( ) ,
5059 { args : [ "call" , "engine" , "julia" , "status" ] }
5160 ) . outputSync ( ) ;
61+ assertSuccess ( status_output ) ;
5262 const stdout = new TextDecoder ( ) . decode ( status_output . stdout ) ;
53- console . log ( stdout ) ;
54- const stderr = new TextDecoder ( ) . decode ( status_output . stderr ) ;
55- console . log ( stderr ) ;
5663 assert ( status_output . success ) ;
64+
5765 assertStringIncludes ( stdout , "workers active: 1" ) ;
5866} ) ;
5967
@@ -62,7 +70,7 @@ Deno.test("log exists", () => {
6270 quartoDevCmd ( ) ,
6371 { args : [ "call" , "engine" , "julia" , "log" ] }
6472 ) . outputSync ( ) ;
65- assert ( log_output . success ) ;
73+ assertSuccess ( log_output ) ;
6674 const stdout_log = new TextDecoder ( ) . decode ( log_output . stdout ) ;
6775 assertStringIncludes ( stdout_log , "Log started at" ) ;
6876} ) ;
0 commit comments