Skip to content

Commit 5751450

Browse files
committed
🧪 Tests run-user-commands without workspace
1 parent f43c050 commit 5751450

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"clean": "npm-run-all clean-dist clean-built",
3838
"clean-dist": "rimraf dist",
3939
"clean-built": "rimraf built",
40-
"test": "env TS_NODE_PROJECT=src/test/tsconfig.json mocha -r ts-node/register --exit src/test/cli.build.test.ts",
40+
"test": "env TS_NODE_PROJECT=src/test/tsconfig.json mocha -r ts-node/register --exit src/test/cli.test.ts",
4141
"test-matrix": "env TS_NODE_PROJECT=src/test/tsconfig.json mocha -r ts-node/register --exit",
4242
"test-container-features": "env TS_NODE_PROJECT=src/test/tsconfig.json mocha -r ts-node/register --exit src/test/container-features/*.test.ts",
4343
"test-container-features-cli": "env TS_NODE_PROJECT=src/test/tsconfig.json mocha -r ts-node/register --exit src/test/container-features/featuresCLICommands.test.ts",

src/test/cli.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const pkg = require('../../package.json');
1212
describe('Dev Containers CLI', function () {
1313
this.timeout('120s');
1414

15-
const tmp = path.relative(process.cwd(), path.join(__dirname, 'tmp'));
15+
const tmp = path.join(__dirname, 'tmp');
1616
const cli = `npx --prefix ${tmp} devcontainer`;
1717

1818
before('Install', async () => {
@@ -27,7 +27,7 @@ describe('Dev Containers CLI', function () {
2727
});
2828

2929
describe('Command run-user-commands', () => {
30-
describe('with valid config', () => {
30+
describe.only('with valid config', () => {
3131
let containerId: string | null = null;
3232
const testFolder = `${__dirname}/configs/image`;
3333
beforeEach(async () => containerId = (await devContainerUp(cli, testFolder)).containerId);
@@ -37,6 +37,11 @@ describe('Dev Containers CLI', function () {
3737
const response = JSON.parse(res.stdout);
3838
assert.equal(response.outcome, 'success');
3939
});
40+
it('should execute successfully', async () => {
41+
const res = await shellExec(`${cli} run-user-commands`, { cwd: testFolder });
42+
const response = JSON.parse(res.stdout);
43+
assert.equal(response.outcome, 'success');
44+
});
4045
});
4146

4247
it('should fail with "not found" error when config is not found', async () => {

0 commit comments

Comments
 (0)