test: give e2e-real-dbt-5 its own HOME
Issue for this PR
Closes #1858
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
e2e-real-dbt-5.test.ts ran altimate-dbt init with the developer's real HOME, so a local run pointed their dbt.json in ~/.altimate-code at the test's temp project, which the test then deletes.
setupProject now sets HOME to a home folder inside the test project, and teardown puts it back if it was changed. The validators already pass env: process.env when they spawn altimate-dbt. The test's own init and build calls didn't, and Bun's spawnSync without env uses the environment the process started with, so they now go through an altimateDbt helper that passes it.
A new test runs init and checks the config landed in the test's home.
How did you verify your code works?
I ran only this file, never the whole test/altimate/ tree.
- Main's test code plus only the new test, with
HOMEset to a scratch folder: the new test fails, and the scratch folder gets adbt.jsonpointing at a deleted/tmp/e2e-real-5-*project. - This branch, same scratch
HOME: 4 pass, 17 skip, nothing written there. Setting HOME without theenvchange still fails the new test. - This branch with the real HOME: 4 pass, and there's no
dbt.jsonin~/.altimate-codebefore or after. bun run typecheckinpackages/opencode, and the marker guard.
Cost side effects
None. Test-only.
Screenshots / recordings
Not a UI change.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
- I checked for cost side effects (model calls, queries or cloud resources that grow with user data) and described them, or wrote "none"
Codex review log: https://github.com/AltimateAI/altimate-code/pull/1859#issuecomment-7256805621
🤖 Generated with Claude Code
https://claude.ai/code/session_01BXxzvsr1G2qqFbMCyPZg3G
Summary by cubic
Fixes e2e-real-dbt-5.test.ts writing altimate-dbt init config to the developer's real ~/.altimate-code/dbt.json, which a local run would then point at a deleted temp project.
setupProject()now setsHOMEto ahomefolder inside the test project and restores it inteardown(), but only whensetupProject()actually changed it — a test that setsdiritself bypasses it and no longer risks clobberingHOMEfor the run.- Test spawns go through a new
altimateDbt()helper that passesenv: process.env, since Bun'sspawnSyncotherwise uses the startup environment. - Adds a test verifying
initwrites its config under the test's home.
Summary by CodeRabbit
- Tests
- Updated end-to-end test setup to use an isolated home directory within the temporary project, restoring the original environment when needed.
- Added coverage confirming initialization writes its configuration to the isolated home directory.
- Updated validator test commands to run with the project’s environment and working directory, improving consistency across test scenarios.