Skip to content

fix: fix and improve test isolation and collision with environment#530

Merged
iamtoruk merged 3 commits into
getagentseal:mainfrom
tvcsantos:fix/fix-test-interference
Jun 20, 2026
Merged

fix: fix and improve test isolation and collision with environment#530
iamtoruk merged 3 commits into
getagentseal:mainfrom
tvcsantos:fix/fix-test-interference

Conversation

@tvcsantos

Copy link
Copy Markdown
Contributor

Summary

Currently if a user has certain variables already present on his machine tests fail. An example is with Claude Code environment variables, but this extens to all other providers.

This means that the current setup does not isolate the test environment properlly with respect to already existing user environment variables in a consistent approach.

This PR addresses that issue by providing a setup file tests/setup/env-isolation.ts in vitest that always run when tests execute. This file abstracts the environment isolation, brings several benefinits:

  • Simplify all tests, that no longer need to juggle and do boilerplate code that does not even concern to the test.
  • Follow a consistent and systematic approach on test vs current user environment

Testing

  • I have tested this locally against real data (not just unit tests)
  • npm test passes
  • npm run build succeeds

For new providers only:

  • I installed the tool and generated real sessions by using it
  • npm run dev -- today shows correct costs and session counts for this provider
  • npm run dev -- models --provider <name> shows correct model names and pricing
  • Screenshot or terminal output attached below proving it works with real data

tvcsantos and others added 3 commits June 20, 2026 12:08
Two env vars read in src/ were not isolated: CODEBURN_FORCE_MACOS_MAJOR
(now cleared so it cannot leak between tests) and TZ (now pinned to UTC,
since clearing it falls back to the OS zone and would shift date buckets
versus a clean CI runner).
@iamtoruk iamtoruk merged commit 75c32e6 into getagentseal:main Jun 20, 2026
3 checks passed
@tvcsantos tvcsantos deleted the fix/fix-test-interference branch June 20, 2026 12:17
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.

2 participants