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())]