dbt-labs / dbt-jsonschema

Apache License 2.0
109 stars 40 forks source link

Update negative unit tests (the ones that check invalid schemas fail) to check the right amount of failure is happening #118

Open joellabes opened 4 months ago

joellabes commented 4 months ago

Follow on from the thread at https://github.com/dbt-labs/dbt-jsonschema/pull/117#discussion_r1465257368

Basically, our current invalid directory of unit tests is insufficiently smart - it will fail if a single schema item is invalid, so if we accidentally add something that is valid while believing it to be invalid, we won't be warned.

As far as I can tell, the best thing we can do to properly validate is to compare the outputs of the --all-errors flag in ajv-cli against a source-controlled list of expected errors which we'll need to manually update as we add new failing tests.

Open to alternative approaches