@@ -27,13 +27,26 @@ describe('Dev Containers CLI', function () {
2727
2828 describe ( 'Command build' , ( ) => {
2929
30- it ( 'should build successfully with valid image metadata --label property' , async ( ) => {
30+ it ( 'should build successfully with valid image metadata --label property (image) ' , async ( ) => {
3131 const testFolder = `${ __dirname } /configs/example` ;
3232 const response = await shellExec ( `${ cli } build --workspace-folder ${ testFolder } --label 'name=label-test' --label 'type=multiple-labels'` ) ;
3333 const res = JSON . parse ( response . stdout ) ;
3434 assert . equal ( res . outcome , 'success' ) ;
35- const labels = await shellExec ( `docker inspect --format '{{json .Config.Labels}}' ${ res . imageName } | jq` ) ;
36- assert . match ( labels . stdout . toString ( ) , / \" n a m e \" : \" l a b e l - t e s t \" / ) ;
35+ const labelsResponse = await shellExec ( `docker inspect --format '{{json .Config.Labels}}' ${ res . imageName } ` ) ;
36+ const labels = JSON . parse ( labelsResponse . stdout ) ;
37+ assert . equal ( labels . name , 'label-test' ) ;
38+ assert . equal ( labels . type , 'multiple-labels' ) ;
39+ } ) ;
40+
41+ it ( 'should build successfully with valid image metadata --label property (dockerfile)' , async ( ) => {
42+ const testFolder = `${ __dirname } /configs/example-dockerfile` ;
43+ const response = await shellExec ( `${ cli } build --workspace-folder ${ testFolder } --label 'name=label-test' --label 'type=multiple-labels'` ) ;
44+ const res = JSON . parse ( response . stdout ) ;
45+ assert . equal ( res . outcome , 'success' ) ;
46+ const labelsResponse = await shellExec ( `docker inspect --format '{{json .Config.Labels}}' ${ res . imageName } ` ) ;
47+ const labels = JSON . parse ( labelsResponse . stdout ) ;
48+ assert . equal ( labels . name , 'label-test' ) ;
49+ assert . equal ( labels . type , 'multiple-labels' ) ;
3750 } ) ;
3851
3952 it ( 'should fail to build with correct error message for local feature' , async ( ) => {
0 commit comments