Skip to content

Commit ac5f088

Browse files
committed
test(ci): use the empty tree as the base with no auth manifest
CI checks out at depth 1, where HEAD has no parents, so `git rev-list --max-parents=0 HEAD` returned HEAD itself and the test compared the manifest against its own tree.
1 parent d05a868 commit ac5f088

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

‎scripts/__tests__/check-auth-npm-changeset.test.mjs‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,10 @@ describe('check-auth-npm-changeset.mjs --shipped', () => {
213213
})
214214

215215
it('keeps a manifest the base commit does not have', () => {
216-
// The root commit predates the auth package.
217-
const root = spawnSync('git', ['rev-list', '--max-parents=0', 'HEAD'], {
218-
cwd: REPO_ROOT,
219-
encoding: 'utf8',
220-
}).stdout.split('\n')[0]
221-
const result = shipped(root, [`${AUTH}/package.json`])
216+
// The empty tree contains no files and exists in every clone, shallow
217+
// ones included; CI's depth-1 checkout makes HEAD its own root commit.
218+
const EMPTY_TREE = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'
219+
const result = shipped(EMPTY_TREE, [`${AUTH}/package.json`])
222220
expect(result.status).toBe(0)
223221
expect(result.stdout.trim()).toBe(`${AUTH}/package.json`)
224222
})

0 commit comments

Comments
 (0)