Skip to content

Commit

Permalink
chore: fix url regression
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Mar 3, 2024
1 parent dc2563f commit 5521f4d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/cli/src/ci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
5 changes: 2 additions & 3 deletions packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/discovery/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const resolveReportableRoutes: () => Promise<NormalisedRoute[]> = async (

const urls = new Set<string>([])
// the urls function may be null
if (resolvedConfig.urls) {
if (resolvedConfig.urls?.length) {
let urlsToAdd
if (typeof resolvedConfig.urls === 'function')
urlsToAdd = [...(await resolvedConfig.urls())]
Expand Down

0 comments on commit 5521f4d

Please sign in to comment.