fix: tests

This commit is contained in:
Eric
2026-03-04 08:44:11 +01:00
parent 6cc7204cb3
commit ea244a8bb2
11 changed files with 151 additions and 94 deletions

View File

@@ -5,16 +5,7 @@ bun_path="$1"
workdir="$(mktemp -d)"
trap 'rm -rf "${workdir}"' EXIT
cat > "${workdir}/package.json" <<'JSON'
{
"name": "stale-lockfile-test",
"version": "1.0.0"
}
JSON
"${bun_path}" install --cwd "${workdir}" >/dev/null
cat > "${workdir}/package.json" <<'JSON'
cat >"${workdir}/package.json" <<'JSON'
{
"name": "stale-lockfile-test",
"version": "1.0.0",
@@ -24,6 +15,18 @@ cat > "${workdir}/package.json" <<'JSON'
}
JSON
"${bun_path}" install --cwd "${workdir}" >/dev/null
cat >"${workdir}/package.json" <<'JSON'
{
"name": "stale-lockfile-test",
"version": "1.0.0",
"dependencies": {
"left-pad": "1.1.3"
}
}
JSON
set +e
output="$(${bun_path} install --cwd "${workdir}" --frozen-lockfile 2>&1)"
code=$?
@@ -34,7 +37,7 @@ if [[ ${code} -eq 0 ]]; then
exit 1
fi
if [[ "${output}" != *"lockfile"* && "${output}" != *"frozen"* ]]; then
if [[ ${output} != *"lockfile"* && ${output} != *"frozen"* ]]; then
echo "Expected lockfile-related error, got:" >&2
echo "${output}" >&2
exit 1