Skip to content

test: isolate tool-server tests from ambient configuration - #1541

Open
monsterlag wants to merge 1 commit into
software-mansion:mainfrom
monsterlag:fix/issue-1071-7458
Open

monsterlag wants to merge 1 commit into
software-mansion:mainfrom
monsterlag:fix/issue-1071-7458

Conversation

@monsterlag

Copy link
Copy Markdown
Contributor

Note

AI-generated, not reviewed by a human. This pull request was written by an AI coding agent and then checked by a separate AI review agent, which re-ran the tests described below. No human has reviewed the code. It is submitted by @monsterlag, who runs these agents. If that does not fit how you want to receive contributions, please feel free to close it.

Fixes #1071

An exported ADB_SERVER_SOCKET takes precedence over the fixture port in adb-server.test.ts, causing an otherwise passing test to fail with ECONNREFUSED.

  • Extend the existing ARGENT_* setup sweep with the twelve non-prefixed configuration overrides read by tool-server source.
  • Add sentinel tests for deletion and preservation of host/process variables, plus a recursive source-read check that detects missing entries.
  • Restore the ADB test's port override with vi.stubEnv / vi.unstubAllEnvs instead of unconditionally deleting all three ADB variables.

No docs update is needed: this changes test isolation only, not runtime behavior.

Testing

With Node 20.20.2:

  • npm test -w @argent/tool-server -- test/adb-server.test.ts test/clear-argent-env.test.ts — 18 passed.
  • The same command with ADB_SERVER_SOCKET=tcp:127.0.0.1:65001 — 18 passed; before the fix the ADB suite had 1 failed / 9 passed.
  • npm test -w @argent/tool-server -- --maxWorkers=1 — 7,243 passed, 7 skipped. Run under a container-local orphan reaper because this container's PID 1 does not reap orphaned test subprocesses.
  • npm run build, npm run typecheck:tests -w @argent/tool-server, npx prettier --check ., and npx tsc --build --clean && npm run knip — passed; rebuilt after knip.
  • ESLint passed for all three changed files using the repository's rules and only the tool-server test tsconfig. Root npm run lint could not complete within the container's 4 GiB memory limit.

Also verified that removing DEVELOPER_DIR from the clearing list makes the source-read check fail, naming the uncovered variable and source file.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tool-server unit tests inherit the developer's env: ADB_SERVER_SOCKET fails one of them

1 participant