Skip to content

fix/ preserve JSON output for empty search results - #394

Open
ammarkaskar wants to merge 3 commits into
firecrawl:mainfrom
ammarkaskar:fix/empty-search-json
Open

ammarkaskar wants to merge 3 commits into
firecrawl:mainfrom
ammarkaskar:fix/empty-search-json

Conversation

@ammarkaskar

@ammarkaskar ammarkaskar commented Nov 26, 2026 •

Copy link
Copy Markdown

Problem

When a search returns no results, the CLI prints No results found. even when --json or --pretty is specified. This breaks JSON parsing in scripts and prevents empty results from being written to the requested output file.

Fix

Only return the plain text message when neither JSON nor pretty output is requested. The default human readable behavior remains unchanged.

Testing

Added regression tests for empty search results with both --json and --pretty.

All seven CI checks passed on my fork, including formatting, type checking, build, unit tests, binary tests and npm package smoke tests across Linux, macOS and Windows.


Summary by cubic

Fixes the search command so empty results return valid JSON when --json or --pretty is set, instead of printing "No results found." and breaking JSON parsing in scripts.

  • The plain text message now only appears in default human-readable output.
  • Added regression tests for empty results with both --json and --pretty.

Written for commit 3b75390. Summary will update on new commits.

View guided diff

Added a test case to handle empty search results, ensuring valid JSON output for empty results.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Shadow auto-approve: would not auto-approve because issues were found.
Reply to a comment to ask cubic a question or push back. It learns from your replies.
Click Fix with cubic on a comment, or reply @cubic-dev-ai fix this, and cubic writes the fix.

View guided diff | Re-trigger cubic

Comment thread src/__tests__/commands/search.test.ts Resolved
Refactor test for empty search results to improve clarity and maintainability.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Shadow auto-approve: would auto-approve. Focused fix: empty search results now produce valid JSON under --json/--pretty, while default text output is unchanged; regression tests cover both modes.

View guided diff | Re-trigger cubic

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant