Chai plugin providing asynchronous matchers for Fetch API responses, including .responseText() and .status(). Current stable version is 0.3.1 (last updated 2019). Release cadence is low/single-version. Key differentiator: simplifies testing fetch responses with clean chai syntax, supports promises and async/await, and includes TypeScript typings. Alternative to raw promise chaining or custom assertions.
npm install chai-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic setup and usage of chai-fetch matchers .responseText() and .status() with async/await.
Always return or await the expect(...).to.have.responseText(...) call.
Consider alternative libraries like chai-fetch-http or native chai-as-promised.
Call chai.use(chaiFetch) after importing.
Ensure chai is imported: const chai = require('chai'); then chai.use(chaiFetch);Ensure the tested value is a Promise<Response> or a Response directly.