@@ -14,7 +14,7 @@ const pkg = require('../../package.json');
1414describe ( 'Dev Containers CLI' , function ( ) {
1515 this . timeout ( '240s' ) ;
1616
17- const tmp = path . relative ( process . cwd ( ) , path . join ( __dirname , 'tmp' ) ) ;
17+ const tmp = path . join ( __dirname , 'tmp' ) ;
1818 const cli = `npx --prefix ${ tmp } devcontainer` ;
1919
2020
@@ -26,7 +26,7 @@ describe('Dev Containers CLI', function () {
2626
2727 describe ( 'Command up' , ( ) => {
2828
29- it ( 'should execute successfully with valid config' , async ( ) => {
29+ it . only ( 'should execute successfully with valid config' , async ( ) => {
3030 const res = await shellExec ( `${ cli } up --workspace-folder ${ __dirname } /configs/image --include-configuration --include-merged-configuration` ) ;
3131 const response = JSON . parse ( res . stdout ) ;
3232 assert . equal ( response . outcome , 'success' ) ;
@@ -69,6 +69,15 @@ describe('Dev Containers CLI', function () {
6969 assert . equal ( success , false , 'expect non-successful call' ) ;
7070 } ) ;
7171
72+ it . only ( 'should succeed when run without a workspace-folder in a workspace root' , async ( ) => {
73+ const res = await shellExec ( `${ cli } up` , { cwd : `${ __dirname } /configs/image-with-features` } ) ;
74+ const response = JSON . parse ( res . stdout ) ;
75+ assert . equal ( response . outcome , 'success' ) ;
76+ const containerId : string = response . containerId ;
77+ assert . ok ( containerId , 'Container id not found.' ) ;
78+ await shellExec ( `docker rm -f ${ containerId } ` ) ;
79+ } ) ;
80+
7281 // docker-compose variations _without_ features are here (under 'up' tests)
7382 // docker-compose variations _with_ features are under 'exec' to test features are installed
7483 describe ( 'for docker-compose with image without features' , ( ) => {
@@ -283,7 +292,7 @@ describe('Dev Containers CLI', function () {
283292 assert . equal ( 'Hello, World!' , evalEnvWithCommand . stdout ) ;
284293
285294 const envWithTestMessage = await shellExec ( `docker exec ${ containerId } bash -c 'echo -n $Test_Message'` ) ;
286- assert . equal ( 'H"\\n\\ne"\'\'\'llo M:;a/t?h&^iKa%#@!``ni,sk_a-' , envWithTestMessage . stdout ) ;
295+ assert . equal ( 'H"\\n\\ne"\'\'\'llo M:;a/t?h&^iKa%#@!``ni,sk_a-' , envWithTestMessage . stdout ) ;
287296
288297 const envWithFormat = await shellExec ( `docker exec ${ containerId } bash -c 'echo -n $ROSCONSOLE_FORMAT'` ) ;
289298 assert . equal ( '[$${severity}] [$${walltime:%Y-%m-%d %H:%M:%S}] [$${node}]: $${message}' , envWithFormat . stdout ) ;
@@ -295,10 +304,10 @@ describe('Dev Containers CLI', function () {
295304 assert . equal ( 'value with $dollar sign' , envWithDollar . stdout ) ;
296305
297306 const envWithBackSlash = await shellExec ( `docker exec ${ containerId } bash -c 'echo -n $VAR_WITH_BACK_SLASH'` ) ;
298- assert . equal ( 'value with \\back slash' , envWithBackSlash . stdout ) ;
307+ assert . equal ( 'value with \\back slash' , envWithBackSlash . stdout ) ;
299308
300309 await shellExec ( `docker rm -f ${ containerId } ` ) ;
301- } ) ;
310+ } ) ;
302311
303312 it ( 'should run with config in subfolder' , async ( ) => {
304313 const upRes = await shellExec ( `${ cli } up --workspace-folder ${ __dirname } /configs/dockerfile-without-features --config ${ __dirname } /configs/dockerfile-without-features/.devcontainer/subfolder/devcontainer.json` ) ;
0 commit comments