Skip to content

test: trim redundant e2e tests, move pure logic to unit specs - #10651

Open
davidfirst wants to merge 62 commits into
masterfrom
e2e-cleanup
Open

test: trim redundant e2e tests, move pure logic to unit specs#10651
davidfirst wants to merge 62 commits into
masterfrom
e2e-cleanup

Conversation

@davidfirst

Copy link
Copy Markdown
Member

This PR reduces the number of slow e2e tests. The work goes file by file. Each commit covers one e2e file.

  • Remove e2e tests that a unit spec already covers.
  • Remove e2e tests that repeat the same code path as a sibling test.
  • Move tests of pure functions to unit specs. Example: main-file resolution now has a unit spec (determine-main-file.spec.ts) with 9 tests.
  • Keep all tests that need a real workspace or scope.

Done so far: add.e2e.ts (24 to 13 tests), config.e2e.ts (13 to 11 tests). More commits will follow on this branch.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Tests: trim redundant add/config e2e coverage; add determineMainFile unit specs

🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Remove redundant/overlapping e2e cases in bit add and bit config suites to reduce runtime.
• Add focused unit coverage for determineMainFile() main-file resolution strategies.
• Simplify e2e assertions where coverage is already exercised by remaining tests.
Diagram

graph TD
  E2EAdd(["e2e/commands/add.e2e.ts"]) --> CLI["bit CLI"] --> AddComp["AddComponents"] --> DMF["determineMainFile()"]
  E2EConfig(["e2e/commands/config.e2e.ts"]) --> CLI
  UnitSpec(["scopes/component/tracker/determine-main-file.spec.ts"]) --> DMF
Loading
High-Level Assessment

The approach is appropriate: keep e2e coverage for behaviors requiring a real workspace/CLI, and move deterministic strategy logic (main-file resolution) into fast unit specs to reduce suite time. Alternatives like keeping all scenarios as e2e or introducing a mid-level integration harness would be slower or add more framework surface area without clear benefit here.

Files changed (3) +87 / -110

Tests (3) +87 / -110
add.e2e.tsRemove redundant 'bit add' e2e cases (main-file + invalid id/name) +1/-88

Remove redundant 'bit add' e2e cases (main-file + invalid id/name)

• Drops multiple 'bit add' e2e tests that duplicate existing validation or are better covered at the logic level (e.g., missing main file, invalid name/id, multiple index-file main resolution, bitmap sorting). Simplifies the gitignore scenario by removing redundant output/bitmap presence assertions while keeping the key file-filtering check.

e2e/commands/add.e2e.ts

config.e2e.tsRemove 'bit config' git propagation e2e block +0/-22

Remove 'bit config' git propagation e2e block

• Eliminates the e2e suite section that validated config precedence/propagation via git config layers, keeping the remaining local workspace/scope config tests intact. This reduces slow/permission-sensitive git-dependent coverage.

e2e/commands/config.e2e.ts

determine-main-file.spec.tsAdd unit spec for 'determineMainFile()' resolution strategies +86/-0

Add unit spec for 'determineMainFile()' resolution strategies

• Introduces a dedicated unit test suite covering the main-file selection strategies: no-match error, single-file selection, closest index preference, immediate-dir filename fallback, Angular entry point, preservation of existing component-map mainFile, and user-specified main file behavior (present vs missing). This replaces several slower e2e scenarios with direct logic validation.

scopes/component/tracker/determine-main-file.spec.ts

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Aug 20, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Error details no longer tested 🐞 Bug ⚙ Maintainability
Description
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.
Code

scopes/component/tracker/determine-main-file.spec.ts[22]

+      expect(() => determineMainFile(addedComponent, null)).to.throw(MissingMainFile);
Evidence
The production function independently assembles and passes three error arguments, and
MissingMainFile stores them and formats the displayed message. A class-only assertion cannot
detect incorrect values in any of those paths.

scopes/component/tracker/determine-main-file.ts[38-43]
components/legacy/bit-map/exceptions/missing-main-file.ts[10-18]
scopes/component/tracker/determine-main-file.spec.ts[18-23]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## 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


