assemblyscript-unittest-framework is a comprehensive testing solution for AssemblyScript and WebAssembly projects. It provides a robust suite of features including function mocking, code coverage statistics, and a rich expectation API. The current stable version is 2.1.0, with an active release cadence reflecting continuous development and feature additions, often multiple releases within a few months. This framework distinguishes itself by enabling developers to write tests directly in AssemblyScript and execute them within a Node.js environment, bridging the gap between host and WASM execution. Key differentiators include its dedicated support for the AssemblyScript ecosystem, offering deep integration for compiling and running WASM tests, and providing advanced capabilities like isolated test execution (configurable since v2.0.0) and detailed reporting.
npm install assemblyscript-unittest-frameworkVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up and run AssemblyScript unit tests using the framework. It includes a `package.json` for dependencies and scripts, a sample AssemblyScript test file (`index.spec.ts`) using the `assemblyscript-unittest` APIs, and a TypeScript runner script (`run.ts`) that initializes and executes the `TestRunner` with `ConsoleReporter`.
If you relied on isolated execution, explicitly set `isolated: true` in your `TestRunner` configuration: `new TestRunner({ isolated: true, ... });`Remove any calls to `endTest` from your AssemblyScript test files. The framework will manage test lifecycle automatically.
Review the current CLI options or programmatic `TestRunner` configuration for targeting specific tests, typically through file patterns or test filtering options in the configuration object.
Always ensure your `node_modules` are clean and install fresh dependencies. If you were on affected versions, run `npm audit fix` or manually update `chalk` (if it appears as a direct dependency) and `assemblyscript-unittest-framework` to the latest version.
Ensure your AssemblyScript test files use `import { test, expect } from "assemblyscript-unittest";` for the core testing APIs.Run `npm install assemblyscript-unittest-framework` (or `yarn add`) and ensure `typescript` and `ts-node` are correctly configured if using TypeScript.
Verify that the `files` array in your `TestRunner` configuration correctly points to your AssemblyScript test files (e.g., `files: ['./assembly/**/*.spec.ts']`) and that the paths are resolveable from your runner script's context.
Ensure `TestRunner` is correctly imported as a named export (`import { TestRunner } from 'assemblyscript-unittest-framework';`) and that `new TestRunner(...)` is called with valid arguments before attempting to call its methods.Check your AssemblyScript `asc` compiler options within `TestRunner` config. Ensure `warpo` is correctly installed as a peer dependency. Also, verify that your AssemblyScript code has all necessary `import` statements if relying on external WASM functions.