diff --git a/e2e/npm_translate_lock_auth/test.sh b/e2e/npm_translate_lock_auth/test.sh index ae8ad334c9..e56130cb5d 100755 --- a/e2e/npm_translate_lock_auth/test.sh +++ b/e2e/npm_translate_lock_auth/test.sh @@ -28,7 +28,18 @@ else _sedi 's#npmrc = "//:.npmrc",#use_home_npmrc = True,#' WORKSPACE fi -bazel run "$BZLMOD_FLAG" @npm//:sync +# Trigger the update of the pnpm lockfile which should exit non-zero +if bazel run "$BZLMOD_FLAG" @npm//:sync; then + echo "ERROR: expected 'update_pnpm_lock' to exit with non-zero exit code on update" + exit 1 +fi + +# The lockfile has been updated and sync should now exit 0 +if ! bazel run "$BZLMOD_FLAG" @npm//:sync; then + echo "ERROR: expected 'update_pnpm_lock' to exit zero once the lockfile is up to date" + exit 1 +fi + export ASPECT_RULES_JS_FROZEN_PNPM_LOCK=1 bazel test "$BZLMOD_FLAG" //... diff --git a/e2e/update_pnpm_lock/test.sh b/e2e/update_pnpm_lock/test.sh index 4adb71fdce..4dfb78633a 100755 --- a/e2e/update_pnpm_lock/test.sh +++ b/e2e/update_pnpm_lock/test.sh @@ -53,7 +53,7 @@ ASPECT_RULES_JS_DISABLE_UPDATE_PNPM_LOCK= # Have to make another change to package.json to invalidate the repository rule _sedi 's#"@types/node": "16"#"@types/node": "14"#' package.json -# Trigger the update of the pnpm lockfile which should fail +# Trigger the update of the pnpm lockfile which should exit non-zero if bazel run "$BZLMOD_FLAG" @npm//:sync; then echo "ERROR: expected 'update_pnpm_lock' to exit with non-zero exit code on update" exit 1 @@ -74,9 +74,9 @@ if [ -z "$diff" ]; then exit 1 fi -# The lockfile has been updated and sync should now succeed +# The lockfile has been updated and sync should now exit 0 if ! bazel run "$BZLMOD_FLAG" @npm//:sync; then - echo "ERROR: expected 'update_pnpm_lock' to succeed once the lockfile is up to date" + echo "ERROR: expected 'update_pnpm_lock' to exit zero once the lockfile is up to date" exit 1 fi diff --git a/e2e/update_pnpm_lock_with_import/test.sh b/e2e/update_pnpm_lock_with_import/test.sh index 3a69d8ee7f..f894472e9a 100755 --- a/e2e/update_pnpm_lock_with_import/test.sh +++ b/e2e/update_pnpm_lock_with_import/test.sh @@ -48,7 +48,7 @@ ASPECT_RULES_JS_FROZEN_PNPM_LOCK= print_step "It should update the lockfile after a running the invalide target with ASPECT_RULES_JS_FROZEN_PNPM_LOCK unset" -# Trigger the update of the pnpm lockfile which should fail +# Trigger the update of the pnpm lockfile which should exit non-zero if bazel run "$BZLMOD_FLAG" @npm//:sync; then echo "ERROR: expected 'update_pnpm_lock' to exit with non-zero exit code on update" exit 1 @@ -69,9 +69,9 @@ if [ -z "$diff" ]; then exit 1 fi -# The lockfile has been updated and sync should now succeed +# The lockfile has been updated and sync should now exit 0 if ! bazel run "$BZLMOD_FLAG" @npm//:sync; then - echo "ERROR: expected 'update_pnpm_lock' to succeed once the lockfile is up to date" + echo "ERROR: expected 'update_pnpm_lock' to exit zero once the lockfile is up to date" exit 1 fi