rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
64 lines • 2.49 kB
TypeScript
import { Emscripten } from "../../external/emscripten.js";
import { IEmscriptenWrapper } from "./i-emscripten-wrapper.js";
import { IDebugBindings } from "./i-debug-bindings.js";
import type { IJsUtilBindings } from "../i-js-util-bindings.js";
import { ReferenceCountedStrategy } from "./reference-counted-strategy.js";
/**
* @public
* Options for {@link SanitizedEmscriptenTestModule}.
*/
export interface ISanitizedTestModuleOptions {
shared: boolean;
/**
* Errors which are always ignored.
*/
disabledErrors?: IErrorExclusions;
/**
* Errors which are ignored during std::exit.
*/
disabledShutdownErrors?: IErrorExclusions;
/**
* 64 kb per page.
*/
initialMemoryPages: number;
/**
* 64 kb per page
*/
maxMemoryPages: number;
quitThrowsWith: object;
}
/**
* @public
* Errors which should be ignored in tests.
*/
export interface IErrorExclusions {
readonly startsWith?: readonly string[];
readonly exactMatch?: readonly string[];
}
/**
* @public
* Provides "sensible" options for a {@link SanitizedEmscriptenTestModule}.
*/
export declare function getEmscriptenTestModuleOptions(overrides?: Partial<ISanitizedTestModuleOptions>): ISanitizedTestModuleOptions;
/**
* @public
* A wrapper for running emscripten modules built with ASAN. To see the full report, you must call `endEmscriptenProgram`.
* @typeParam TEmscriptenBindings - The generated WASM bindings.
* @typeParam TWrapperExtensions - Extensions to the test wrapper itself, i.e. overwrite the module with test specific logic.
*/
export declare class SanitizedEmscriptenTestModule<TEmscriptenBindings extends IJsUtilBindings, TWrapperExtensions extends object> {
private readonly testModule;
private readonly options;
private readonly extension?;
constructor(testModule: Emscripten.EmscriptenModuleFactory<TEmscriptenBindings>, options: ISanitizedTestModuleOptions, extension?: TWrapperExtensions | undefined);
initialize(): Promise<void>;
get wrapper(): IEmscriptenWrapper<TEmscriptenBindings & TWrapperExtensions & IDebugBindings, ReferenceCountedStrategy>;
/**
* NB you MUST set the flag `-s EXIT_RUNTIME=1` for this to work.
*/
endEmscriptenProgram(errorLoggingAllowed?: boolean): void;
runWithDisabledErrors(exclusions: IErrorExclusions, callback: () => void): void;
private _wrapper;
private readonly state;
}
//# sourceMappingURL=sanitized-emscripten-test-module.d.ts.map