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

Function waitForDeployment

packages/cli/test/integration-3.test.ts:39–65  ·  view source on GitHub ↗
(href: RequestInfo)

Source from the content-addressed store, hash-verified

37};
38
39const waitForDeployment = async (href: RequestInfo) => {
40 console.log(`waiting for ${href} to become ready...`);
41 const start = Date.now();
42 const max = ms('4m');
43
44 while (true) {
45 const response = await nodeFetch(href, { redirect: 'manual' });
46 const text = await response.text();
47 if (
48 response.status === 200 &&
49 !text.includes('<title>Deployment Overview')
50 ) {
51 break;
52 }
53
54 const current = Date.now();
55
56 if (current - start > max || response.status >= 500) {
57 throw new Error(
58 `Waiting for "${href}" failed since it took longer than 4 minutes.\n` +
59 `Received status ${response.status}:\n"${text}"`
60 );
61 }
62
63 await sleep(2000);
64 }
65};
66
67beforeAll(async () => {
68 try {

Callers 1

Calls 3

textMethod · 0.80
sleepFunction · 0.50
logMethod · 0.45

Tested by

no test coverage detected