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.
On the docs under Defining tests, §[Defining the checking logic (
check)](https://htest.dev/docs/define/#check), it says:But the way that the helper functions work is different from most assertion libraries.
The assertion functions I am most familiar with are:
console.assert()in browsersnode:assertlibrary for NodeJSexpect()interfaceAs far as I know, none of these assertion function return any value. They simply perform their checks internally, and throw an
AssertionErrorif 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
AssertionErroron fail and return nothing if they pass.