test: cover dotenv parse, remove, and append helpers#13
Merged
vitaliimelnychuk merged 1 commit intomainfrom Apr 8, 2026
Merged
test: cover dotenv parse, remove, and append helpers#13vitaliimelnychuk merged 1 commit intomainfrom
vitaliimelnychuk merged 1 commit intomainfrom
Conversation
Exercises the shared lib used by secrets TRPC and file workspace: comments/CRLF handling, quoting, duplicate key rejection, and line formatting for append.
vitaliimelnychuk
approved these changes
Apr 8, 2026
Pull Request Summary by devActivityMetricsAchievements
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Vitest coverage for
src/lib/dotenv-parse.ts, which backs dotenv handling in the secrets router and file workspace.Risky behavior now covered
#comments, CRLF vs LF, malformed lines (=bad, no=), quoted values, trimming around=.removeDotenvKey: removes all lines thatparseDotenvwould treat as the target key while preserving comments and structure; multiple definitions of the same key.appendDotenvKey: trailing-whitespace normalization, duplicate key detection (including keys that match after trim), validation errors (empty key,=in key,#prefix, newlines in key/value), and quoting/escaping for values that need it.Test files added/updated
src/lib/dotenv-parse.test.tsWhy this reduces regression risk
The recent work on dotenv parsing, key removal, append UX, and error message formatting all flow through this module. These tests pin observable behavior for parsing and mutation of
.env-style content without touching production code, so future edits are less likely to break secrets display, GitHub Action env picking, or vault file editing silently.Validation
npm run test(all 30 tests pass; deterministic, node environment).