@@ -12,6 +12,54 @@ const nightlies = Array.from({ length: 100 }, (_, index) => ({
1212 tag_name : `v1.2.4-nightly.20261020.${ 200 - index } ` ,
1313} ) ) ;
1414
15+ describe . skipIf ( HostProcess . Platform . defaultValue ( ) !== "linux" ) ( "installer home" , ( ) => {
16+ it ( "installs a relative home from a directory ending in a newline" , async ( ) => {
17+ const temporaryRoot = await NodeFSP . realpath (
18+ await NodeFSP . mkdtemp ( NodePath . join ( NodeOS . tmpdir ( ) , "t3-install-home-" ) ) ,
19+ ) ;
20+ const root = NodePath . join ( temporaryRoot , "cwd\n" ) ;
21+ const homeName = "-custom home\\home\n" ;
22+ const home = NodePath . join ( root , homeName ) ;
23+ const version = "1.2.3" ;
24+ const target = NodePath . join ( home , "runtime/versions" , version ) ;
25+ const launcher = NodePath . join ( root , "bin/t3" ) ;
26+ try {
27+ await NodeFSP . mkdir ( target , { recursive : true } ) ;
28+ await NodeFSP . writeFile ( NodePath . join ( target , ".install-complete" ) , `${ version } \n` ) ;
29+ await NodeFSP . writeFile ( NodePath . join ( target , "t3" ) , "#!/bin/sh\necho 't3 v1.2.3'\n" , {
30+ mode : 0o755 ,
31+ } ) ;
32+ const { status, stdout, stderr } = NodeChildProcess . spawnSync (
33+ "sh" ,
34+ [ NodePath . resolve ( import . meta. dirname , "install.sh" ) ] ,
35+ {
36+ cwd : root ,
37+ env : {
38+ ...process . env ,
39+ HOME : root ,
40+ T3CODE_HOME : homeName ,
41+ T3CODE_VERSION : version ,
42+ T3CODE_INSTALL_BIN_DIR : NodePath . dirname ( launcher ) ,
43+ T3CODE_RELEASE_BASE_URL : "http://127.0.0.1:1" ,
44+ } ,
45+ encoding : "utf8" ,
46+ } ,
47+ ) ;
48+ expect ( status , stdout + stderr ) . toBe ( 0 ) ;
49+ expect ( stderr ) . toContain ( `Installed T3 Code ${ version } ` ) ;
50+ expect ( await NodeFSP . readlink ( launcher ) ) . toBe ( NodePath . join ( target , "t3" ) ) ;
51+ expect (
52+ NodeChildProcess . execFileSync ( launcher , [ "--version" ] , {
53+ cwd : NodeOS . tmpdir ( ) ,
54+ encoding : "utf8" ,
55+ } ) . trim ( ) ,
56+ ) . toBe ( "t3 v1.2.3" ) ;
57+ } finally {
58+ await NodeFSP . rm ( temporaryRoot , { recursive : true , force : true } ) ;
59+ }
60+ } ) ;
61+ } ) ;
62+
1563// regression: #22490
1664describe . skipIf ( HostProcess . Platform . defaultValue ( ) !== "linux" ) ( "installer channel lookup" , ( ) => {
1765 it . each ( [
0 commit comments