Skip to content

[WIP] Fix CI for PR #148 by adding missing unit tests and e2e tests#154

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/fix-ci-pr-148-update-tests
Closed

[WIP] Fix CI for PR #148 by adding missing unit tests and e2e tests#154
Copilot wants to merge 3 commits intomainfrom
copilot/fix-ci-pr-148-update-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 25, 2026

  • Install dependencies and verify base TS check passes
  • Create src/commands/clean.test.ts (use vi.hoisted for mockReaddir with Dirent<string> typing to avoid overload resolution issue)
  • Create src/commands/default-prefs-userjs.test.ts (fix spy type, annotate c: unknown[] in .mock.calls.map)
  • Create src/commands/diff.test.ts (fix spy types for log and info, annotate c: unknown[])
  • Update src/lib/cli.test.ts (add parseKeepArgument tests, fix spy type, annotate c: unknown[])
  • Update src/lib/firefox.test.ts (add comparePrefs tests with explicit Map<string, Pref> typing)
  • Create src/lib/format.test.ts (no fixes needed)
  • Update src/index.end-to-end.test.ts (add activate command and error handling tests)
  • npm run check:typescript passes (0 errors)
  • npm test passes (141 tests in 9 files)
Original prompt

Fix CI for PR #148 (Add missing unit tests and e2e tests) in martabal/ff-diff without introducing regressions.

Context:

  • PR: Add missing unit tests and e2e tests #148
  • Head branch: copilot/suggest-missing-unit-e2e-tests
  • Base: main
  • CI failing in TypeScript check (tsc --noEmit). Job log excerpt shows errors in new/modified tests:
    • Type '"log"' does not satisfy the constraint '"Console"' (and similarly for "info") in multiple test files: src/commands/clean.test.ts, src/commands/default-prefs-userjs.test.ts, src/commands/diff.test.ts, src/lib/cli.test.ts.
    • Dirent<string> not assignable to Dirent<NonSharedBuffer> in src/commands/clean.test.ts where test helper returns a Dirent.
    • No overload matches this call in src/lib/firefox.test.ts around constructing new Map([...]) due to inferred value type being boolean but includes number too.

Requirements:

  1. Update the tests to typecheck under the repo’s TS configuration and Node types.
    • Avoid incorrect ReturnType<typeof vi.spyOn<Console, "log">> generic usage that triggers TS2344.
    • Fix the Dirent typing issues (likely by loosening mock entry typing or using Dirent without generic, or adjust mock so it conforms to Node’s expected Dirent<NonSharedBuffer> typing).
    • Fix comparePrefs tests in src/lib/firefox.test.ts so Map value type is correctly inferred/declared (should match the Pref type used in the library: string | number | boolean).
  2. Keep test intent/coverage; do not reduce assertions in a way that could mask real regressions.
  3. Ensure npm test (vitest) and npm run check:typescript pass.
  4. Do not change production behavior unless required for typing correctness of tests.

Deliverable:

  • A PR from the existing head branch updating only necessary test code (and types/imports) so CI passes.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: fix CI and do not add regressions

Assistant: I’m waiting for you to accept or reject the pending action so I can continue fixing the CI failures in PR #148 without introducing regressions.

This pull request was created from Copilot chat.

Copilot AI and others added 2 commits April 25, 2026 14:53
Agent-Logs-Url: https://github.com/martabal/ff-diff/sessions/4c9801b7-db34-4632-89aa-5b773010d541

Co-authored-by: martabal <74269598+martabal@users.noreply.github.com>
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