From 873e57d78fb21cb2c4e52e9172986a8bab0a36fe Mon Sep 17 00:00:00 2001 From: Andrey Epifancev Date: Sat, 24 Oct 2026 21:36:13 +0400 Subject: [PATCH] test(dsh): --check stays offline and reports the git sha (#67) --- dsh/tests/install.test.mjs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/dsh/tests/install.test.mjs b/dsh/tests/install.test.mjs index 0854357..19fef04 100644 --- a/dsh/tests/install.test.mjs +++ b/dsh/tests/install.test.mjs @@ -463,3 +463,32 @@ test('a manual non-git checkout is used but not updated', () => { cleanup(home) } }) + +test('--check reports the git sha of the managed checkout', () => { + const home = tempDir() + try { + const repo = makeSuperpowersRepo(home) + const sha = git(repo, ['rev-parse', '--short', 'HEAD']) + assert.equal(runInstaller(home, ['--skills'], { DSH_SUPERPOWERS_REPO: gitUrl(repo) }).status, 0) + const run = runInstaller(home, ['--check']) + const out = run.stdout + run.stderr + assert.equal(run.status, 0, out) + assert.match(out, new RegExp(`ok: superpowers source \\(.*superpowers/skills, git ${sha}\\)`)) + } finally { + cleanup(home) + } +}) + +test('--check never clones on an empty HOME', () => { + const home = tempDir() + try { + const repo = makeSuperpowersRepo(home) + const run = runInstaller(home, ['--check'], { DSH_SUPERPOWERS_REPO: gitUrl(repo) }) + const out = run.stdout + run.stderr + assert.equal(run.status, 0, out) + assert.equal(existsSync(join(home, '.dsh', 'superpowers')), false, '--check must not clone') + assert.match(out, /WARN: no superpowers source/) + } finally { + cleanup(home) + } +})