Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ async function runCommand(
// After loading, the module's cli() call will have updated the registry.
const updated = getRegistry().get(fullName(cmd));
if (updated?.func) {
if (!page) throw new CommandExecutionError(`Command ${fullName(cmd)} requires a browser session but none was provided`);
return updated.func(page, kwargs, debug);
if (!page && updated.browser !== false) {
throw new CommandExecutionError(`Command ${fullName(cmd)} requires a browser session but none was provided`);
}
return updated.func(page as IPage, kwargs, debug);
}
if (updated?.pipeline) return executePipeline(page, updated.pipeline, { args: kwargs, debug });
}
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/public-commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ function isExpectedChineseSiteRestriction(code: number, stderr: string): boolean

function isExpectedApplePodcastsRestriction(code: number, stderr: string): boolean {
if (code === 0) return false;
return /Error \[FETCH_ERROR\]: (Charts API HTTP \d+|Unable to reach Apple Podcasts charts)/.test(stderr);
return /Error \[FETCH_ERROR\]: (Charts API HTTP \d+|Unable to reach Apple Podcasts charts)/.test(stderr)
|| stderr === ''; // timeout killed the process before any output
}

function isExpectedGoogleRestriction(code: number, stderr: string): boolean {
Expand Down
Loading