Repository navigation
test(e2e): real-CLI e2e for data-layout migration (#374) and multi-project (#375) - #531
Merged
Merged
Conversation
…i-project (#375) Cover the two gaps in real-command e2e: - data-layout-migration.test.ts: seed a legacy <repo>/.teamai (real team-repo clone + plaintext env + localPath into legacy), run the compiled CLI 'pull --force', and assert the preAction hook migrated data into ~/.teamai/projects/<slug>/, kept the git clone intact, rebased repo.localPath onto the partition, retired the source to .teamai.bak, and pulled through the migrated clone. - multi-project.test.ts: 'projects set' + 'pull --force' deploys only the active project's skills and prunes an inactivated one; 'push --project' routes a skill into the project's skills/<ns>/ on the remote, matching what pull reads. Hermetic: sandbox HOME + local bare remote (provider: git), no network, tokens, or PR creation. Land in src/__tests__/e2e/ so vitest.e2e.config picks them up.
5 of 9 tasks
Walternater
pushed a commit
to Walternater/teamai-cli
that referenced
this pull request
Nov 2, 2026
…nd multi-project (Tencent#375) (Tencent#531) Cover the two gaps in real-command e2e: - data-layout-migration.test.ts: seed a legacy <repo>/.teamai (real team-repo clone + plaintext env + localPath into legacy), run the compiled CLI 'pull --force', and assert the preAction hook migrated data into ~/.teamai/projects/<slug>/, kept the git clone intact, rebased repo.localPath onto the partition, retired the source to .teamai.bak, and pulled through the migrated clone. - multi-project.test.ts: 'projects set' + 'pull --force' deploys only the active project's skills and prunes an inactivated one; 'push --project' routes a skill into the project's skills/<ns>/ on the remote, matching what pull reads. Hermetic: sandbox HOME + local bare remote (provider: git), no network, tokens, or PR creation. Land in src/__tests__/e2e/ so vitest.e2e.config picks them up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the two missing real-command end-to-end tests for features that
previously had only function-level unit coverage:
src/__tests__/e2e/data-layout-migration.test.ts(Proposal: teamai 数据目录全局化 + 按项目分区(业务仓库工作区零残留) #374) — the legacy<repo>/.teamai→ partition migration was only exercised by callingplanMigration/runMigrationdirectly (migrate.test.ts). This drives thecompiled CLI instead: seed a real legacy layout (real
team-repoclone +plaintext
env+localPathpointing into legacy), runteamai pull --force,and assert the
preActionhook actually migrated it.src/__tests__/e2e/multi-project.test.ts(Proposal: 一个团队仓库承载多个项目(project 作为与 role 正交的维度) #375) — the user-facingprojects/push --projectcommands had no real-CLI e2e (onlyprojects.test.ts/members.test.tsresolver unit tests). This covers theactivate → pull → prune isolation loop and the push→namespace round-trip.
No production code changes — tests only.
Why
Audit of
#374/#375coverage found: migration's "legacy → realpull→partition" path was never asserted through the actual CLI, and the multi-project
user commands (
projects set,pull --projectisolation,push --project) hadzero real-CLI e2e. These two files close both gaps.
How it's tested (mechanism)
spawn('node', [dist/index.js, ...])— runs the compiled binary, exactlylike a user shell, not imported functions.
HOME→ partition (~/.teamai/projects/<slug>) is confined to amkdtempdir, torn down after; never touches the real~/.teamai.provider: git) →pull/pushare real git opswith no network, no tokens, no PR creation. Hermetic; runs on fork PRs too.
Test Plan
npx tsc --noEmitnpm run builddist/index.js(vitest --config vitest.e2e.config.ts)Notes
src/__tests__/e2e/, sovitest.e2e.config.ts'sincludepicks them up and CI's "Run E2E (full surface)" job runs them automatically.
/tmp→/private/tmpsymlink: the migration testrealpathSyncs itssandbox so the slug it computes matches the CLI's (
realpath-based) one.