Skip to main content

Function: instrumentDOProject()

instrumentDOProject(configOrSourceModule): InstrumentedDOProject

Defined in: packages/testing/src/instrument-do-project.ts:99

Instruments a DO project for testing by wrapping DO classes with lumenizeRpcDO and creating a worker that routes RPC requests.

This eliminates the need for boilerplate test-harness.ts files - the function handles all the instrumentation automatically.

Auto-detection (simple projects with 1 DO):

// test/test-worker-and-dos.ts
import * as sourceModule from '../src';
import { instrumentDOProject } from '@lumenize/testing';

export default instrumentDOProject(sourceModule);

Explicit configuration (multiple DOs or complex projects):

// test/test-worker-and-dos.ts
import * as sourceModule from '../src';
import { instrumentDOProject } from '@lumenize/testing';

const { worker, dos } = instrumentDOProject({
sourceModule,
doClassNames: ['MyDO', 'AnotherDO']
});

export const { MyDO, AnotherDO } = dos;
export default worker;

Parameters

configOrSourceModule

any

Returns

InstrumentedDOProject