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.
UsageAs 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
known limitations in the upstream
cheerio project. Feel free to suggest workarounds, or even better, submit PRs.
chai-cheeriocannot identify an element by the original selector that was used
.exist assertion errors, it will simply output
to exist or
not to exist, unlike
chai-jquery, which outputs
not to exist to identify the element.
This is because
chai-jquery makes use of jQuery's deprecated
cheerio does not have this property. Again, feel free to
suggest workarounds or submit PRs.
chai-cheeriodoes not implement the
ContributingTo run the test suite, run
npm install (requires
Node.js to be installed on your system), and then: