Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
11 changes: 7 additions & 4 deletions packages/cli/src/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type { Argv } from 'yargs';
import { beforeEach, afterEach, describe, expect, it, vi } from 'vitest';
import {
copyFileSync,
mkdirSync,
mkdtempSync,
readFileSync,
rmSync,
Expand Down Expand Up @@ -376,23 +377,25 @@ describe('bootstrap import boundaries', () => {
expect(output).toBe(`${expectedVersion}\n`);
});

it('falls through to cli.js when wrapper package.json parsing fails', () => {
it('falls through to cli.js when wrapper package.json lookup fails', () => {
const tempDir = mkdtempSync(path.join(tmpdir(), 'qwen-cli-entry-'));
const entryDir = path.join(tempDir, 'bin');
try {
mkdirSync(entryDir);
copyFileSync(
'../../scripts/cli-entry.js',
path.join(tempDir, 'cli-entry.mjs'),
path.join(entryDir, 'cli-entry.mjs'),
);
writeFileSync(
path.join(tempDir, 'cli.js'),
path.join(entryDir, 'cli.js'),
"process.stdout.write('fallback-cli\\n');\n",
);
const env = { ...process.env };
delete env['CLI_VERSION'];

const output = execFileSync(
process.execPath,
[path.join(tempDir, 'cli-entry.mjs'), '--version'],
[path.join(entryDir, 'cli-entry.mjs'), '--version'],
{
encoding: 'utf8',
env,
Expand Down
Loading
Loading