From 5521f4d0cd50c8378e9090f2a2386798852f0c98 Mon Sep 17 00:00:00 2001 From: harlan Date: Sun, 3 Mar 2024 17:55:21 +1100 Subject: [PATCH] chore: fix url regression --- packages/cli/src/ci.ts | 4 ++-- packages/cli/src/cli.ts | 5 ++--- packages/core/src/discovery/routes.ts | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/ci.ts b/packages/cli/src/ci.ts index 4c755a46..b510cd25 100644 --- a/packages/cli/src/ci.ts +++ b/packages/cli/src/ci.ts @@ -59,8 +59,8 @@ async function run() { hasBudget = false await setCiContext() - await start() - if (worker.monitor().status === 'completed') { + const { routes } = await start() + if (!routes.length) { logger.error('Failed to queue routes for scanning. Please check the logs with debug enabled.') process.exit(1) } diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index 5c9df920..0399701c 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -30,10 +30,9 @@ async function run() { const { server, app } = await createServer() await unlighthouse.setServerContext({ url: server.url, server: server.server, app }) - await unlighthouse.start() - + const { routes } = await unlighthouse.start() const logger = useLogger() - if (unlighthouse.worker.monitor().status === 'completed') { + if (!routes.length) { logger.error('Failed to queue routes for scanning. Please check the logs with debug enabled.') process.exit(1) } diff --git a/packages/core/src/discovery/routes.ts b/packages/core/src/discovery/routes.ts index 93af3191..cf6baa78 100644 --- a/packages/core/src/discovery/routes.ts +++ b/packages/core/src/discovery/routes.ts @@ -23,7 +23,7 @@ export const resolveReportableRoutes: () => Promise = async ( const urls = new Set([]) // the urls function may be null - if (resolvedConfig.urls) { + if (resolvedConfig.urls?.length) { let urlsToAdd if (typeof resolvedConfig.urls === 'function') urlsToAdd = [...(await resolvedConfig.urls())]