2. Depth validation branch untested 🐞 Bug ⚙ Maintainability
Description
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.
Code

e2e/commands/import.e2e.ts[R483-486]

+      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`
  );
Evidence
The remaining test invokes only depth 0, whereas command parsing has a separate
Number.isInteger() condition needed to reject both NaN from abc and fractional values such as
1.5; the PR deleted the only shown cases exercising those inputs.

e2e/commands/import.e2e.ts[483-488]
scopes/scope/importer/import.cmd.ts[324-331]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## 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


3. Test library becomes runtime peer 🐞 Bug ⚙ Maintainability
Description
Adding the Chai-only spec causes @teambit/tracker to declare an exact chai@5.2.1 peer, so
downstream runtime consumers must resolve a test framework that tracker production code never uses.
The repository classifies **/*.spec.ts as dev files, and comparable component specs keep Chai in
devDependencies, so this generated peer is an incorrect dependency classification.
Code

pnpm-lock.yaml[R36877-36878]

+    peerDependencies:
+      chai: 5.2.1
Evidence
The only tracker source import of Chai is the newly added spec, while the workspace explicitly marks
spec files as dev files. A sibling component with the same style of Chai spec import records Chai
under devDependencies, but the tracker lockfile now declares Chai as a peer and auto-installs it
under dependencies.

scopes/component/tracker/determine-main-file.spec.ts[1-5]
workspace.jsonc[737-742]
scopes/component/component-url/component-url.spec.ts[1-4]
pnpm-lock.yaml[18612-18624]
pnpm-lock.yaml[19818-19840]
pnpm-lock.yaml[36872-36878]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new tracker unit spec imports Chai, but the generated package metadata declares `chai@5.2.1` as an exact peer dependency of `@teambit/tracker`. This leaks a test-only library into the published runtime contract and forces consumers to resolve it.
## Issue Context
The workspace declares `**/*.spec.ts` as dev files. Other components with Chai imports in spec files record Chai under `devDependencies`, while the tracker lockfile entry now exposes it as a peer and auto-installs it as a regular importer dependency.
## Fix Focus Areas
- scopes/component/tracker/determine-main-file.spec.ts[1-5]
- workspace.jsonc[737-742]
- pnpm-lock.yaml[19818-19840]
- pnpm-lock.yaml[36872-36878]
Update the tracker component dependency metadata/configuration so Chai is detected as a dev dependency for the spec, then regenerate the lockfile and verify the tracker package no longer declares a Chai peer.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 4ebf563 ⚖️ Balanced

Results up to commit b796a27


🐞 Bugs (3) 📘 Rule violations (0) 📜 Skill insights (0)


Remediation recommended
1. Error details no longer tested 🐞 Bug ⚙ Maintainability ⭐ New
Description
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.
Code

scopes/component/tracker/determine-main-file.spec.ts[22]

+      expect(() => determineMainFile(addedComponent, null)).to.throw(MissingMainFile);
Evidence
The production function independently assembles and passes three error arguments, and
MissingMainFile stores them and formats the displayed message. A class-only assertion cannot
detect incorrect values in any of those paths.

scopes/component/tracker/determine-main-file.ts[38-43]
components/legacy/bit-map/exceptions/missing-main-file.ts[10-18]
scopes/component/tracker/determine-main-file.spec.ts[18-23]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## 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


2. Depth validation branch untested 🐞 Bug ⚙ Maintainability
Description
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.
Code

e2e/commands/import.e2e.ts[R483-486]

+      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`
    );
Evidence
The remaining test invokes only depth 0, whereas command parsing has a separate
Number.isInteger() condition needed to reject both NaN from abc and fractional values such as
1.5; the PR deleted the only shown cases exercising those inputs.

e2e/commands/import.e2e.ts[483-488]
scopes/scope/importer/import.cmd.ts[324-331]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## 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


3. Test library becomes runtime peer 🐞 Bug ⚙ Maintainability
Description
Adding the Chai-only spec causes @teambit/tracker to declare an exact chai@5.2.1 peer, so
downstream runtime consumers must resolve a test framework that tracker production code never uses.
The repository classifies **/*.spec.ts as dev files, and comparable component specs keep Chai in
devDependencies, so this generated peer is an incorrect dependency classification.
Code

