Skip to content

docs: Add example for using external assertion library #111

@Zearin

Description

@Zearin

On the docs under Defining tests, §[Defining the checking logic (check)](https://htest.dev/docs/define/#check), it says:

You can use any existing assertion library, but hTest provides a few helpers [ … ]

But the way that the helper functions work is different from most assertion libraries.

The assertion functions I am most familiar with are:

As far as I know, none of these assertion function return any value. They simply perform their checks internally, and throw an AssertionError if a criterion doesn’t pass.

This is one of the things my brain is struggling with as I’m trying to learn writing hTest tests after thinking in the typical Mocha/NodeJS-native TestRunner style.

Adding an example using an external assertion library to the docs would help!

BONUS: Maybe a new docs page like “Moving from X to hTest” would be cool. Besides the specific examples of how to do specific things, but provide a guide for people to rewire their mental models for testing at the conceptual level, highlighting key differences. For example, above I am requesting an example for how to use an external assertion library in hTest. But the conceptual guide would explain the why, which in this case is that hTest checks return booleans, while typical assertions simply throw AssertionError on fail and return nothing if they pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions