🔧
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.
1
module.exports = {
2
/** Globs that represent the test entry points. */
3
include: ["assembly/__tests__/**/*.spec.ts"],
4
/** Modules that should be added to the compilation */
5
add: ["assembly/__tests__/**/*.include.ts"],
6
/** Compiler flags for each module. */
7
flags: {
8
/** To output a wat file, uncomment the following line. */
9
// "--textFile": ["output.wat"],
10
/** A runtime must be provided here. */
11
"--runtime": ["full"], // Acceptable values are: full, half, stub (arena), and none
12
},
13
/** Disclude tests that match this regex. */
14
disclude: [/node_modules/],
15
/** Add your required AssemblyScript imports here in this function. */
16
imports(memory, createImports, instantiateSync, binary) {
17
let result; // Imports can reference this
18
const myImports = {
19
// put your web assembly imports here, and return the module
20
};
21
result = instantiateSync(binary, createImports(myImports));
22
// return the entire result object from the loader
23
return result;
24
},
25
// uncomment the following section if you require wasi support
26
/*
27
wasi: {
28
// pass args here
29
args: [],
30
// inherit from env
31
env: process.env,
32
preopens: {
33
// put your preopen's here
34
},
35
// let as-pect finish what it needs to finish
36
returnOnExit: false,
37
},
38
*/
39
/**
40
* To create your own custom reporter, please check out the Core API.
41
*/
42
// reporter: new CustomReporter(),
43
/** Output the binary wasm file: [testname].spec.wasm */
44
outputBinary: false,
45
};
46
Copied!
The instance returned by instantiateSync represents an AssemblyScript module. You can read about how the loader works here.
Last modified 1yr ago
Copy link