chai-cheerio is an extension to the chai assertion library that
provides a set of Cheerio-specific assertions. It was forked from
and modified to work with
instead of jQuery.
In the following documentation, all links to
chai-jquery point directly to the version
chai-cheerio is based on.
As this is a port of
chai-jquery, I recommend that you check out the original
for usage information.
Here, I will highlight the differences in assertion capabilities between
chai-cheeriodoes not implement
hiddenassertions. This is due to known limitations in the upstream
cheerioproject. Feel free to suggest workarounds, or even better, submit PRs.
chai-cheeriocannot identify an element by the original selector that was used to find it, which means that for
.existassertion errors, it will simply output
not to exist, unlike
chai-jquery, which outputs
not to existto identify the element. This is because
chai-jquerymakes use of jQuery’s deprecated
cheeriodoes not have this property. Again, feel free to suggest workarounds or submit PRs.
chai-cheeriodoes not implement the
To run the test suite, run
npm install (requires
Node.js to be installed on your system), and then: