test: fix race condition in ignores_non_auth_keys (#359)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Khải
2026-05-01 03:16:14 +07:00
committed by GitHub
parent 70aa48a845
commit e40b2000df

View File

@@ -90,6 +90,14 @@ mod tests {
// These are all project-structural settings that pnpm 11 only reads
// from pnpm-workspace.yaml now. Writing them to .npmrc should be a
// no-op.
//
// `Npmrc::new()` reads `PNPM_HOME` / `XDG_DATA_HOME` to compute
// `store_dir`, and the env-mutating tests in `custom_deserializer`
// toggle those vars under `EnvGuard`. Hold the same lock so a
// parallel test can't change the env between the two `Npmrc::new()`
// snapshots compared below. Proper fix is dependency injection —
// see the TODO on `default_store_dir`.
let _g = crate::test_env_guard::EnvGuard::snapshot(["PNPM_HOME", "XDG_DATA_HOME"]);
let ini = "
store-dir=/should/not/apply
lockfile=false