fix: restore CLI and quota provider startup (#1857)
Export ngrok tunnel capabilities for CLI startup Import Clack spinner/progress helpers used in interactive CLI paths Restore Google quota provider registry exports
This commit is contained in:
@@ -15,6 +15,8 @@ import {
|
||||
select,
|
||||
text,
|
||||
password,
|
||||
spinner,
|
||||
progress,
|
||||
cancel,
|
||||
isCancel,
|
||||
} from '@clack/prompts';
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
async function withInteractiveTty(fn) {
|
||||
const stdoutDescriptor = Object.getOwnPropertyDescriptor(process.stdout, 'isTTY');
|
||||
const stdinDescriptor = Object.getOwnPropertyDescriptor(process.stdin, 'isTTY');
|
||||
|
||||
Object.defineProperty(process.stdout, 'isTTY', { configurable: true, value: true });
|
||||
Object.defineProperty(process.stdin, 'isTTY', { configurable: true, value: true });
|
||||
|
||||
try {
|
||||
return await fn();
|
||||
} finally {
|
||||
if (stdoutDescriptor) {
|
||||
Object.defineProperty(process.stdout, 'isTTY', stdoutDescriptor);
|
||||
} else {
|
||||
delete process.stdout.isTTY;
|
||||
}
|
||||
|
||||
if (stdinDescriptor) {
|
||||
Object.defineProperty(process.stdin, 'isTTY', stdinDescriptor);
|
||||
} else {
|
||||
delete process.stdin.isTTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
describe('cli output', () => {
|
||||
it('creates interactive clack spinner and progress helpers', async () => {
|
||||
await withInteractiveTty(async () => {
|
||||
const output = await import('./cli-output.js?interactive-test');
|
||||
|
||||
expect(output.createSpinner({})).toBeTruthy();
|
||||
await expect(output.createProgress({}, { max: 2 })).resolves.toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -10,6 +10,11 @@ import { pathToFileURL } from 'url';
|
||||
import { isModuleCliExecution, normalizeCliEntryPath } from './cli-entry.js';
|
||||
import { requestJson } from './lib/cli-http.js';
|
||||
import { inspectTunnelAttachability } from './lib/cli-lifecycle.js';
|
||||
import { DEFAULT_TUNNEL_PROVIDER_CAPABILITIES } from './lib/cli-tunnel-capabilities.js';
|
||||
import {
|
||||
TUNNEL_PROVIDER_CLOUDFLARE,
|
||||
TUNNEL_PROVIDER_NGROK,
|
||||
} from '../server/lib/tunnels/types.js';
|
||||
import {
|
||||
assertAuthenticatedNetworkExposure,
|
||||
commands,
|
||||
@@ -173,6 +178,13 @@ function spawnOpenChamberLikeHungServer(port) {
|
||||
}
|
||||
|
||||
describe('cli args', () => {
|
||||
it('loads fallback tunnel provider capabilities for CLI startup', () => {
|
||||
expect(DEFAULT_TUNNEL_PROVIDER_CAPABILITIES.map((provider) => provider.provider)).toEqual([
|
||||
TUNNEL_PROVIDER_CLOUDFLARE,
|
||||
TUNNEL_PROVIDER_NGROK,
|
||||
]);
|
||||
});
|
||||
|
||||
it('accepts legacy daemon flags as no-ops', () => {
|
||||
expect(parseArgs(['serve', '--daemon']).removedFlagErrors).toEqual([]);
|
||||
expect(parseArgs(['serve', '-d']).removedFlagErrors).toEqual([]);
|
||||
|
||||
Reference in New Issue
Block a user