pnpm-lock.yaml[R36877-36878]

+    peerDependencies:
+      chai: 5.2.1
Evidence
The only tracker source import of Chai is the newly added spec, while the workspace explicitly marks
spec files as dev files. A sibling component with the same style of Chai spec import records Chai
under devDependencies, but the tracker lockfile now declares Chai as a peer and auto-installs it
under dependencies.

scopes/component/tracker/determine-main-file.spec.ts[1-5]
workspace.jsonc[737-742]
scopes/component/component-url/component-url.spec.ts[1-4]
pnpm-lock.yaml[18612-18624]
pnpm-lock.yaml[19818-19840]
pnpm-lock.yaml[36872-36878]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new tracker unit spec imports Chai, but the generated package metadata declares `chai@5.2.1` as an exact peer dependency of `@teambit/tracker`. This leaks a test-only library into the published runtime contract and forces consumers to resolve it.
## Issue Context
The workspace declares `**/*.spec.ts` as dev files. Other components with Chai imports in spec files record Chai under `devDependencies`, while the tracker lockfile entry now exposes it as a peer and auto-installs it as a regular importer dependency.
## Fix Focus Areas
- scopes/component/tracker/determine-main-file.spec.ts[1-5]
- workspace.jsonc[737-742]
- pnpm-lock.yaml[19818-19840]
- pnpm-lock.yaml[36872-36878]
Update the tracker component dependency metadata/configuration so Chai is detected as a dev dependency for the spec, then regenerate the lockfile and verify the tracker package no longer declares a Chai peer.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit ad4258a


🐞 Bugs (2) 📘 Rule violations (0) 📜 Skill insights (0)


Remediation recommended
1. Depth validation branch untested 🐞 Bug ⚙ Maintainability
Description
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.
Code

e2e/commands/import.e2e.ts[R483-486]

+      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`
      );
Evidence
The remaining test invokes only depth 0, whereas command parsing has a separate
Number.isInteger() condition needed to reject both NaN from abc and fractional values such as
1.5; the PR deleted the only shown cases exercising those inputs.

e2e/commands/import.e2e.ts[483-488]
scopes/scope/importer/import.cmd.ts[324-331]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## 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


2. Test library becomes runtime peer 🐞 Bug ⚙ Maintainability
Description
Adding the Chai-only spec causes @teambit/tracker to declare an exact chai@5.2.1 peer, so
downstream runtime consumers must resolve a test framework that tracker production code never uses.
The repository classifies **/*.spec.ts as dev files, and comparable component specs keep Chai in
devDependencies, so this generated peer is an incorrect dependency classification.
Code

pnpm-lock.yaml[R36877-36878]

+    peerDependencies:
+      chai: 5.2.1
Evidence
The only tracker source import of Chai is the newly added spec, while the workspace explicitly marks
spec files as dev files. A sibling component with the same style of Chai spec import records Chai
under devDependencies, but the tracker lockfile now declares Chai as a peer and auto-installs it
under dependencies.

scopes/component/tracker/determine-main-file.spec.ts[1-5]
workspace.jsonc[737-742]
scopes/component/component-url/component-url.spec.ts[1-4]
pnpm-lock.yaml[18612-18624]
pnpm-lock.yaml[19818-19840]
pnpm-lock.yaml[36872-36878]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new tracker unit spec imports Chai, but the generated package metadata declares `chai@5.2.1` as an exact peer dependency of `@teambit/tracker`. This leaks a test-only library into the published runtime contract and forces consumers to resolve it.
## Issue Context
The workspace declares `**/*.spec.ts` as dev files. Other components with Chai imports in spec files record Chai under `devDependencies`, while the tracker lockfile entry now exposes it as a peer and auto-installs it as a regular importer dependency.
## Fix Focus Areas
- scopes/component/tracker/determine-main-file.spec.ts[1-5]
- workspace.jsonc[737-742]
- pnpm-lock.yaml[19818-19840]
- pnpm-lock.yaml[36872-36878]
Update the tracker component dependency metadata/configuration so Chai is detected as a dev dependency for the spec, then regenerate the lockfile and verify the tracker package no longer declares a Chai peer.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit ad34d94


🐞 Bugs (2) 📘 Rule violations (0) 📜 Skill insights (0)


Remediation recommended
1. Depth validation branch untested 🐞 Bug ⚙ Maintainability ⭐ New
Description
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.
Code

e2e/commands/import.e2e.ts[R483-486]

+      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`
        );
Evidence
The remaining test invokes only depth 0, whereas command parsing has a separate
Number.isInteger() condition needed to reject both NaN from abc and fractional values such as
1.5; the PR deleted the only shown cases exercising those inputs.

e2e/commands/import.e2e.ts[483-488]
scopes/scope/importer/import.cmd.ts[324-331]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## 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


2. Test library becomes runtime peer 🐞 Bug ⚙ Maintainability
Description
Adding the Chai-only spec causes @teambit/tracker to declare an exact chai@5.2.1 peer, so
downstream runtime consumers must resolve a test framework that tracker production code never uses.
The repository classifies **/*.spec.ts as dev files, and comparable component specs keep Chai in
devDependencies, so this generated peer is an incorrect dependency classification.
Code

