@@ -857,7 +857,7 @@ describe('docker-manager', () => {
857857 expect ( volumes ) . toContain ( `${ workspaceDir } :/host${ workspaceDir } :rw` ) ;
858858 } ) ;
859859
860- it ( 'should mount Rust toolchain, npm cache , and CLI state directories' , ( ) => {
860+ it ( 'should mount Rust toolchain, Node/ npm caches , and CLI state directories' , ( ) => {
861861 const result = generateDockerCompose ( mockConfig , mockNetworkConfig ) ;
862862 const agent = result . services . agent ;
863863 const volumes = agent . volumes as string [ ] ;
@@ -868,6 +868,8 @@ describe('docker-manager', () => {
868868 expect ( volumes ) . toContain ( `${ homeDir } /.rustup:/host${ homeDir } /.rustup:rw` ) ;
869869 // npm cache
870870 expect ( volumes ) . toContain ( `${ homeDir } /.npm:/host${ homeDir } /.npm:rw` ) ;
871+ // nvm-managed Node.js cache/installations
872+ expect ( volumes ) . toContain ( `${ homeDir } /.nvm:/host${ homeDir } /.nvm:rw` ) ;
871873 // CLI state directories
872874 expect ( volumes ) . toContain ( `${ homeDir } /.claude:/host${ homeDir } /.claude:rw` ) ;
873875 expect ( volumes ) . toContain ( `${ homeDir } /.anthropic:/host${ homeDir } /.anthropic:rw` ) ;
@@ -944,6 +946,26 @@ describe('docker-manager', () => {
944946 expect ( environment . AWF_CHROOT_ENABLED ) . toBe ( 'true' ) ;
945947 } ) ;
946948
949+ it ( 'should set AWF_REQUIRE_NODE when running Copilot CLI command' , ( ) => {
950+ const result = generateDockerCompose (
951+ { ...mockConfig , agentCommand : 'copilot --version' } ,
952+ mockNetworkConfig ,
953+ ) ;
954+ const environment = result . services . agent . environment as Record < string , string > ;
955+
956+ expect ( environment . AWF_REQUIRE_NODE ) . toBe ( '1' ) ;
957+ } ) ;
958+
959+ it ( 'should not set AWF_REQUIRE_NODE for non-Copilot commands' , ( ) => {
960+ const result = generateDockerCompose (
961+ { ...mockConfig , agentCommand : 'echo test' } ,
962+ mockNetworkConfig ,
963+ ) ;
964+ const environment = result . services . agent . environment as Record < string , string > ;
965+
966+ expect ( environment . AWF_REQUIRE_NODE ) . toBeUndefined ( ) ;
967+ } ) ;
968+
947969 it ( 'should pass GOROOT, CARGO_HOME, RUSTUP_HOME, JAVA_HOME, DOTNET_ROOT, BUN_INSTALL to container when env vars are set' , ( ) => {
948970 const originalGoroot = process . env . GOROOT ;
949971 const originalCargoHome = process . env . CARGO_HOME ;
@@ -3641,7 +3663,7 @@ describe('docker-manager', () => {
36413663 // Verify chroot home subdirectories were created
36423664 const expectedDirs = [
36433665 '.copilot' , '.cache' , '.config' , '.local' ,
3644- '.anthropic' , '.claude' , '.gemini' , '.cargo' , '.rustup' , '.npm' ,
3666+ '.anthropic' , '.claude' , '.gemini' , '.cargo' , '.rustup' , '.npm' , '.nvm' ,
36453667 ] ;
36463668 for ( const dir of expectedDirs ) {
36473669 expect ( fs . existsSync ( path . join ( fakeHome , dir ) ) ) . toBe ( true ) ;
0 commit comments