test(integration): install the local extension fixture from a subdirectory (#16222)

TestRig.setup() now points QWEN_HOME at `<testDir>/.qwen-home`, and this
case installed `<testDir>` itself as the extension. An install copies its
source tree into the extension store, so the destination sat under the
source and fs.cp refused it: every E2E shard has failed on 35aa4b76 with
`Invalid src or dest: cp returned EINVAL (cannot copy ... to a subdirectory
of self ...)`.

Write the fixture into `local-extension/` and install that instead. The
case still covers install, list, update and uninstall of a local extension.

Verified against origin/main in a worktree: the case fails with the same
EINVAL before this change and passes (2/2) after it; eslint, prettier and
`tsc -p integration-tests/tsconfig.json` are clean.
This commit is contained in:
易良 authored and GitHub committed 2026-11-04 04:01:24 +08:00
1 parent 632b06094e
commit b09e821485
1 file changed
+10 -5
@@ -22,7 +22,13 @@ const extensionUpdate = `{
test('installs a local extension, verifies a command, and updates it', async () => {
const rig = new TestRig();
await rig.setup('extension install test');
const testServerPath = join(rig.testDir!, 'qwen-extension.json');
// Install from a nested directory: the rig keeps QWEN_HOME inside the test
// directory, and an install copies its source tree into that store, so
// pointing it at the test root would copy the store into itself and fs.cp
// rejects that with EINVAL.
const extensionDir = join(rig.testDir!, 'local-extension');
mkdirSync(extensionDir, { recursive: true });
const testServerPath = join(extensionDir, 'qwen-extension.json');
writeFileSync(testServerPath, extension);
try {
await rig.runCommand(['extensions', 'uninstall', 'test-extension']);
@@ -30,10 +36,9 @@ test('installs a local extension, verifies a command, and updates it', async ()
/* empty */
}
const result = await rig.runCommand(
['extensions', 'install', `${rig.testDir!}`],
{ stdin: 'y\n' },
);
const result = await rig.runCommand(['extensions', 'install', extensionDir], {
stdin: 'y\n',
});
expect(result).toContain('test-extension');
const listResult = await rig.runCommand(['extensions', 'list']);