test: keep verdaccio users alive across createTestDir() calls
RO
3mo ago+1+1+0123456789-2-2-0123456789
Problem
VerdaccioRegistry.createTestDir()(test/harness.ts) deleted the registry's htpasswd file and reset the harness's user map on every call. Verdaccio checks each authenticated request against that file, so acreateTestDir()call in one test logged out every other test that ran at the same time.- This blocks concurrent verdaccio tests that use a token. #40198 works around it by never calling
createTestDir(). #38504 works around it with a serialwhoamiblock.
Fix
createTestDir()no longer touches htpasswd or the user map.start()still begins each file with a fresh htpasswd (and now an empty user map), andstop()still removes the file.- Correct because the reset was not needed: no test file creates the same verdaccio user twice, so the duplicate guard in
generateUser()never fires. Users now accumulate in htpasswd for the life of one registry process, which is one test file. - Verified:
bun bd test test/cli/install/npmrc.test.ts test/cli/install/config-precedence.test.ts(91 pass) andbun bd test test/cli/install/bun-install-registry.test.ts(246 pass, 5 skip). These are the files that create verdaccio users. #40198 is rebased on this change.
Background
VerdaccioRegistryforks one verdaccio process per test file. Its users live intest/cli/install/registry/htpasswd.generateUser()creates a user through the registry's API and returns a token.authBunfig()wraps that token in abunfig.toml.- Verdaccio's default API tokens are legacy AES tokens. The registry decrypts the token on every request and verifies the user against htpasswd. A missing file makes every request anonymous, and a publish with a token then fails with 401.
no test proof · iteration 0 · no src or test change; test-proof not applicable