pnpm-lock.yaml[R36877-36878]

+    peerDependencies:
+      chai: 5.2.1
Evidence
The only tracker source import of Chai is the newly added spec, while the workspace explicitly marks
spec files as dev files. A sibling component with the same style of Chai spec import records Chai
under devDependencies, but the tracker lockfile now declares Chai as a peer and auto-installs it
under dependencies.

scopes/component/tracker/determine-main-file.spec.ts[1-5]
workspace.jsonc[737-742]
scopes/component/component-url/component-url.spec.ts[1-4]
pnpm-lock.yaml[18612-18624]
pnpm-lock.yaml[19818-19840]
pnpm-lock.yaml[36872-36878]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new tracker unit spec imports Chai, but the generated package metadata declares `chai@5.2.1` as an exact peer dependency of `@teambit/tracker`. This leaks a test-only library into the published runtime contract and forces consumers to resolve it.
## Issue Context
The workspace declares `**/*.spec.ts` as dev files. Other components with Chai imports in spec files record Chai under `devDependencies`, while the tracker lockfile entry now exposes it as a peer and auto-installs it as a regular importer dependency.
## Fix Focus Areas
- scopes/component/tracker/determine-main-file.spec.ts[1-5]
- workspace.jsonc[737-742]
- pnpm-lock.yaml[19818-19840]
- pnpm-lock.yaml[36872-36878]
Update the tracker component dependency metadata/configuration so Chai is detected as a dev dependency for the spec, then regenerate the lockfile and verify the tracker package no longer declares a Chai peer.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit aa5919c


🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)


