Skip to content

fix: handle non-object package.json and scripts in guess_test_command - #274

Merged
connabyss merged 1 commit into
connabyss:mainfrom
Mugunth007:fix/package-json-non-dict
Nov 28, 2026
Merged

connabyss merged 1 commit into
connabyss:mainfrom
Mugunth007:fix/package-json-non-dict

Conversation

@Mugunth007

Copy link
Copy Markdown
Contributor

Closes #273

Summary

  • Guard against non-dict package.json roots, non-dict scripts, and non-string scripts.test values in guess_test_command() so Bite falls through to subsequent project detectors (Cargo.toml, go.mod, etc.) instead of crashing with AttributeError or TypeError.
  • Add unit tests in tests/test_pytest_guess.py covering malformed/unexpected package.json shapes, fallback to cargo test, and the npm, Cargo, and Go branches.

Verification

  • python -m pytest tests/test_pytest_guess.py -q -> 11 passed

@github-actions

Copy link
Copy Markdown
Contributor

Hi @Mugunth007, thanks for your first pull request to Bite! 🎉 CI runs the tests on Linux, Windows and macOS, and if anything goes red, the log says why. I'll review it soon.

The contributing guide has the short checklist, and Discussions is open for any questions.

This hello is automatic. A real reply from me is on its way.

@connabyss
connabyss merged commit f772c10 into connabyss:main Nov 28, 2026
19 checks passed

Copy link
Copy Markdown
Owner

Thanks for the quick fix, works great!


Generated by Claude Code

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.

Bite crashes when package.json is valid JSON but not the usual shape

2 participants