@@ -9,10 +9,16 @@ import * as NodePath from "node:path";
99import { describe , expect , it } from "vite-plus/test" ;
1010
1111describe . skipIf ( HostProcess . Platform . defaultValue ( ) !== "linux" ) ( "installer terminal" , ( ) => {
12- it . each ( [ false , true ] ) (
13- "preserves download and install behavior (HTTP failure: %s)" ,
14- async ( fail ) => {
12+ it . each ( [
13+ { fail : false , homeName : "home" } ,
14+ { fail : true , homeName : "home" } ,
15+ { fail : false , homeName : "home\\data" } ,
16+ { fail : false , homeName : "home\ndata" } ,
17+ ] ) (
18+ "preserves download and install behavior (HTTP failure: $fail, home: $homeName)" ,
19+ async ( { fail, homeName } ) => {
1520 const root = await NodeFSP . mkdtemp ( NodePath . join ( NodeOS . tmpdir ( ) , "t3-install-progress-" ) ) ;
21+ const t3Home = NodePath . join ( root , homeName ) ;
1622 const version = "1.2.3" ;
1723 const stem = `t3-${ version } -linux-${ HostProcess . Architecture . defaultValue ( ) } ` ;
1824 const archiveName = `${ stem } .tar.gz` ;
@@ -60,7 +66,7 @@ describe.skipIf(HostProcess.Platform.defaultValue() !== "linux")("installer term
6066 TERM : "xterm" ,
6167 NO_COLOR : "1" ,
6268 T3CODE_VERSION : version ,
63- T3CODE_HOME : NodePath . join ( root , "home" ) ,
69+ T3CODE_HOME : t3Home ,
6470 T3CODE_INSTALL_BIN_DIR : NodePath . join ( root , "bin" ) ,
6571 T3CODE_RELEASE_BASE_URL : `http://127.0.0.1:${ address . port } ` ,
6672 } ,
@@ -80,15 +86,15 @@ describe.skipIf(HostProcess.Platform.defaultValue() !== "linux")("installer term
8086 child . on ( "error" , reject ) ;
8187 child . on ( "close" , resolve ) ;
8288 } ) ;
83- const versions = NodePath . join ( root , "home/ runtime/versions" ) ;
89+ const versions = NodePath . join ( t3Home , "runtime/versions" ) ;
8490 if ( fail ) {
8591 expect ( code ) . not . toBe ( 0 ) ;
8692 expect ( output ) . toContain ( "500" ) ;
8793 expect ( output ) . not . toContain ( "100%" ) ;
8894 expect ( output ) . not . toContain ( "Installed T3 Code" ) ;
8995 expect ( await NodeFSP . readdir ( versions ) ) . toEqual ( [ ] ) ;
9096 } else {
91- expect ( code ) . toBe ( 0 ) ;
97+ expect ( code , output ) . toBe ( 0 ) ;
9298 expect ( sawPartialProgress ) . toBe ( true ) ;
9399 expect ( output ) . toContain ( "100%" ) ;
94100 expect ( output ) . toContain ( "0.1 / 0.1 MB" ) ;
@@ -102,9 +108,9 @@ describe.skipIf(HostProcess.Platform.defaultValue() !== "linux")("installer term
102108 } ) . trim ( ) ,
103109 ) . toBe ( "t3 v1.2.3" ) ;
104110 expect ( await NodeFSP . readdir ( versions ) ) . toEqual ( [ version ] ) ;
105- expect (
106- await NodeFSP . readFile ( NodePath . join ( root , "home/runtime/launchers" ) , "utf8" ) ,
107- ) . toBe ( ` ${ NodePath . join ( root , "bin/t3" ) } \n` ) ;
111+ expect ( await NodeFSP . readFile ( NodePath . join ( t3Home , "runtime/launchers" ) , "utf8" ) ) . toBe (
112+ ` ${ NodePath . join ( root , "bin/t3" ) } \n` ,
113+ ) ;
108114 }
109115 } finally {
110116 if ( child . exitCode === null ) child . kill ( ) ;
0 commit comments