diff --git a/package.json b/package.json
index 001b2deda..ed4e52846 100644
--- a/package.json
+++ b/package.json
@@ -80,7 +80,6 @@
"@types/mime-types": "^3.0.1",
"@types/minimatch": "^5.1.2",
"@types/mock-fs": "^4.13.4",
- "@types/qrcode-terminal": "^0.12.2",
"@types/shell-quote": "^1.7.5",
"@types/uuid": "^10.0.0",
"@vitest/coverage-v8": "^3.1.1",
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 11fdb8d96..2aa764336 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -59,7 +59,6 @@
"open": "^10.1.2",
"p-limit": "^7.3.0",
"prompts": "^2.4.2",
- "qrcode-terminal": "^0.12.0",
"react": "^19.1.0",
"read-package-up": "^11.0.0",
"shell-quote": "^1.8.3",
diff --git a/packages/cli/src/ui/components/QwenOAuthProgress.test.tsx b/packages/cli/src/ui/components/QwenOAuthProgress.test.tsx
index 29eb3712a..d4d932e9e 100644
--- a/packages/cli/src/ui/components/QwenOAuthProgress.test.tsx
+++ b/packages/cli/src/ui/components/QwenOAuthProgress.test.tsx
@@ -17,13 +17,6 @@ vi.mock('../hooks/useKeypress.js', () => ({
useKeypress: vi.fn(),
}));
-// Mock qrcode-terminal module
-vi.mock('qrcode-terminal', () => ({
- default: {
- generate: vi.fn(),
- },
-}));
-
// Mock ink-spinner
vi.mock('ink-spinner', () => ({
default: ({ type }: { type: string }) => `MockSpinner(${type})`,
@@ -117,44 +110,21 @@ describe('QwenOAuthProgress', () => {
const { lastFrame } = renderComponent({ deviceAuth: mockDeviceAuth });
const output = lastFrame();
- // Initially no QR code shown until it's generated, but the status area should be visible
expect(output).toContain('MockSpinner(dots)');
expect(output).toContain('Waiting for authorization');
expect(output).toContain('Time remaining: 5:00');
expect(output).toContain('(Press ESC or CTRL+C to cancel)');
});
- it('should display correct URL in Static component when QR code is generated', async () => {
- const qrcode = await import('qrcode-terminal');
- const mockGenerate = vi.mocked(qrcode.default.generate);
-
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- let qrCallback: any = null;
- mockGenerate.mockImplementation((url, options, callback) => {
- qrCallback = callback;
- });
-
+ it('should display correct URL in auth URL display', () => {
const customAuth = createMockDeviceAuth({
verification_uri_complete: 'https://custom.com/auth?code=XYZ789',
});
- const { lastFrame, rerender } = renderComponent({
+ const { lastFrame } = renderComponent({
deviceAuth: customAuth,
});
- // Manually trigger the QR code callback
- if (qrCallback && typeof qrCallback === 'function') {
- qrCallback('Mock QR Code Data');
- }
-
- rerender(
- ,
- );
-
expect(lastFrame()).toContain('https://custom.com/auth?code=XYZ789');
});
@@ -331,98 +301,6 @@ describe('QwenOAuthProgress', () => {
});
});
- describe('QR Code functionality', () => {
- it('should generate QR code when deviceAuth is provided', async () => {
- const qrcode = await import('qrcode-terminal');
- const mockGenerate = vi.mocked(qrcode.default.generate);
-
- mockGenerate.mockImplementation((url, options, callback) => {
- callback!('Mock QR Code Data');
- });
-
- render(
- ,
- );
-
- expect(mockGenerate).toHaveBeenCalledWith(
- mockDeviceAuth.verification_uri_complete,
- { small: true },
- expect.any(Function),
- );
- });
-
- it('should display QR code in Static component when available', async () => {
- const qrcode = await import('qrcode-terminal');
- const mockGenerate = vi.mocked(qrcode.default.generate);
-
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- let qrCallback: any = null;
- mockGenerate.mockImplementation((url, options, callback) => {
- qrCallback = callback;
- });
-
- const { lastFrame, rerender } = render(
- ,
- );
-
- // Manually trigger the QR code callback
- if (qrCallback && typeof qrCallback === 'function') {
- qrCallback('Mock QR Code Data');
- }
-
- rerender(
- ,
- );
-
- const output = lastFrame();
- expect(output).toContain('Or scan the QR code below:');
- expect(output).toContain('Mock QR Code Data');
- });
-
- it('should handle QR code generation errors gracefully', async () => {
- const qrcode = await import('qrcode-terminal');
- const mockGenerate = vi.mocked(qrcode.default.generate);
- mockGenerate.mockImplementation(() => {
- throw new Error('QR Code generation failed');
- });
-
- const { lastFrame } = render(
- ,
- );
-
- // Should not crash and should not show QR code section since QR generation failed
- const output = lastFrame();
- expect(output).not.toContain('Or scan the QR code below:');
- });
-
- it('should not generate QR code when deviceAuth is null', async () => {
- const qrcode = await import('qrcode-terminal');
- const mockGenerate = vi.mocked(qrcode.default.generate);
-
- render(
- ,
- );
-
- expect(mockGenerate).not.toHaveBeenCalled();
- });
- });
-
describe('User interactions', () => {
it('should call onCancel when ESC key is pressed', () => {
render(
diff --git a/packages/core/src/qwen/qwenOAuth2.test.ts b/packages/core/src/qwen/qwenOAuth2.test.ts
index 7ff3207d8..41d06afbe 100644
--- a/packages/core/src/qwen/qwenOAuth2.test.ts
+++ b/packages/core/src/qwen/qwenOAuth2.test.ts
@@ -91,13 +91,6 @@ vi.mock('./sharedTokenManager.js', () => ({
},
}));
-// Mock qrcode-terminal
-vi.mock('qrcode-terminal', () => ({
- default: {
- generate: vi.fn(),
- },
-}));
-
// Mock open
vi.mock('open', () => ({
default: vi.fn(),