Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
TestHandler
✓ import { TestHandler } from 'configurapi-test-utils'
✗ import TestHandler from 'configurapi-test-utils'
This is a named export, not a default export.
MockRequest
✓ import { MockRequest } from 'configurapi-test-utils'
✗ const { MockRequest } = require('configurapi-test-utils')
Package is ESM-only; require() will fail unless using dynamic import.
MockResponse
✓ import type { MockResponse } from 'configurapi-test-utils'
✗ import { MockResponse } from 'configurapi-test-utils'
MockResponse is a type, so use 'import type' when only using as a type.
Demonstrates using MockRequest and MockResponse to test a Configurapi handler in TypeScript.
import { TestHandler, MockRequest, MockResponse } from 'configurapi-test-utils';
import { handler } from './my-handler';
const req = new MockRequest({
method: 'GET',
path: '/items',
query: { limit: '10' },
headers: { 'content-type': 'application/json' },
body: null
});
const res = new MockResponse();
TestHandler.run(handler, req, res).then(() => {
console.log(res.statusCode); // 200
console.log(res.body); // response body
});
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Trying to import the package in a CommonJS file without 'type': 'module'.
fixAdd 'type': 'module' to your package.json or use .mjs extension for the importing file.
TypeError: MockRequest is not a constructor
Using default import instead of named import.
fixUse import { MockRequest } from 'configurapi-test-utils'. Audit
Dependencies
No dependency data recorded yet.