Setup

Preparing your testing environment

To get started, install the package from NPM or GitHub

npm i as-test --save-dev

You'll also need to install visitor-as

npm i visitor-as --save-dev

Check to make sure it is installed by running

~ npx as-test

as-test is a testing framework for AssemblyScript. (v0.1.10)

Usage: as-test <command> [...flags] [...args] (alias: ast)

Commands:
  run       <my-test.spec.ts>       Run unit tests with selected runtime
  build     <my-test.spec.ts>       Build unit tests and compile
  test      <my-test.spec.ts>       Build and run unit tests with selected runtime

  init                              Initialize an empty testing template
  config     as-test.config.json    Specify the configuration file
  reporter   <tap>                  Specify the test reporter to use
  use        wasmtime               Specify the runtime to use

Flags:
  run        --coverage             Use code coverage
  run        --snapshot             Take a snapshot of the tests
  use        --list                 List supported runtimes
  reporter   --list                 List supported reporters
  <command>  --help                 Print info about command

If your using this, consider dropping a star, it would help a lot!

View the repo:                   https://github.com/JairusSW/as-test
View the docs:                   https://docs.jairus.dev/as-test

The as-test command is aliased as ast

Setup your dev environment by running

ast init .

Which creates the following files

  • ๐Ÿ“‚ assembly

    • ๐Ÿ“‚ __tests__

      • ๐Ÿงพ example.spec.ts

    • ๐Ÿงพ tsconfig.json

  • ๐Ÿ“‚ build

    • โ• .gitignore

  • ๐Ÿ“‚ tests

    • ๐Ÿงพ index.js

  • ๐Ÿงพ as-test.asconfig.json

  • ๐Ÿงพ package.json

Last updated