Skip to content

Commit 8564f2e

Browse files
committed
🧪 Tests outdated
1 parent 5d0778f commit 8564f2e

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-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.set-up.test.ts",
40+
"test": "env TS_NODE_PROJECT=src/test/tsconfig.json mocha -r ts-node/register --exit src/test/container-features/lockfile.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/container-features/lockfile.test.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const pkg = require('../../../package.json');
1414
describe('Lockfile', 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
before('Install', async () => {
@@ -125,7 +125,7 @@ describe('Lockfile', function () {
125125
assert.strictEqual(foo.latestMajor, '2');
126126
});
127127

128-
it('outdated command with text output', async () => {
128+
it.only('outdated command with text output', async () => {
129129
const workspaceFolder = path.join(__dirname, 'configs/lockfile-outdated-command');
130130

131131
const res = await shellExec(`${cli} outdated --workspace-folder ${workspaceFolder} --output-format text`);
@@ -151,6 +151,20 @@ describe('Lockfile', function () {
151151
assert.ok(!response.includes('terraform'));
152152
assert.ok(!response.includes('myfeatures'));
153153
});
154+
155+
it.only('outdated command without workspace', async () => {
156+
const workspaceFolder = path.join(__dirname, 'configs/lockfile-outdated-command');
157+
158+
const res = await shellExec(`${cli} outdated --output-format text`, { cwd: workspaceFolder });
159+
const response = res.stdout;
160+
// Count number of lines of output
161+
assert.strictEqual(response.split('\n').length, 7); // 5 valid Features + header + empty line
162+
163+
// Check that the header is present
164+
assert.ok(response.includes('Current'), 'Current column is missing');
165+
assert.ok(response.includes('Wanted'), 'Wanted column is missing');
166+
assert.ok(response.includes('Latest'), 'Latest column is missing');
167+
});
154168

155169
it('upgrade command', async () => {
156170
const workspaceFolder = path.join(__dirname, 'configs/lockfile-upgrade-command');

0 commit comments

Comments
 (0)