[PR #22] [CLOSED] Replace unclear test failure pattern with explicit error throwing #22

Closed
opened 2026-02-27 19:20:57 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/f/git-rewrite-commits/pull/22
Author: @Copilot
Created: 11/18/2025
Status: Closed

Base: feature/testsHead: copilot/sub-pr-20-again


📝 Commits (2)

  • d6c5481 Initial plan
  • e6ff498 refactor: replace unclear test failures with explicit error throwing

📊 Changes

1 file changed (+2 additions, -2 deletions)

View changed files

📝 tests/cli.e2e.test.ts (+2 -2)

📄 Description

Addresses feedback from PR #20 to replace expect(true).toBe(false) with explicit error throwing for clearer test intent.

Changes:

  • Replace expect(true).toBe(false) with throw new Error('Expected to throw') in two test cases that expect exceptions

Before:

try {
  await runCli('--provider openai', process.cwd(), { ...process.env, OPENAI_API_KEY: '' });
  expect(true).toBe(false);  // Unclear intent
} catch (error: any) {
  expect(error.stderr).toContain('OpenAI API key is required');
}

After:

try {
  await runCli('--provider openai', process.cwd(), { ...process.env, OPENAI_API_KEY: '' });
  throw new Error('Expected to throw');  // Explicit failure
} catch (error: any) {
  expect(error.stderr).toContain('OpenAI API key is required');
}

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/f/git-rewrite-commits/pull/22 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 11/18/2025 **Status:** ❌ Closed **Base:** `feature/tests` ← **Head:** `copilot/sub-pr-20-again` --- ### 📝 Commits (2) - [`d6c5481`](https://github.com/f/git-rewrite-commits/commit/d6c5481b47640642a954fc809fce9b247d857f05) Initial plan - [`e6ff498`](https://github.com/f/git-rewrite-commits/commit/e6ff4982aab7502ff16674d6a00a9d8316f272eb) refactor: replace unclear test failures with explicit error throwing ### 📊 Changes **1 file changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tests/cli.e2e.test.ts` (+2 -2) </details> ### 📄 Description Addresses feedback from PR #20 to replace `expect(true).toBe(false)` with explicit error throwing for clearer test intent. **Changes:** - Replace `expect(true).toBe(false)` with `throw new Error('Expected to throw')` in two test cases that expect exceptions **Before:** ```typescript try { await runCli('--provider openai', process.cwd(), { ...process.env, OPENAI_API_KEY: '' }); expect(true).toBe(false); // Unclear intent } catch (error: any) { expect(error.stderr).toContain('OpenAI API key is required'); } ``` **After:** ```typescript try { await runCli('--provider openai', process.cwd(), { ...process.env, OPENAI_API_KEY: '' }); throw new Error('Expected to throw'); // Explicit failure } catch (error: any) { expect(error.stderr).toContain('OpenAI API key is required'); } ``` <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 19:20:57 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-rewrite-commits#22
No description provided.