Skip to content

refactor(test): extract shared env save/restore helper#445

Merged
nullvariant merged 1 commit into
mainfrom
refactor/extract-env-mock-helper
Apr 7, 2026
Merged

refactor(test): extract shared env save/restore helper#445
nullvariant merged 1 commit into
mainfrom
refactor/extract-env-mock-helper

Conversation

@nullvariant
Copy link
Copy Markdown
Owner

Summary

  • Create src/test/helpers/envMock.ts with EnvSnapshot/saveEnv/restoreEnv shared helpers
  • Migrate getSafeStack.test.ts from inline definitions to shared helper (removed ~35 lines)
  • Migrate pathSanitizer.test.ts from 10 manual save/restore blocks to shared helper (removed ~67 lines)

Restore order matters: env vars first (simple assignment), then platform (Object.defineProperty is the riskier operation).

Test plan

  • npx tsc --noEmit passes
  • npm run test — all tests pass
  • npm run test:coverage — 100% statement coverage maintained
  • ESLint with --max-warnings=0 passes

🤖 Generated with Claude Code

Deduplicate process.platform and env var (HOME, HOMEDRIVE, HOMEPATH,
USERPROFILE) save/restore boilerplate across test files.
- Create src/test/helpers/envMock.ts with EnvSnapshot/saveEnv/restoreEnv
- Migrate getSafeStack.test.ts from inline definitions to shared helper
- Migrate pathSanitizer.test.ts from 10 manual save/restore blocks
Signed-off-by: Null;Variant <null@nullvariant.com>

🖥️ IDE: [VS Code](https://code.visualstudio.com/)
🔌 Extension: [Claude Code](https://claude.ai/download)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Model-Raw: claude-opus-4-6
@nullvariant-mimi
Copy link
Copy Markdown
Contributor

🐰 Mimi's Validation Report ✅

All checks are looking good! Great job! 🎉

⏳ Some checks are still running. I will keep watching!


バリデーターを通してくださいね

This report was carefully prepared by nullvariant-mimi[bot]

@nullvariant-slow
Copy link
Copy Markdown
Contributor

🦥 Slow's Code Review 😩

...yawn... Do I really have to review this?

⚠️ TOO LONG... I can barely keep my eyes open reading these:

File Lines

| extensions/git-id-switcher/src/test/getSafeStack.test.ts | 462 |
| extensions/git-id-switcher/src/test/pathSanitizer.test.ts | 1097 |

Split it up... reading long files is exhausting.


働きたくないでござる

This review was reluctantly filed by nullvariant-slow[bot]

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 7, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA 34d47f7.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

Scanned Files

None

@nullvariant-ciel
Copy link
Copy Markdown
Contributor

nullvariant-ciel Bot commented Apr 7, 2026

🕊️ Ciel's Mediation 🌤️

*~~ floating down from the clouds ~~ The zoo seems a bit noisy today...*

2 zoo members have reviewed this PR.

Zoo Member Status
🦥 Slow Commented
🐰 Mimi Commented

⚖️ The zoo has mixed opinions. Some are concerned, some are fine with it. Please review each comment carefully and make the final call.


まあまあ、ほどほどに。

This mediation was peacefully delivered by nullvariant-ciel[bot]

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 7, 2026

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@nullvariant-justice nullvariant-justice Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚖️ Justice grants passage. CI checks passed — this code meets the garden's standards.

@nullvariant nullvariant merged commit cf0a5ca into main Apr 7, 2026
34 of 35 checks passed
@nullvariant nullvariant deleted the refactor/extract-env-mock-helper branch April 7, 2026 02:28
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.

1 participant