Skip to content

feat: Assert json content - #76

Open
jakub-bochenski wants to merge 2 commits into
bats-core:mainfrom
jakub-bochenski:patch-2
Open

jakub-bochenski wants to merge 2 commits into
bats-core:mainfrom
jakub-bochenski:patch-2

Conversation

@jakub-bochenski

Copy link
Copy Markdown

No tests added, I don't have time ATM, I made sure it works by using it.

Still maybe it will be useful to somebody

No tests added, I don't have time ATM, I made sure it works by using it.

Still maybe it will be useful to somebody
@Wuodan

Wuodan commented Sep 15, 2026

Copy link
Copy Markdown

This would add jq as dependency.

@jakub-bochenski

Copy link
Copy Markdown
Author

Yes, but only needed if you actually use the assert_json statement, so it's an optional dependency.

I don't think trying to reimplement something similar in pure bash is a good idea.

The alternative is to publish it as a standalone bats library, but then it's so much less discoverable.

@Wuodan

Wuodan commented Sep 15, 2026

Copy link
Copy Markdown

I just wanted to point out that jq is a requirement with your change. And that needs consideration and if added some handling - in the docs would be the bare minimum.

An I agree, trying to replace jq here would be a bad idea.

But it adds test/environment surface - I vaguely remember having issues with variants of jq where some "install tool" GH action replaced the runners normal jq (maybe with a pip version) and things were differently with the changed jq version.

Just my 2 cents for the PR.

I like that you are sharing the code - even if not merged, it may be useful to someone!

@martin-schulze-vireso

Copy link
Copy Markdown
Member

I am fine with this as long as:

  1. we have good diagnostics (clear errors message) and robust behavior (failing tests) when jq is not there
  2. we have tests for this

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.

3 participants