Registry / testing / configurapi-test-utils

configurapi-test-utils

JSON →
library1.0.5jsnpmunverified

Helper utilities for testing Configurapi handlers. v1.0.5 ships TypeScript types, but the package is very new and may have limited documentation. Offers base test classes and mocks for Configurapi environments. Currently stable with no known breaking changes, but the API may evolve. Differentiator: purpose-built for Configurapi, reducing boilerplate in integration tests.

npm install configurapi-test-utils
INSTALL
IMPORT
SIG · CONFIGURAPI-TEST-U
C
configurapi-test-utils
testingjavascriptv1.0.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18226 runs
build_error
glibc
node 18226 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 });
Debug
Known issues
breakingPackage is ESM-only. CommonJS require() will throw an error.
fix
Use dynamic import() or configure your project to use ESM.
affects: >=1.0.0
gotchaMockResponse.body might not be a string; check type definitions.
fix
Cast body to expected type or use toJSON() if available.
affects: >=1.0.0
gotchaTestHandler.run() expects async handler; wrapping non-async handler may cause issues.
fix
Ensure handler is async or returns a Promise.
affects: >=1.0.0
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Trying to import the package in a CommonJS file without 'type': 'module'.
fix
Add '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.
fix
Use import { MockRequest } from 'configurapi-test-utils'.
Upgrade
Version history
1.0.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
39 hits · last 30 days
node
34
OpenAI (training)
1
Resources
configurapi-test-utils — npm install configurapi-test-utils · libregistry