MCPcopy Create free account
hub / github.com/vercel/vercel / getLocalhost

Function getLocalhost

packages/cli/test/integration-1.test.ts:35–58  ·  view source on GitHub ↗
(vc: CLIProcess)

Source from the content-addressed store, hash-verified

33}
34
35async function getLocalhost(vc: CLIProcess): Promise<RegExpExecArray> {
36 let localhost: RegExpExecArray | undefined;
37 await waitForPrompt(
38 vc,
39 chunk => {
40 const line = chunk.toString();
41 if (line.includes('Ready! Available at')) {
42 localhost = /(https?:[^\s]+)/g.exec(line) || undefined;
43 return true;
44 }
45 return false;
46 },
47 5000
48 );
49
50 // This should never happen because waitForPrompt will time out
51 // and never return here in this case, but extra checking is fine
52 // and it makes typescript happy
53 if (!localhost) {
54 throw new Error('Localhost not found!');
55 }
56
57 return localhost;
58}
59
60beforeAll(async () => {
61 try {

Callers 3

vcDevWithEnvFunction · 0.85
vcDevAndFetchCloudVarsFunction · 0.85
vcDevAndFetchSystemVarsFunction · 0.85

Calls 2

waitForPromptFunction · 0.85
toStringMethod · 0.45

Tested by

no test coverage detected