Registry / testing / axiosist

axiosist

JSON →
library1.2.0jsnpmunverified

Convert a Node.js request handler (e.g., Express app) into an Axios adapter for HTTP testing. Version 1.2.0 is the current stable release, built on top of Axios (peer dependency). It offers promise-based testing unlike supertest's callback/stream hybrid, and treats all HTTP status codes as fulfilled to avoid exception handling for 4xx/5xx. Ships TypeScript type definitions. Release cadence is low; last update 2023-12.

npm install axiosist
INSTALL
IMPORT
SIG · AXIOSIST
A
axiosist
testingjavascriptv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import axiosist from 'axiosist'
const axiosist = require('axiosist')
ESM-only; CommonJS require() not supported.
createAdapter
import { createAdapter } from 'axiosist'
const { createAdapter } = require('axiosist')
ESM-only named export.
axiosist (type)
import type axiosist from 'axiosist'
TypeScript type import for module augmentation.

Create an Express app, test it with axiosist GET request, verify status and data.

import express from 'express'; import axiosist from 'axiosist'; const app = express(); app.get('/', (req, res) => res.status(200).send('Hello')); const response = await axiosist(app).get('/'); console.log(response.status); // 200 console.log(response.data); // 'Hello'
Debug
Known issues
breakingRequires axios as peer dependency. Incompatible with axios versions <1.0.0.
fix
Install axios@^1.0.0.
affects: >=1.2.0
breakingESM-only; CommonJS require() will fail.
fix
Use import syntax or dynamic import().
affects: >=1.0.0
gotchaAxiosist treats all HTTP status codes as fulfilled. 4xx/5xx responses do not reject the promise.
fix
Use response.status to check for errors.
affects: >=1.0.0
gotchaThe host header is preserved from the request URL, not defaulted to 127.0.0.1.
fix
Explicitly set host header if needed.
affects: >=1.0.0
deprecatedNode.js >=12.13.0 required; older versions unsupported.
fix
Upgrade Node.js to >=12.13.0.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module
axiosist is ESM-only.
fix
Use import syntax or dynamic import().
Cannot find module 'axios'
axios is a peer dependency not installed.
fix
npm install axios
response.data is undefined
Wrong status code handling; axiosist treats all codes as fulfilled.
fix
Check response.status and response.data; no catch for 4xx/5xx.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies
axiosrequiredpeer dependency; adapter is built for Axios
Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
axiosist — npm install axiosist · libregistry