Skip to content

test: cover dotenv parse, remove, and append helpers#13

Merged
vitaliimelnychuk merged 1 commit intomainfrom
cursor/missing-test-coverage-b5dc
Apr 8, 2026
Merged

test: cover dotenv parse, remove, and append helpers#13
vitaliimelnychuk merged 1 commit intomainfrom
cursor/missing-test-coverage-b5dc

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor bot commented Apr 8, 2026

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

  • Parsing: blank lines, # comments, CRLF vs LF, malformed lines (=bad, no =), quoted values, trimming around =.
  • removeDotenvKey: removes all lines that parseDotenv would 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

  • Added: src/lib/dotenv-parse.test.ts

Why 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).
Open in Web View Automation 

Exercises the shared lib used by secrets TRPC and file workspace:
comments/CRLF handling, quoting, duplicate key rejection, and line
formatting for append.
@vitaliimelnychuk vitaliimelnychuk marked this pull request as ready for review April 8, 2026 15:26
@vitaliimelnychuk vitaliimelnychuk merged commit 2dae961 into main Apr 8, 2026
1 check passed
@devactivity-app
Copy link
Copy Markdown

Pull Request Summary by devActivity

Metrics

Cycle Time: 5h 21m Coding Time: < 1 min Review Time: < 1 min

Achievements

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