fix(cli): gitignore test scaffolding files in publish-cli tests

Tests write stdout.log/stderr.log into the test repo root, which made
`git status --porcelain` non-empty and broke test 3 (non-main branch
abort) by tripping the dirty-tree check first.

Add a .gitignore to the test fixture repo to filter out these files.
This commit is contained in:
Cheney 2026-05-12 17:57:32 +08:00
parent 1420ffac56
commit c1c12c56eb

View file

@ -95,12 +95,20 @@ NODE
EOF
chmod +x "$repo/bin/npm"
# Ignore test scaffolding files so they don't make `git status` dirty.
cat >"$repo/.gitignore" <<EOF
stdout.log
stderr.log
git-push-log.txt
bin-git/
EOF
git init -q --bare "$origin"
git -C "$repo" init -q -b main
git -C "$repo" config user.name "Test User"
git -C "$repo" config user.email "test@example.com"
git -C "$repo" remote add origin "$origin"
git -C "$repo" add cli/package.json scripts/publish-cli.sh bin/npm
git -C "$repo" add cli/package.json scripts/publish-cli.sh bin/npm .gitignore
git -C "$repo" commit -q -m "init"
git -C "$repo" push -q -u origin main