test(dsh): --check stays offline and reports the git sha (#67)
This commit is contained in:
parent
b292a38818
commit
873e57d78f
@ -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)
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user