Remediation recommended
1. Test library becomes runtime peer 🐞 Bug ⚙ Maintainability
Description
Adding the Chai-only spec causes @teambit/tracker to declare an exact chai@5.2.1 peer, so
downstream runtime consumers must resolve a test framework that tracker production code never uses.
The repository classifies **/*.spec.ts as dev files, and comparable component specs keep Chai in
devDependencies, so this generated peer is an incorrect dependency classification.
Code

pnpm-lock.yaml[R36877-36878]

+    peerDependencies:
+      chai: 5.2.1
Evidence
The only tracker source import of Chai is the newly added spec, while the workspace explicitly marks
spec files as dev files. A sibling component with the same style of Chai spec import records Chai
under devDependencies, but the tracker lockfile now declares Chai as a peer and auto-installs it
under dependencies.

scopes/component/tracker/determine-main-file.spec.ts[1-5]
workspace.jsonc[737-742]
scopes/component/component-url/component-url.spec.ts[1-4]
pnpm-lock.yaml[18612-18624]
pnpm-lock.yaml[19818-19840]
pnpm-lock.yaml[36872-36878]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new tracker unit spec imports Chai, but the generated package metadata declares `chai@5.2.1` as an exact peer dependency of `@teambit/tracker`. This leaks a test-only library into the published runtime contract and forces consumers to resolve it.
## Issue Context
The workspace declares `**/*.spec.ts` as dev files. Other components with Chai imports in spec files record Chai under `devDependencies`, while the tracker lockfile entry now exposes it as a peer and auto-installs it as a regular importer dependency.
## Fix Focus Areas
- scopes/component/tracker/determine-main-file.spec.ts[1-5]
- workspace.jsonc[737-742]
- pnpm-lock.yaml[19818-19840]
- pnpm-lock.yaml[36872-36878]
Update the tracker component dependency metadata/configuration so Chai is detected as a dev dependency for the spec, then regenerate the lockfile and verify the tracker package no longer declares a Chai peer.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit 2a1b66d


🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)


Remediation recommended
1. Test library becomes runtime peer 🐞 Bug ⚙ Maintainability
Description
Adding the Chai-only spec causes @teambit/tracker to declare an exact chai@5.2.1 peer, so
downstream runtime consumers must resolve a test framework that tracker production code never uses.
The repository classifies **/*.spec.ts as dev files, and comparable component specs keep Chai in
devDependencies, so this generated peer is an incorrect dependency classification.
Code

pnpm-lock.yaml[R36877-36878]

+    peerDependencies:
+      chai: 5.2.1
Evidence
The only tracker source import of Chai is the newly added spec, while the workspace explicitly marks
spec files as dev files. A sibling component with the same style of Chai spec import records Chai
under devDependencies, but the tracker lockfile now declares Chai as a peer and auto-installs it
under dependencies.

scopes/component/tracker/determine-main-file.spec.ts[1-5]
workspace.jsonc[737-742]
scopes/component/component-url/component-url.spec.ts[1-4]
pnpm-lock.yaml[18612-18624]
pnpm-lock.yaml[19818-19840]
pnpm-lock.yaml[36872-36878]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new tracker unit spec imports Chai, but the generated package metadata declares `chai@5.2.1` as an exact peer dependency of `@teambit/tracker`. This leaks a test-only library into the published runtime contract and forces consumers to resolve it.
## Issue Context
The workspace declares `**/*.spec.ts` as dev files. Other components with Chai imports in spec files record Chai under `devDependencies`, while the tracker lockfile entry now exposes it as a peer and auto-installs it as a regular importer dependency.
## Fix Focus Areas
- scopes/component/tracker/determine-main-file.spec.ts[1-5]
- workspace.jsonc[737-742]
- pnpm-lock.yaml[19818-19840]
- pnpm-lock.yaml[36872-36878]
Update the tracker component dependency metadata/configuration so Chai is detected as a dev dependency for the spec, then regenerate the lockfile and verify the tracker package no longer declares a Chai peer.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit 3e5d887


🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)


Remediation recommended
1. Test library becomes runtime peer 🐞 Bug ⚙ Maintainability
Description
Adding the Chai-only spec causes @teambit/tracker to declare an exact chai@5.2.1 peer, so
downstream runtime consumers must resolve a test framework that tracker production code never uses.
The repository classifies **/*.spec.ts as dev files, and comparable component specs keep Chai in
devDependencies, so this generated peer is an incorrect dependency classification.
Code

pnpm-lock.yaml[R36877-36878]

+    peerDependencies:
+      chai: 5.2.1
Evidence
The only tracker source import of Chai is the newly added spec, while the workspace explicitly marks
spec files as dev files. A sibling component with the same style of Chai spec import records Chai
under devDependencies, but the tracker lockfile now declares Chai as a peer and auto-installs it
under dependencies.

