To create a TestContext simply import it and instantiate it.
import { TestContext, EmptyReporter } from"@as-pect/core";import { instantiateBuffer } from"assemblyscript/lib/loader";classReporterextendsEmptyReporter {constructor() { super(); }// implement the reporter functions here}constbinary=awaitfetch("./path/to/test/binary.wasm");constbuffer=awaitbinary.arrayBuffer();constwasmBinary=newUint8Array(buffer);constctx=newTestContext({ fileName:"test.spec.ts",// the name of your module// groupRegex: /./, // filter the groups// testRegex: /./, // filter the tests// performanceConfiguration: {}, // deprecated// nortrace: true, // disable rtrace monitoring// stdout: null, // something that can write(input: string): void// stderr: null, // something that can write(input: string): void binary: wasmBinary,// the binary for test name collection});constimports=ctx.createImports({// put any function imports here});// instantiate the moduleconstwasm=instantiateBuffer(wasmBinary, imports);// run the testsctx.run(wasm);// inspect the testGroups for errors and exit 1 if necessaryconstgroups=ctx.testGroups;// check if the tests passedconstpass=ctx.pass;