Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
86ddb05
test(e2e): remove redundant add/config e2e tests, add determine-main-…
davidfirst Aug 20, 2026
23f127b
test(e2e): trim diff e2e tests
davidfirst Aug 20, 2026
c9b3b48
test(e2e): fix mislabeled describe title in export e2e
davidfirst Aug 20, 2026
d064888
test(e2e): trim import e2e tests
davidfirst Aug 21, 2026
8d4db88
test(e2e): trim init e2e tests
davidfirst Aug 21, 2026
d15dbd2
test(e2e): trim list e2e tests
davidfirst Aug 21, 2026
ec76886
test(e2e): trim pattern e2e tests
davidfirst Aug 21, 2026
0b6f4b3
test(e2e): fix mislabeled lane describe titles in remove e2e
davidfirst Aug 21, 2026
42014fb
test(e2e): trim search e2e tests
davidfirst Aug 21, 2026
7b57c23
test(e2e): trim tag e2e tests
davidfirst Aug 21, 2026
1bcf370
test(e2e): remove duplicated assertion in doctor-git-exec e2e
davidfirst Aug 21, 2026
423aed7
test(e2e): remove empty describe with dead setup in id-with-wildcard e2e
davidfirst Aug 21, 2026
1136124
test(e2e): remove skipped test in out-of-sync e2e
davidfirst Aug 21, 2026
aa40bd7
test(e2e): trim sort-components-output e2e tests
davidfirst Aug 21, 2026
69a215c
test: exercise index tie-break in determine-main-file spec, use consu…
davidfirst Aug 24, 2026
055654c
test(e2e): remove no-op assertion in binary-files e2e
davidfirst Aug 24, 2026
68773ce
test(e2e): trim components-index e2e tests
davidfirst Aug 24, 2026
a344d15
test(e2e): trim dev-dependencies e2e tests
davidfirst Aug 24, 2026
034bc3f
test(e2e): trim dynamic-namespaces e2e tests
davidfirst Aug 24, 2026
1d9b4d5
test(e2e): trim merge e2e tests
davidfirst Aug 24, 2026
4322609
test(e2e): remove permanently-skipped describes in peer-dependencies e2e
davidfirst Aug 24, 2026
e06ba16
Merge remote-tracking branch 'origin/master' into e2e-cleanup
davidfirst Aug 24, 2026
9421d14
test(e2e): trim peer-dependency-component e2e tests
davidfirst Aug 24, 2026
3409f91
chore: update pnpm-lock after master merge
davidfirst Aug 24, 2026
4a8de13
test(e2e): remove dead skipped describes in workspace-config e2e
davidfirst Aug 24, 2026
6fc6e13
test(e2e): remove subsumed source-map assertion in babel e2e
davidfirst Aug 24, 2026
3af757b
test(e2e): merge duplicate error assertions in build-cmd e2e
davidfirst Aug 25, 2026
8635fce
test(e2e): trim checkout-harmony e2e tests
davidfirst Aug 25, 2026
008e3f8
test(e2e): clean duplicated and orphan comments in ci-sync-branch-own…
davidfirst Aug 25, 2026
40b1e88
test(e2e): clean duplicated and orphan comments in ci-sync-convergenc…
davidfirst Aug 25, 2026
d7f15f7
test(e2e): remove orphan split-leftover comments in ci-sync-lane-cycl…
davidfirst Aug 25, 2026
5a2aa87
test(e2e): fix comment placement and remove orphan comments in ci-syn…
davidfirst Aug 25, 2026
21a6b5d
test(e2e): remove orphan trailing comment in ci-sync-scopes e2e
davidfirst Aug 25, 2026
eee24ee
test(e2e): trim ci-bitmap-auto-sync e2e tests
davidfirst Aug 25, 2026
a5f6652
test(e2e): fix stale file references in ci-sync-state comments
davidfirst Aug 25, 2026
49c1e2b
test(e2e): trim compile e2e tests
davidfirst Aug 25, 2026
579c060
Merge remote-tracking branch 'origin/master' into e2e-cleanup
davidfirst Aug 25, 2026
8e823db
test(e2e): trim component-config e2e tests
davidfirst Aug 25, 2026
4963504
test(e2e): remove unused chai plugins from corrupted-objects e2e
davidfirst Aug 25, 2026
75a02cb
test(e2e): trim create e2e tests
davidfirst Aug 25, 2026
c63cc61
Merge remote-tracking branch 'origin/master' into e2e-cleanup
davidfirst Aug 25, 2026
3e5d887
test(e2e): merge load/run assertion pairs in custom-aspects e2e
davidfirst Aug 25, 2026
2a1b66d
test(e2e): trim custom-env-operations e2e tests, fix no-op assertion
davidfirst Aug 25, 2026
aa5919c
test(e2e): remove dead skip and duplicate after hook in custom-env e2e
davidfirst Aug 25, 2026
ad34d94
test(e2e): remove simple scenario subsumed by complex in deduplicatio…
davidfirst Aug 26, 2026
ad4258a
test(e2e): fix stale config re-read in dependencies-cmd e2e
davidfirst Aug 26, 2026
b6e33a1
test(e2e): remove deprecated-yarn dead skip in never-built-dependenci…
davidfirst Aug 26, 2026
b30529f
test(e2e): merge capsule package.json pair in optional-dependencies e2e
davidfirst Aug 26, 2026
04b5fd5
test(e2e): trim dependency-resolver e2e tests
davidfirst Aug 26, 2026
5d896dd
test(e2e): remove deprecated-yarn dead skips in deps-in-capsules e2e
davidfirst Aug 26, 2026
86cc51e
test(e2e): dedupe flag-independent assertions in eject-harmony e2e
davidfirst Aug 27, 2026
6634c31
test(e2e): remove 5-year-skipped resume-export suites and their stale…
davidfirst Aug 27, 2026
5cc109e
test(e2e): remove placeholder skip in extensions-config-diff e2e
davidfirst Aug 27, 2026
b796a27
test(e2e): trim extensions-config e2e tests
davidfirst Aug 27, 2026
25e3a81
Merge remote-tracking branch 'origin/master' into e2e-cleanup
davidfirst Aug 27, 2026
b014c4f
chore: update pnpm-lock after master merge
davidfirst Aug 27, 2026
13e9dc4
test(e2e): trim import-harmony e2e tests
davidfirst Aug 27, 2026
377240c
test(e2e): fix copy-pasted test name in imported-component-deps e2e
davidfirst Aug 27, 2026
a995654
test(e2e): remove deprecated yarn describe in install-and-compile e2e
davidfirst Aug 27, 2026
05f8d3c
test(e2e): remove dead yarn and obsolete skipped tests in install e2e
davidfirst Aug 27, 2026
72bcd9f
test(e2e): remove pattern-variation describe in internalize e2e
davidfirst Aug 27, 2026
4ebf563
test(e2e): drop duplicate jest runs in jest e2e
davidfirst Aug 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 1 addition & 88 deletions e2e/commands/add.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import chai, { expect } from 'chai';
import fs from 'fs-extra';
import * as path from 'path';
import { OutsideWorkspaceError } from '@teambit/workspace';
import { InvalidName } from '@teambit/legacy-bit-id';
import { statusInvalidComponentsMsg } from '@teambit/legacy.constants';
import { MainFileIsDir, PathOutsideConsumer, VersionShouldBeRemoved } from '@teambit/tracker';
import { MissingMainFile } from '@teambit/legacy.bit-map';
import { Helper } from '@teambit/legacy.e2e-helper';
import chaiFs from 'chai-fs';
import assertArrays from 'chai-arrays';
Expand Down Expand Up @@ -69,34 +67,11 @@ describe('bit add command', function () {
const bitMap = helper.bitMap.read();
expect(bitMap).to.have.property('test/bar');
});
it('Should throw error when no index file is found', () => {
const file1 = 'foo1.js';
const file2 = 'foo2.js';
helper.fs.createFile('bar', file1);
helper.fs.createFile('bar', file2);

const addCmd = () => helper.command.addComponent('bar', { n: 'test' });
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
const error = new MissingMainFile(`${helper.scopes.remote}/test/bar`);
helper.general.expectToThrow(addCmd, error);
});
it('Should throw error msg if -i and -n flag are used with bit add', () => {
helper.fs.createFile('bar', 'foo2.js');
const addCmd = () => helper.command.addComponent('bar', { n: 'test', i: 'jaja' });
expect(addCmd).to.throw('please use either [id] or [namespace] to add a particular component');
});
it('Should prevent adding a file with invalid keys in namespace', () => {
const error = new InvalidName('bar.f/foo');
helper.fixtures.createComponentBarFoo();
const addFunc = () => helper.command.addComponent('bar', { i: 'bar.f/foo' });
helper.general.expectToThrow(addFunc, error);
});
it('Should prevent adding a file with invalid keys in ID', () => {

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. Invalid add ids untested 🐞 Bug ⚙ Maintainability

Deleting the malformed-ID cases leaves bit add with no active test that verifies dotted or
uppercase explicit IDs are rejected. A regression in the command’s BitId.parse(this.id, false)
integration could therefore accept invalid component IDs while the remaining add tests and the new
main-file unit suite still pass.
Agent Prompt
## Issue description
Restore coverage proving that `bit add` rejects malformed explicit component IDs and namespaces.

## Issue Context
The PR removes all three malformed-ID integration cases, while the remaining add tests use only valid IDs. The new unit spec covers main-file selection, not ID parsing.

## Fix Focus Areas
- e2e/commands/add.e2e.ts[88-114]

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

const error = new InvalidName('bar/fo.o');
helper.fixtures.createComponentBarFoo();
const addFunc = () => helper.command.addComponent('bar', { i: 'bar/fo.o' });
helper.general.expectToThrow(addFunc, error);
});
it('Define dynamic main file ', () => {
const mainFileOs = path.normalize('{PARENT}/{PARENT}.js');
helper.fs.createFile('bar', 'bar.js');
Expand All @@ -107,12 +82,6 @@ describe('bit add command', function () {
const mainFile = bitMap['test/bar'].mainFile;
expect(mainFile).to.equal('bar.js');
});
it('Should return error if used an invalid ID', () => {
helper.fs.createFile('bar', 'foo.js');
const addFunc = () => helper.command.addComponent('bar', { i: 'Bar/foo' });
const error = new InvalidName('Bar/foo');
helper.general.expectToThrow(addFunc, error);
});
it('should add component with id contains only one level', () => {
helper.fs.createFile('bar', 'foo.js');
helper.command.addComponent('bar', {
Expand All @@ -122,20 +91,6 @@ describe('bit add command', function () {
expect(bitMap).to.have.property('foo');
});
});
describe('with multiple index files', () => {
before(() => {
helper.scopeHelper.reInitWorkspace();
helper.fs.createFile('bar', 'index.js');
helper.fs.createFile('bar', 'foo.js');
helper.fs.createFile(path.join('bar', 'exceptions'), 'some-exception.js');
helper.fs.createFile(path.join('bar', 'exceptions'), 'index.js');
helper.command.addComponent('bar', { i: 'bar/foo' });
});
it('should identify the closest index file as the main file', () => {
const bitMap = helper.bitMap.read();
expect(bitMap['bar/foo'].mainFile).to.equal('index.js');
});
});
describe('add component/s with gitignore', () => {
let errorMessage;
before(() => {
Expand All @@ -155,22 +110,14 @@ describe('bit add command', function () {
});
});
describe('ignore specific files inside component', () => {
let output;
before(() => {
helper.scopeHelper.reInitWorkspace();
helper.fs.createFile('bar', 'foo.js');
helper.fs.createFile('bar', 'foo3.js');
helper.fs.createFile('bar', 'boo.js');
helper.fs.createFile('bar', 'index.js');
helper.git.writeGitIgnore(['bar/foo.js', 'bar/foo3.js']);
output = helper.command.addComponent(path.normalize('bar'), { i: 'bar/foo' });
});
it('Should track component ', () => {
expect(output).to.contain('bar/foo');
});
it('Should contain component inside bitmap', () => {
const bitMap = helper.bitMap.read();
expect(bitMap).to.have.property('bar/foo');
helper.command.addComponent(path.normalize('bar'), { i: 'bar/foo' });
});
it('Should contain inside bitmap only files that are not inside gitignore', () => {
const files = helper.command.getComponentFiles('bar/foo');
Expand Down Expand Up @@ -258,38 +205,4 @@ describe('bit add command', function () {
helper.general.expectToThrow(addCmd, error);
});
});
describe('no mainFile and one of the files has the same name as the directory', () => {
before(() => {
helper.scopeHelper.reInitWorkspace();
helper.fs.createFile('bar', 'bar.js');
helper.fs.createFile('bar', 'foo.js');
helper.command.addComponent('bar');
});
it('should resolve the mainFile as the file with the same name as the directory', () => {
const bitMap = helper.bitMap.read();
const bar = bitMap.bar;
expect(bar.mainFile).to.equal('bar.js');
});
});
describe('sort .bitmap components', () => {
Comment thread
davidfirst marked this conversation as resolved.
before(() => {
helper.scopeHelper.reInitWorkspace();
helper.fs.createFileOnRootLevel('aaa/aaa.js');
helper.fs.createFileOnRootLevel('bbb/bbb.js');
helper.fs.createFileOnRootLevel('ccc/ccc.js');
helper.fs.createFileOnRootLevel('ddd/ddd.js');
helper.command.addComponent('bbb');
helper.command.addComponent('ddd');
helper.command.addComponent('aaa');
helper.command.addComponent('ccc');
});
it('should sort the components in .bitmap file alphabetically', () => {
const bitMap = helper.bitMap.read();
const ids = Object.keys(bitMap);
expect(ids[0]).to.equal('aaa');
expect(ids[1]).to.equal('bbb');
expect(ids[2]).to.equal('ccc');
expect(ids[3]).to.equal('ddd');
});
});
});
22 changes: 0 additions & 22 deletions e2e/commands/config.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,6 @@ describe('bit config', function () {
});
});

describe('git propagation', () => {
Comment thread
qodo-free-for-open-source-projects[bot] marked this conversation as resolved.
before(() => {
helper.scopeHelper.reInitWorkspace();
helper.git.initNewGitRepo();
helper.command.runCmd('bit config set conf.key bit-value');
// Commented because of permission issue
// helper.git.addGitConfig('conf.key', 'git-system-val', 'system');
helper.git.addGitConfig('conf.key', 'git-global-val', 'global');
helper.git.addGitConfig('conf.key', 'git-local-val', 'local');
});
it('should read config from bit if exists', () => {
const confVal = helper.command.runCmd('bit config get conf.key');
expect(confVal).to.have.string('bit-value\n');
});
it('should not throw an error if not exists both in git and bit', () => {
// const confVal = helper.command.runCmd('bit config get nonExistsKey');
// expect(confVal).to.be.oneOf(['\n', '', 'undefined\n']);
const getNonExistConf = () => helper.command.runCmd('bit config get nonExistsKey');
expect(getNonExistConf).to.not.throw();
});
});

describe('saving config in the local workspace', () => {
before(() => {
helper.scopeHelper.reInitWorkspace();
Expand Down
35 changes: 0 additions & 35 deletions e2e/commands/diff.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,41 +217,6 @@ describe('bit diff command', function () {
expect(diffOfVersionOutput).to.be.equal(output);
});
});
describe('running bit diff between current version and version 0.0.1', () => {
before(() => {
helper.command.tagAllComponents(undefined, undefined, false);
output = helper.command.diff('bar/foo 0.0.1');
});
it('should indicate the deleted files as deleted', () => {
expect(output).to.have.string(`--- ${barFooFile} (0.0.1)`);
expect(output).to.have.string(`+++ ${barFooFile} (0.0.2)`);
expect(output).to.have.string(`-${barFooV1}`);
});
it('should indicate the added files as added', () => {
const barFoo2File = 'foo2.js';
expect(output).to.have.string(`--- ${barFoo2File} (0.0.1)`);
expect(output).to.have.string(`+++ ${barFoo2File} (0.0.2)`);
expect(output).to.have.string(`+${barFooV2}`);
});
describe('other fields diff', () => {
it('should indicate that the mainFile was changed', () => {
expect(output).to.have.string('--- Main File (0.0.1)');
expect(output).to.have.string('+++ Main File (0.0.2)');
expect(output).to.have.string('- foo.js');
expect(output).to.have.string('+ foo2.js');
});
it('should indicate that the files array were changed', () => {
expect(output).to.have.string('--- Files (0.0.1)');
expect(output).to.have.string('+++ Files (0.0.2)');
expect(output).to.have.string('- [ foo.js ]');
expect(output).to.have.string('+ [ foo2.js ]');
});
});
it('should have the same output as running diff of the previous version', () => {
const diffOfVersionOutput = helper.command.diff('bar/foo 0.0.1');
expect(diffOfVersionOutput).to.be.equal(output);
});
});
});
describe('component with multiple versions', () => {
before(() => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/commands/export.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ describe('bit export command', function () {
expect(list).to.have.lengthOf(1);
});
});
describe('export with --all flag', () => {
describe('export with --all-versions flag', () => {
before(() => {
helper.scopeHelper.reInitRemoteScope();
helper.command.export(`${helper.scopes.remote} ${helper.scopes.remote}/* --all-versions`);
Expand Down
78 changes: 1 addition & 77 deletions e2e/commands/import.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,70 +157,6 @@ describe('bit import', function () {
expect(componentFileLocation).to.be.a.file();
});
});
describe('when the destination is an existing empty directory', () => {
Comment thread
qodo-free-for-open-source-projects[bot] marked this conversation as resolved.
before(() => {
helper.scopeHelper.reInitWorkspace();
helper.scopeHelper.addRemoteScope();
fs.ensureDirSync(path.join(helper.scopes.localPath, 'my-custom-location'));
helper.command.runCmd(`bit import ${helper.scopes.remote}/global/simple -p my-custom-location`);
});
it('should write the component to the specified path', () => {
expect(componentFileLocation).to.be.a.file();
});
});
describe('when the destination directory is not empty', () => {
let output;
let existingFile;
before(() => {
existingFile = path.join(helper.scopes.localPath, 'my-custom-location/my-file.js');
helper.scopeHelper.reInitWorkspace();
helper.scopeHelper.addRemoteScope();
fs.ensureDirSync(path.join(helper.scopes.localPath, 'my-custom-location'));
fs.outputFileSync(existingFile, 'console.log()');
output = helper.general.runWithTryCatch(
`bit import ${helper.scopes.remote}/global/simple -p my-custom-location`
);
});
it('should not import the component', () => {
expect(componentFileLocation).to.not.be.a.path();
});
it('should not delete the existing file', () => {
expect(existingFile).to.be.a.file();
});
it('should throw an error', () => {
expect(output).to.have.string('unable to import');
});
it('should import successfully if the --override flag is used', () => {
helper.command.runCmd(`bit import ${helper.scopes.remote}/global/simple -p my-custom-location --override`);
expect(componentFileLocation).to.be.a.file();
});
});
describe('when the destination is a file', () => {
let output;
before(() => {
helper.scopeHelper.reInitWorkspace();
helper.scopeHelper.addRemoteScope();
fs.outputFileSync(path.join(helper.scopes.localPath, 'my-custom-location'), 'console.log()');
output = helper.general.runWithTryCatch(
`bit import ${helper.scopes.remote}/global/simple -p my-custom-location`
);
});
it('should not import the component', () => {
expect(componentFileLocation).to.not.be.a.path();
});
it('should not delete the existing file', () => {
expect(path.join(helper.scopes.localPath, 'my-custom-location')).to.be.a.file();
});
it('should throw an error', () => {
expect(output).to.have.string('unable to import');
});
it('should throw an error also when the --override flag is used', () => {
Comment thread
qodo-free-for-open-source-projects[bot] marked this conversation as resolved.
output = helper.general.runWithTryCatch(
`bit import ${helper.scopes.remote}/global/simple -p my-custom-location --override`
);
expect(output).to.have.string('unable to import');
});
});
});
});

Expand Down Expand Up @@ -544,24 +480,12 @@ describe('bit import', function () {
expect(output).to.have.string('--dependencies-depth');
expect(output).to.have.string('--dependencies');
});
it('should error when --dependencies-depth is zero', () => {
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`
);
Comment thread
davidfirst marked this conversation as resolved.
Comment on lines +483 to 486

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

expect(output).to.have.string('positive integer');
});
it('should error when --dependencies-depth is a non-integer', () => {
Comment thread
qodo-free-for-open-source-projects[bot] marked this conversation as resolved.
const output = helper.general.runWithTryCatch(
`bit import ${helper.scopes.remote}/comp1 --dependencies --dependencies-depth abc`
);
expect(output).to.have.string('positive integer');
});
it('should error when --dependencies-depth is a fractional number', () => {
const output = helper.general.runWithTryCatch(
`bit import ${helper.scopes.remote}/comp1 --dependencies --dependencies-depth 1.5`
);
expect(output).to.have.string('positive integer');
});
});
});
describe('external package manager mode', () => {
Expand Down
Loading