Skip to content

Commit 3e34e78

Browse files
committed
upgrade command test
1 parent fc5e570 commit 3e34e78

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/test/container-features/lockfile.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,24 @@ describe('Lockfile', function () {
278278
process.chdir(originalCwd);
279279
}
280280
});
281+
282+
it('upgrade command should work with default workspace folder', async () => {
283+
const workspaceFolder = path.join(__dirname, 'configs/lockfile-upgrade-command');
284+
const absoluteTmpPath = path.resolve(__dirname, 'tmp');
285+
const absoluteCli = `npx --prefix ${absoluteTmpPath} devcontainer`;
286+
287+
const lockfilePath = path.join(workspaceFolder, '.devcontainer-lock.json');
288+
await cpLocal(path.join(workspaceFolder, 'outdated.devcontainer-lock.json'), lockfilePath);
289+
290+
const originalCwd = process.cwd();
291+
try {
292+
process.chdir(workspaceFolder);
293+
await shellExec(`${absoluteCli} upgrade`);
294+
const actual = await readLocalFile(lockfilePath);
295+
const expected = await readLocalFile(path.join(workspaceFolder, 'upgraded.devcontainer-lock.json'));
296+
assert.equal(actual.toString(), expected.toString());
297+
} finally {
298+
process.chdir(originalCwd);
299+
}
300+
});
281301
});

0 commit comments

Comments
 (0)