@@ -12,6 +12,58 @@ 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 . each ( [
17+ { kind : "default" , homeName : ".t3" } ,
18+ { kind : "absolute" , homeName : "absolute home" } ,
19+ { kind : "relative" , homeName : "custom-home" } ,
20+ { kind : "relative" , homeName : "custom home" } ,
21+ { kind : "relative" , homeName : "-custom\\home\n" } ,
22+ ] ) ( "installs an executable link with $kind home $homeName" , async ( { kind, homeName } ) => {
23+ const root = await NodeFSP . realpath (
24+ await NodeFSP . mkdtemp ( NodePath . join ( NodeOS . tmpdir ( ) , "t3-install-home-" ) ) ,
25+ ) ;
26+ const home = NodePath . join ( root , homeName ) ;
27+ const version = "1.2.3" ;
28+ const target = NodePath . join ( home , "runtime/versions" , version ) ;
29+ const launcher = NodePath . join ( root , "bin/t3" ) ;
30+ try {
31+ await NodeFSP . mkdir ( target , { recursive : true } ) ;
32+ await NodeFSP . writeFile ( NodePath . join ( target , ".install-complete" ) , `${ version } \n` ) ;
33+ await NodeFSP . writeFile ( NodePath . join ( target , "t3" ) , "#!/bin/sh\necho 't3 v1.2.3'\n" , {
34+ mode : 0o755 ,
35+ } ) ;
36+ const { status, stdout, stderr } = NodeChildProcess . spawnSync (
37+ "sh" ,
38+ [ NodePath . resolve ( import . meta. dirname , "install.sh" ) ] ,
39+ {
40+ cwd : root ,
41+ env : {
42+ ...process . env ,
43+ HOME : root ,
44+ T3CODE_HOME : kind === "default" ? undefined : kind === "absolute" ? home : homeName ,
45+ T3CODE_VERSION : version ,
46+ T3CODE_INSTALL_BIN_DIR : NodePath . dirname ( launcher ) ,
47+ T3CODE_RELEASE_BASE_URL : "http://127.0.0.1:1" ,
48+ } ,
49+ encoding : "utf8" ,
50+ } ,
51+ ) ;
52+ expect ( status , stdout + stderr ) . toBe ( 0 ) ;
53+ expect ( stderr ) . toContain ( `Installed T3 Code ${ version } ` ) ;
54+ expect ( await NodeFSP . readlink ( launcher ) ) . toBe ( NodePath . join ( target , "t3" ) ) ;
55+ expect (
56+ NodeChildProcess . execFileSync ( launcher , [ "--version" ] , {
57+ cwd : NodeOS . tmpdir ( ) ,
58+ encoding : "utf8" ,
59+ } ) . trim ( ) ,
60+ ) . toBe ( "t3 v1.2.3" ) ;
61+ } finally {
62+ await NodeFSP . rm ( root , { recursive : true , force : true } ) ;
63+ }
64+ } ) ;
65+ } ) ;
66+
1567// regression: #22490
1668describe . skipIf ( HostProcess . Platform . defaultValue ( ) !== "linux" ) ( "installer channel lookup" , ( ) => {
1769 it . each ( [
0 commit comments