test: trim redundant e2e tests, move pure logic to unit specs - #10651
test: trim redundant e2e tests, move pure logic to unit specs#10651davidfirst wants to merge 62 commits into
Conversation
PR Summary by QodoTests: trim redundant add/config e2e coverage; add determineMainFile unit specs
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1. Error details no longer tested
|
|
Code review by qodo was updated up to the latest commit 23f127b |
|
Code review by qodo was updated up to the latest commit c9b3b48 |
|
Code review by qodo was updated up to the latest commit d064888 |
|
Code review by qodo was updated up to the latest commit 8d4db88 |
|
Code review by qodo was updated up to the latest commit d15dbd2 |
|
Code review by qodo was updated up to the latest commit ec76886 |
|
Code review by qodo was updated up to the latest commit 0b6f4b3 |
|
Code review by qodo was updated up to the latest commit 42014fb |
|
Code review by qodo was updated up to the latest commit 3e5d887 |
|
Code review by qodo was updated up to the latest commit 2a1b66d |
|
Code review by qodo was updated up to the latest commit aa5919c |
| it('should error when --dependencies-depth is not a positive integer', () => { | ||
| const output = helper.general.runWithTryCatch( | ||
| `bit import ${helper.scopes.remote}/comp1 --dependencies --dependencies-depth 0` | ||
| ); |
There was a problem hiding this comment.
1. Depth validation branch untested 🐞 Bug ⚙ Maintainability
The renamed test claims to cover any non-positive-integer depth but still passes only 0, so it exercises the < 1 branch while the distinct Number.isInteger() rejection for abc and 1.5 now has no test. A regression that accepts nonnumeric or fractional depths would therefore pass this suite despite violating the command contract.
Agent Prompt
## Issue description
The consolidated dependencies-depth test only supplies zero, leaving the non-integer validation path uncovered while claiming all invalid positive-integer inputs are tested.
## Issue Context
`ImportCmd.report()` converts the option with `Number()` and rejects it using two distinct checks: `!Number.isInteger(...)` and `< 1`. Keep zero coverage and add at least one non-integer input (preferably both nonnumeric and fractional cases), either here or in a focused unit spec for the parser.
## Fix Focus Areas
- e2e/commands/import.e2e.ts[483-488]
- scopes/scope/importer/import.cmd.ts[324-331]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit ad34d94 |
|
Code review by qodo was updated up to the latest commit ad4258a |
| const addedComponent = createAddedComponent({ | ||
| files: [{ relativePath: 'bar/foo1.js' }, { relativePath: 'bar/foo2.js' }], | ||
| }); | ||
| expect(() => determineMainFile(addedComponent, null)).to.throw(MissingMainFile); |
There was a problem hiding this comment.
1. Error details no longer tested 🐞 Bug ⚙ Maintainability
The replacement no-main-file unit test accepts any MissingMainFile instance, so regressions that report the wrong component ID, expected main-file pattern, file list, or user-facing message now pass. The removed e2e assertion constructed the expected component-specific error, while production still builds those details separately from the exception type.
Agent Prompt
## Issue description
The replacement unit test verifies only the `MissingMainFile` class, losing coverage of the component-specific error details that the removed e2e test checked.
## Issue Context
`determineMainFile()` supplies the component ID, expected main-file pattern, and candidate files to `MissingMainFile`; these values determine its user-facing message.
## Fix Focus Areas
- scopes/component/tracker/determine-main-file.spec.ts[18-23]
- scopes/component/tracker/determine-main-file.ts[38-43]
- components/legacy/bit-map/exceptions/missing-main-file.ts[10-18]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit b796a27 |
# Conflicts: # pnpm-lock.yaml
|
Code review by qodo was updated up to the latest commit 4ebf563 |
This PR reduces the number of slow e2e tests. The work goes file by file. Each commit covers one e2e file.
Done so far: add.e2e.ts (24 to 13 tests), config.e2e.ts (13 to 11 tests). More commits will follow on this branch.