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 74 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. Tilde snap coverage removed
|
|
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 |
| 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 |
| before(() => { | ||
| helper.scopeHelper.reInitWorkspace(); | ||
| helper.fixtures.populateComponents(2); | ||
| helper.workspaceJsonc.addKeyValToDependencyResolver('componentRangePrefix', '~'); |
There was a problem hiding this comment.
1. Tilde snap coverage removed 🐞 Bug ⚙ Maintainability
Deleting the ~ snap suite leaves only the ^ variant, although production handles ~ as a separate accepted range-prefix value on the same snap-sensitive branches. A regression that writes invalid ~<snap-hash> dependency ranges would now pass the suite.
Agent Prompt
## Issue description
Restore coverage ensuring `componentRangePrefix: '~'` is not applied to snap hashes in dependency metadata or generated package JSON.
## Issue Context
The remaining `^` tests do not cover the separately supported `~` configuration value.
## Fix Focus Areas
- e2e/harmony/dependency-resolver.e2e.ts[643-675]
- scopes/component/snapping/version-maker.ts[644-663]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
|
||
| helper.scopeHelper.getClonedWorkspace(originalWs); | ||
| }); | ||
| it('checkout head should stop with an error', () => { |
There was a problem hiding this comment.
2. Pending-merge checkout untested 🐞 Bug ⚙ Maintainability
Removing this scenario eliminates the only checkout test proving checkout --head rejects a during-merge component without updating unrelated components. The checkout implementation has a dedicated unmerged-component guard, but the remaining unit and lane checkout tests never exercise it.
Agent Prompt
## Issue description
Restore an integration test that creates pending-merge state, runs checkout head, and verifies both rejection and no partial update of other components.
## Issue Context
This exercises checkout's dedicated unmerged-component guard and its all-components behavior; ordinary checkout tests are not equivalent.
## Fix Focus Areas
- e2e/harmony/lanes/bit-checkout-on-lanes.e2e.ts[74-76]
- scopes/component/checkout/checkout.main.runtime.ts[497-515]
- scopes/component/checkout/checkout.spec.ts[21-90]
ⓘ 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 1b4ccc3 |
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.