@@ -390,15 +390,34 @@ describe('Feature lifecycle hooks', function () {
390
390
} ) ;
391
391
392
392
it ( 'executes lifecycle hooks with variable substitution' , async ( ) => {
393
- const res = await shellExec ( `${ cli } exec --workspace-folder ${ testFolder } cat /tmp/variable-substitution.testMarker` ) ;
394
- assert . strictEqual ( res . error , null ) ;
393
+ const res1 = await shellExec ( `${ cli } exec --workspace-folder ${ testFolder } cat /tmp/feature. variable-substitution.testMarker` ) ;
394
+ assert . strictEqual ( res1 . error , null ) ;
395
395
396
- const outputOfExecCommand = res . stdout ;
397
- console . log ( outputOfExecCommand ) ;
396
+ const outputOfExecCommand1 = res1 . stdout ;
397
+ console . log ( outputOfExecCommand1 ) ;
398
398
399
399
// Executes the command that was installed by the local Feature's 'postCreateCommand'.
400
- assert . match ( outputOfExecCommand , / v s c o d e / ) ;
400
+ assert . strictEqual ( outputOfExecCommand1 , ' vscode\n' ) ;
401
401
assert . match ( containerUpStandardError , / R u n n i n g t h e p o s t C r e a t e C o m m a n d f r o m F e a t u r e ' .\/ t e s t - f e a t u r e / ) ;
402
+
403
+ // substitutuin in main devcontainer.json
404
+ const res2 = await shellExec ( `${ cli } exec --workspace-folder ${ testFolder } cat /tmp/container.variable-substitution.testMarker` ) ;
405
+ assert . strictEqual ( res2 . error , null ) ;
406
+
407
+ const outputOfExecCommand2 = res2 . stdout ;
408
+ console . log ( outputOfExecCommand2 ) ;
409
+
410
+ // Executes the command that was installed by the local Feature's 'postCreateCommand'.
411
+ assert . strictEqual ( outputOfExecCommand2 , 'vscode\n' ) ;
412
+ assert . match ( containerUpStandardError , / R u n n i n g t h e p o s t C r e a t e C o m m a n d f r o m d e v c o n t a i n e r .j s o n / ) ;
413
+
414
+ // Check if substituted mount path is in use
415
+ const res3 = await shellExec ( `docker inspect ${ containerId } --format '{{json .Mounts}}'` ) ;
416
+ assert . strictEqual ( res3 . error , null ) ;
417
+
418
+ // json parse res3
419
+ const mounts = JSON . parse ( res3 . stdout ) ;
420
+ assert . exists ( mounts . find ( ( item : { Type : string ; Destination : string } ) => item . Type === 'volume' && item . Destination === '/home/vscode' ) ) ;
402
421
} ) ;
403
422
} ) ;
404
423
} ) ;
0 commit comments