🔧
CLI Configuration
Configure the CLI
Currently as-pect will compile each file that matches the globs in the include property of your configuration. The default include is "assembly/__tests__/**/*.spec.ts". It must compile each file, and run each binary separately inside it's own TestContext. This is a limitation of AssemblyScript, not of as-pect. A typical configuration is provided when you use asp --init.
module.exports = {
/** Globs that represent the test entry points. */
include: ["assembly/__tests__/**/*.spec.ts"],
/** Modules that should be added to the compilation */
add: ["assembly/__tests__/**/*.include.ts"],
/** Compiler flags for each module. */
flags: {
/** To output a wat file, uncomment the following line. */
// "--textFile": ["output.wat"],
/** A runtime must be provided here. */
"--runtime": ["full"], // Acceptable values are: full, half, stub (arena), and none
},
/** Disclude tests that match this regex. */
disclude: [/node_modules/],
/** Add your required AssemblyScript imports here in this function. */
imports(memory, createImports, instantiateSync, binary) {
let result; // Imports can reference this
const myImports = {
// put your web assembly imports here, and return the module
};
result = instantiateSync(binary, createImports(myImports));
// return the entire result object from the loader
return result;
},
// uncomment the following section if you require wasi support
/*
wasi: {
// pass args here
args: [],
// inherit from env
env: process.env,
preopens: {
// put your preopen's here
},
// let as-pect finish what it needs to finish
returnOnExit: false,
},
*/
/**
* To create your own custom reporter, please check out the Core API.
*/
// reporter: new CustomReporter(),
/** Output the binary wasm file: [testname].spec.wasm */
outputBinary: false,
};
The instance returned by instantiateSync represents an AssemblyScript module. You can read about how the loader works here.
Copy link