scopes/component/tracker/determine-main-file.spec.ts[1-5]
workspace.jsonc[737-742]
scopes/component/component-url/component-url.spec.ts[1-4]
pnpm-lock.yaml[18612-18624]
pnpm-lock.yaml[19818-19840]
pnpm-lock.yaml[36872-36878]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new tracker unit spec imports Chai, but the generated package metadata declares `chai@5.2.1` as an exact peer dependency of `@teambit/tracker`. This leaks a test-only library into the published runtime contract and forces consumers to resolve it.
## Issue Context
The workspace declares `**/*.spec.ts` as dev files. Other components with Chai imports in spec files record Chai under `devDependencies`, while the tracker lockfile entry now exposes it as a peer and auto-installs it as a regular importer dependency.
## Fix Focus Areas
- scopes/component/tracker/determine-main-file.spec.ts[1-5]
- workspace.jsonc[737-742]
- pnpm-lock.yaml[19818-19840]
- pnpm-lock.yaml[36872-36878]
Update the tracker component dependency metadata/configuration so Chai is detected as a dev dependency for the spec, then regenerate the lockfile and verify the tracker package no longer declares a Chai peer.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit c63cc61


🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)


Remediation recommended
1. Test library becomes runtime peer 🐞 Bug ⚙ Maintainability
Description
Adding the Chai-only spec causes @teambit/tracker to declare an exact chai@5.2.1 peer, so
downstream runtime consumers must resolve a test framework that tracker production code never uses.
The repository classifies **/*.spec.ts as dev files, and comparable component specs keep Chai in
devDependencies, so this generated peer is an incorrect dependency classification.
Code

pnpm-lock.yaml[R36877-36878]

+    peerDependencies:
+      chai: 5.2.1
Evidence
The only tracker source import of Chai is the newly added spec, while the workspace explicitly marks
spec files as dev files. A sibling component with the same style of Chai spec import records Chai
under devDependencies, but the tracker lockfile now declares Chai as a peer and auto-installs it
under dependencies.

scopes/component/tracker/determine-main-file.spec.ts[1-5]
workspace.jsonc[737-742]
scopes/component/component-url/component-url.spec.ts[1-4]
pnpm-lock.yaml[18612-18624]
pnpm-lock.yaml[19818-19840]
pnpm-lock.yaml[36872-36878]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new tracker unit spec imports Chai, but the generated package metadata declares `chai@5.2.1` as an exact peer dependency of `@teambit/tracker`. This leaks a test-only library into the published runtime contract and forces consumers to resolve it.

## Issue Context
The workspace declares `**/*.spec.ts` as dev files. Other components with Chai imports in spec files record Chai under `devDependencies`, while the tracker lockfile entry now exposes it as a peer and auto-installs it as a regular importer dependency.

## Fix Focus Areas
- scopes/component/tracker/determine-main-file.spec.ts[1-5]
- workspace.jsonc[737-742]
- pnpm-lock.yaml[19818-19840]
- pnpm-lock.yaml[36872-36878]

Update the tracker component dependency metadata/configuration so Chai is detected as a dev dependency for the spec, then regenerate the lockfile and verify the tracker package no longer declares a Chai peer.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread scopes/component/tracker/determine-main-file.spec.ts
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 23f127b

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit c9b3b48

Comment thread scopes/component/tracker/determine-main-file.spec.ts
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit d064888

Comment thread scopes/component/tracker/determine-main-file.spec.ts
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 8d4db88

Comment thread e2e/commands/config.e2e.ts
Comment thread e2e/commands/import.e2e.ts
Comment thread e2e/commands/init.e2e.ts
Comment thread e2e/commands/init.e2e.ts
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit d15dbd2

Comment thread e2e/commands/import.e2e.ts
Comment thread e2e/commands/add.e2e.ts
Comment thread e2e/commands/pattern.e2e.ts
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit ec76886

Comment thread e2e/commands/pattern.e2e.ts
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 0b6f4b3

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 42014fb

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 3e5d887

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 2a1b66d

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit aa5919c

Comment on lines +483 to 486
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`
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

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

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit ad34d94

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

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

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit b796a27

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 4ebf563

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.

1 participant