Status: work in progress — API-only so far. Layer 2 of Controlium
ecosystem, built on @controlium/utils.
API_AUTWrapper (API-level AUT testing) is the only wrapper that exists today;
Browser_AUTWrapper (browser/UI AUT support) is not started. Test-runner-agnostic by design —
@controlium/cucumber wires this package's lifecycle functions into Cucumber-JS, but nothing
here assumes Cucumber is the only consumer.
- Node.js >= 22
- ESM only.
package.jsonhas"type": "module";exportsdeclares"import"only, no"require". No CommonJS build.
npm install @controlium/frameworkimport { API_AUTWrapper, beforeSuite, afterSuite, beforeTest, afterTest } from '@controlium/framework';| Export | What it does |
|---|---|
API_AUTWrapper |
Manages HTTP targets for API-level testing — either an AUT/s this process itself bootstraps, make API requests against, and later closes (startNewApplication/prepareApplication+startApplication), and/or API endpoints requests sent to and responses received from (registerAPI/prepareAPI). Instances of either kind coexist, named in one shared registry. Suite-wide registry/leak cleanup available with per-endpoint instance methods covering session config (headers, query params, resource-path), issuing requests and reading back recorded responses, and a liveness checks. All safe and without endpoint health assumptions. |
LifecycleHooks |
Runner-agnostic beforeSuite/afterSuite/beforeTest/afterTest static methods test-runner drivers can call from own native hooks. |
SettingsRegistry |
Declarative catalogue of cross-cutting settings (env var → npm config → profile parameter → default) — register() once per setting, resolve() from any call site, so every caller resolves the same setting the same way. lifecycle.ts registers the framework's own settings (Log Level, Log Max Lines, Default Step Timeout) at module load. |
import { API_AUTWrapper } from '@controlium/framework';
import { NestFactory } from '@nestjs/core';
import { AppModule } from '../src/app.module';
let api: API_AUTWrapper<INestApplication>;
Before(async () => {
api = await API_AUTWrapper.startNewApplication({
appName: 'MyAPI',
port: 3000,
bootstrapper: async (port) => {
const app = await NestFactory.create(AppModule);
await app.listen(port);
return app;
},
closeHandler: (app) => app.close(),
getUrlHandler: (app) => app.getUrl(),
});
api.setHeaders({ Authorization: `Bearer ${token}` });
});
When('I GET /users', async () => {
await api.request('GET', '/users');
});
Then('the response status is {int}', (status: number) => {
expect(api.lastResponse.status).toBe(status);
});
After(async () => {
await api.close();
});Package (as per all TeamControlium repos) follows a specific, non-default set of conventions — defensive coding as baseline to ensure safety and handling of poorly behaved AUTs, and framework/wrapper code that exposes primitives rather than baking in policy (no lifecycle method decides timing/retry on the caller's behalf).
npm run build— clean + compile todist/esm, with.d.tsoutputnpm test— unit tests (Vitest)npm run test:coverage— unit tests with coveragenpm run lint— ESLint, with autofix
Apache-2.0.