{"id":43007805,"url":"https://github.com/themattspiral/vitest-pool-assemblyscript","last_synced_at":"2026-02-23T18:16:58.508Z","repository":{"id":319528111,"uuid":"1078939488","full_name":"themattspiral/vitest-pool-assemblyscript","owner":"themattspiral","description":"AssemblyScript unit testing in Vitest - Simple, fast, familiar, AS-native","archived":false,"fork":false,"pushed_at":"2026-02-19T22:36:12.000Z","size":3836,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-20T02:50:57.746Z","etag":null,"topics":["assemblyscript","assemblyscript-language","test-runner","unit-test","unit-testing","vitest","vitest-plugin","vitest-pool","wasm","webassembly","webassembly-testing"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/themattspiral.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-18T18:38:04.000Z","updated_at":"2026-02-12T17:36:55.000Z","dependencies_parsed_at":"2025-10-19T11:10:14.370Z","dependency_job_id":"d922bc49-6281-4058-a69d-fb274553bade","html_url":"https://github.com/themattspiral/vitest-pool-assemblyscript","commit_stats":null,"previous_names":["themattspiral/vitest-pool-assemblyscript"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/themattspiral/vitest-pool-assemblyscript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themattspiral%2Fvitest-pool-assemblyscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themattspiral%2Fvitest-pool-assemblyscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themattspiral%2Fvitest-pool-assemblyscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themattspiral%2Fvitest-pool-assemblyscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/themattspiral","download_url":"https://codeload.github.com/themattspiral/vitest-pool-assemblyscript/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themattspiral%2Fvitest-pool-assemblyscript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29750189,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T07:44:07.782Z","status":"ssl_error","status_checked_at":"2026-02-23T07:44:07.432Z","response_time":90,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assemblyscript","assemblyscript-language","test-runner","unit-test","unit-testing","vitest","vitest-plugin","vitest-pool","wasm","webassembly","webassembly-testing"],"created_at":"2026-01-31T05:03:56.215Z","updated_at":"2026-02-23T18:16:58.496Z","avatar_url":"https://github.com/themattspiral.png","language":"TypeScript","readme":"# vitest-pool-assemblyscript\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/images/as-icon.svg\" height=\"50\" align=\"middle\"\u003e\n  \u0026nbsp;\u0026nbsp;\u0026#10133;\u0026nbsp;\u0026nbsp;\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs/images/vitest-light.svg\"\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"docs/images/vitest-dark.svg\"\u003e\n    \u003cimg alt=\"Vitest logo\" src=\"docs/images/vitest-dark.svg\" height=\"30\" align=\"middle\"\u003e\n  \u003c/picture\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  AssemblyScript unit testing in Vitest: Simple, fast, familiar, AS-native.\n  \u003cbr/\u003e\n  \u003cbr/\u003e\n  \u003ca href=\"LICENSE\"\u003e\u003cimg alt=\"MIT License\" src=\"https://img.shields.io/badge/license-MIT-blue.svg?style=flat\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/themattspiral/vitest-pool-assemblyscript/actions/workflows/release.yml\"\u003e\u003cimg alt=\"Release Pipeline\" src=\"https://github.com/themattspiral/vitest-pool-assemblyscript/actions/workflows/release.yml/badge.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/vitest-pool-assemblyscript\"\u003e\u003cimg alt=\"npm package version\" src=\"https://img.shields.io/npm/v/vitest-pool-assemblyscript.svg?style=flat\u0026logo=npm\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n\u003cbr/\u003e\n\n\u003cp align=\"center\"\u003e\n  This \u003ca href=\"https://vitest.dev/guide/advanced/pool.html\"\u003ecustom pool\u003c/a\u003e plugs into \u003ca href=\"https://vitest.dev\"\u003eVitest\u003c/a\u003e, giving it the ability to compile AssemblyScript, run isolated WASM tests, and report results with Vitest's reporters. It coexists with your existing JavaScript/TypeScript tests and coverage reporting, and is designed for easy incremental adoption.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  Check it out:\n  \u003cbr/\u003e\n  \u003ca href=\"#status\"\u003eStatus\u003c/a\u003e | \n  \u003ca href=\"#quick-start\"\u003eQuick Start\u003c/a\u003e | \n  \u003ca href=\"#features\"\u003eFeatures\u003c/a\u003e |\n  \u003ca href=\"#frequently-asked-questions\"\u003eFrequently Asked Questions\u003c/a\u003e\n  \u003cbr/\u003e\n  \u003ca href=\"#compatibility\"\u003eCompatibility\u003c/a\u003e | \n  \u003ca href=\"#performance\"\u003ePerformance\u003c/a\u003e | \n  \u003ca href=\"#prior-work\"\u003ePrior Work\u003c/a\u003e | \n  \u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  Dig in:\n  \u003cbr/\u003e\n  \u003ca href=\"#writing-tests\"\u003eWriting Tests\u003c/a\u003e |\n  \u003ca href=\"docs/matchers-api.md\"\u003eMatchers API\u003c/a\u003e |\n  \u003ca href=\"docs/configuration-guide.md\"\u003eConfiguration Guide\u003c/a\u003e |\n  \u003ca href=\"docs/providing-wasm-imports.md\"\u003eProviding WASM Imports\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  Dig deeper:\n  \u003cbr/\u003e\n  \u003ca href=\"docs/pool-architecture.md\"\u003ePool Architecture\u003c/a\u003e |\n  \u003ca href=\"docs/coverage-architecture.md\"\u003eCoverage Architecture\u003c/a\u003e |\n  \u003ca href=\"docs/developer-guide.md\"\u003eDeveloper Guide\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n\u003cbr/\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/images/example-small.gif\" alt=\"vitest-pool-assemblyscript quick demo\"\u003e\n\u003c/p\u003e\n\n## Status\n\nThis project is relatively new to the scene, but is stable and is being improved every day. Please give it a try!\n\nAll [listed features](#features) are working and assumed to be bug-free ([please report any](https://github.com/themattspiral/vitest-pool-assemblyscript/issues/new)).\n\n| Item | Status |\n|---|---|\n| [`describe()` and `test()` APIs](#writing-tests) | - stable\u003cbr/\u003e- no breaking changes expected |\n| [`expect()` API](docs/matchers-api.md) | - stable\u003cbr/\u003e- no breaking changes expected\u003cbr/\u003e- more matchers coming soon |\n| Code Coverage / Instrumentation | - function coverage stable [across platforms](#compatibility)\u003cbr/\u003e- branch \u0026 line coverage coming soon |\n| Hybrid Coverage Provider | - stable\u003cbr/\u003e- v8 JS delegation, side-by-side JS coverage\u003cbr/\u003e- istanbul JS delegation coming soon\n\nSee Also:\n- [Current Limitations \u0026 Roadmap](#current-limitations--roadmap)\n- [Frequently Asked Questions](#frequently-asked-questions)\n- [Report a Bug / Request a Feature](https://github.com/themattspiral/vitest-pool-assemblyscript/issues/new)\n\n---\n\n## Quick Start\n\n### 1. Install\n\n```bash\nnpm install -D vitest vitest-pool-assemblyscript assemblyscript\n```\n\n### 2. Configure Vitest\n\nCreate or update `vitest.config.ts`. See the [Configuration Guide](docs/configuration-guide.md) for all supported vitest options, pool options, coverage configuration, and multi-project setups.\n\n**vitest 4.x:**\n```typescript\nimport { defineConfig } from 'vitest/config';\nimport { createAssemblyScriptPool } from 'vitest-pool-assemblyscript/config';\n\nexport default defineConfig({\n  test: {\n    include: ['test/assembly/**/*.as.test.ts'],\n    pool: createAssemblyScriptPool(),\n  },\n  coverage: {\n    provider: 'custom',\n    customProviderModule: 'vitest-pool-assemblyscript/coverage',\n    assemblyScriptInclude: ['assembly/**/*.ts'],\n    enabled: true,\n  },\n});\n```\n\n**vitest 3.x:**\n```typescript\nimport { defineAssemblyScriptConfig } from 'vitest-pool-assemblyscript/v3/config';\n\nexport default defineAssemblyScriptConfig({\n  test: {\n    include: ['test/assembly/**/*.as.test.ts'],\n    pool: 'vitest-pool-assemblyscript/v3',\n  },\n  // coverage configuration mirrors v4\n});\n```\n\n### 3. Write a Test\n\nCreate a test file (e.g. `test/assembly/example-file.as.test.ts`):\n\n```typescript\nimport { test, describe, expect } from \"vitest-pool-assemblyscript/assembly\";\n\ntest(\"basic math\", () =\u003e {\n  expect(2 + 2).toBe(4);\n});\n\ndescribe(\"an example suite\", () =\u003e {\n  test(\"string equality\", () =\u003e {\n    expect(\"hello\").toBe(\"hello\");\n    expect(\"hello\").not.toBe(\"world\");\n  });\n});\n```\n\n### 4. Run\n\n```bash\nnpx vitest run\n```\n\n---\n\n## Features\n\n### Vitest Integration\n- Use familiar `vitest` commands, CLI spec and test filtering, watch mode\n- Works with Vitest UI, reporters, and coverage tools\n- Project (workspace) config allows coexisting AssemblyScript pools and JavaScript pools\n- Hybrid Coverage Provider unifies test reports from multiple pools (delegating to v8 for JS/TS coverage)\n- Coverage reporting using any vitest reporter (`html`, `lcov`, `json`, etc)\n- Dual vitest 3.x / 4.x support\n\n### Per-Test WASM Isolation\n- Each AssemblyScript test file is compiled to a WASM binary once\n- Each test case runs in a fresh WASM instance (reusing the compiled binary)\n- One crashing test doesn't kill the rest within the same suite\n- `toThrowError()` matcher can be used to catch and expect specific errors (which trap and abort)\n\n### Familiar Developer Experience\n- Suite and test definition using `describe()` and `test()` in AssemblyScript\n- Inline test option configuration for common vitest options: `timeout`, `retry`, `skip`, `only`, `fails`\n- Assertion matching API based on vitest/jest `expect()` API\n  - `.not`, `toBe`, `toBeCloseTo`, `toEqual` (with caveats*), `toStrictEqual`, `toBeGreaterThan`, `toBeGreaterThanOrEqual`, `toBeLessThan`, `toBeLessThanOrEqual`, `toHaveLength`, `toThrowError`, `toBeTruthy`, `toBeFalsy`, `toBeNull`, `toBeNullable`, `toBeNaN`\n  - See [Matchers API](docs/matchers-api.md) for details and differences from JavaScript\n- Highlighted diffs for assertion and runtime failures, which point to source code\n- Source-mapped WASM error stack traces (accurate AssemblyScript source `function file:line:column`)\n- AssemblyScript console output captured and provided to vitest for display\n- AssemblyScript compiler errors output plainly to the console for debugging\n- AssemblyScript source code coverage based on WASM execution, including uncovered source\n- No AssemblyScript boilerplate patterns for: `run()`, `endTest()`, `fs.readFile`, `WebAssembly.Instance`, etc\n\n### Performance \u0026 Customization\n- Parallel execution thread pools\n- In-memory binaries and source maps for minimal file I/O\n- Lightweight coverage instrumentation using separate WASM memory (no intermediate JS boundary crossing, no user memory conflicts)\n- Coverage for inlined (`@inline`) code\n- Enforced hard timeouts for long-running WASM via thread termination, with intelligent resume\n- Configurable AssemblyScript compiler options\n- Configurable test memory size\n- User-provided WASM imports with access to test memory\n\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cfigure\u003e\n        \u003cimg src=\"docs/images/demo-compiler-error.png\" alt=\"AS Compiler Error Output\" width=\"200\" /\u003e\u003cbr/\u003e\n        \u003cfigcaption\u003eAS compiler error\u003c/figcaption\u003e\n      \u003c/figure\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cfigure\u003e\n        \u003cimg src=\"docs/images/demo-runtime-errors.png\" alt=\"WASM Runtime Error Output\" width=\"200\" /\u003e\u003cbr/\u003e\n        \u003cfigcaption\u003eSource-mapped, highlighted runtime errors\u003c/figcaption\u003e\n      \u003c/figure\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cfigure\u003e\n        \u003cimg src=\"docs/images/demo-diffs-array.png\" alt=\"Assertion Error Diff Output\" width=\"200\" /\u003e\u003cbr/\u003e\n        \u003cfigcaption\u003eAssertion diff output\u003c/figcaption\u003e\n      \u003c/figure\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cfigure\u003e\n        \u003cimg src=\"docs/images/demo-timeout-and-fails.png\" alt=\"Timeout and Fails Outputs\" width=\"200\" /\u003e\u003cbr/\u003e\n        \u003cfigcaption\u003eTimeout and fails outputs\u003c/figcaption\u003e\n      \u003c/figure\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cfigure\u003e\n        \u003cimg src=\"docs/images/demo-coverage.png\" alt=\"Coverage Summary Output\" width=\"200\" /\u003e\u003cbr/\u003e\n        \u003cfigcaption\u003eAS and JS coverage summary\u003c/figcaption\u003e\n      \u003c/figure\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cfigure\u003e\n        \u003cimg src=\"docs/images/demo-coverage-html.png\" alt=\"Coverage HTML Report\" width=\"200\" /\u003e\u003cbr/\u003e\n        \u003cfigcaption\u003eAS coverage HTML report\u003c/figcaption\u003e\n      \u003c/figure\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n---\n\n## Frequently Asked Questions\n\n**Q: How does this work?**\n\u003cbr/\u003e\n**A:** Vitest has a [custom pool API](https://vitest.dev/guide/advanced/pool.html) that lets you define the execution environment for the tests it runs (internally, vitest uses its own pools to run JavaScript and TypeScript tests). This custom pool uses the [AssemblyScript compiler](https://www.assemblyscript.org/compiler.html) to compile each test file to WASM, instruments the WASM binary for code coverage, then runs each test in an isolated WASM instance and reports results back to vitest through its standard RPC reporting mechanism.\n\nMore detailed information can be found in [Pool Architecture](docs/pool-architecture.md) and [Coverage Architecture](docs/coverage-architecture.md)\n\n**Q: So it is really using vitest?**\n\u003cbr/\u003e\n**A:** Yes! It's a real vitest pool, not a clone of vitest - it hooks directly into the framework, receiving tests to run from vitest and reporting results back. The pool implements its own compilation, test execution, and [matchers in AS](docs/matchers-api.md), designed to mirror the [vitest expect() API](https://vitest.dev/api/expect.html). We don't use vite build integration, but that's the tradeoff of a custom pool - you can bring any execution environment to vitest.\n\nThe overall goal is tight vitest experience integration - most CLI commands, reporters, UI, and project configurations should work as you'd expect, and test runner behavior should match vitest's JS pool runner for features we've implemented (retries, timeouts, skip, only, fails, etc.). Some features aren't implemented yet due to effort and prioritization, and others necessarily differ given AssemblyScript's static typing and execution model. See the [configuration guide](docs/configuration-guide.md) and [limitations / roadmap](#current-limitations--roadmap) for specifics.\n\n**Q: Will this work on my machine?**\n\u003cbr/\u003e\n**A:** Probably! WASM coverage instrumentation requires native binaries, and we ship [prebuilt binaries for most common platforms](#compatibility). If your platform isn't listed, the npm package installation will fallback to trying to build the native code using a local C++ toolchain.\n\n**Q: Do you support older versions of AssemblyScript?**\n\u003cbr/\u003e\n**A:** It's tested against 0.28.9 currently, and that's the version I have any real experience with. Older versions might work but aren't actively tested. If you're stuck on an older version and run into issues, you're welcome to [open an issue](https://github.com/themattspiral/vitest-pool-assemblyscript/issues/new).\n\n**Q: Is this an official vitest project?**\n\u003cbr/\u003e\n**A:** No, this is a third-party community project. It's not affiliated with or endorsed by the vitest team, though we're grateful for their extensible architecture that makes projects like this possible, and the [other open-source projects](#prior-work) that provide vital functionality and reference architecture.\n\n**Q: Are you a company? A bot?**\n\u003cbr/\u003e\n**A:** Just [a person](https://github.com/themattspiral)! This started as a hobby project to improve my own AssemblyScript testing workflow and to learn something about deep WASM internals, and it's grown from there. I used Claude Code for initial scaffolding and to help dig into the native instrumentation side, but everything goes through me, and my intention is to contribute something useful and high-quality to the community. Feedback and contributions are welcome.\n\n---\n\n## Compatibility\n\n| Dependency | Supported Versions |\n|---|---|\n| Node.js | (20*), 22, 24+ |\n| Vitest | 3.2.x, 4.x.x |\n| AssemblyScript | 0.28.9+ ([more?](#frequently-asked-questions)) |\n\n\u003eℹ️ ***Node 20 Support:** If you don't need code coverage, Node 20 should continue to work for test execution.\n\u003e\n\u003eWASM coverage instrumentation is implemented using [WebAssembly multi-memory](https://github.com/WebAssembly/multi-memory) to isolate coverage counters from user test memory. This feature shipped in V8 12.0 / Node 22.\n\n**Platforms with prebuilt native binaries for coverage instrumentation \u0026 debug info:**\n\n| | x64 | arm64 |\n|---|---|---|\n| Linux (glibc) | ✓ | ✓ |\n| Linux (musl/Alpine) | ✓ | |\n| macOS | ✓ | ✓ |\n| Windows | ✓ | ✓ |\n\n---\n\n## Writing Tests\n\nImport `test`, `describe`, `expect` from `vitest-pool-assemblyscript/assembly`. These functions are designed to follow the vitest API as closely as possible, so that everything is familiar and easy to reason about.\n\n- `it` is available as an alias for `test`\n- `describe` and `test` have inline modifiers to quickly change their run mode (see below)\n- `TestOptions` allows per-test inline configuration of additional options (aligned with vitest behavior)\n\n```typescript\nimport { test, it, describe, expect, TestOptions } from \"vitest-pool-assemblyscript/assembly\";\nimport { add } from \"../assembly/math.ts\";\n\ntest(\"a test\", () =\u003e {\n  expect(1 + 1).toBe(2);\n  expect(add(3, 2)).toBe(5);\n});\n\ndescribe(\"a suite of math operations\", () =\u003e {\n  test(\"another test\", () =\u003e {\n    expect(3 - 1).toBe(2);\n  });\n\n  describe(\"a nested suite of float operations\", () =\u003e {\n    it(\"tests something else\", () =\u003e {\n      expect(0.1 + 0.2).toBeCloseTo(0.3);\n    });\n  });\n});\n```\n\n### Inline Run Mode Modifiers: `.skip`, `.only`, `.fails`\n\nThese modify the way in which tests run in relation to each other, and/or how they report results.\n\nThey follow vitest JS-pool behavior.\n\n```typescript\ntest.skip(\"not ready yet\", () =\u003e {\n  // test will register it exists, show as skipped\n});\n\ntest.only(\"debugging this test\", () =\u003e {\n  // test will run by itself in this file\n});\n\ntest.fails(\"conditions are expected to fail, so test will actually pass\", () =\u003e {\n  expect(false).toBeTruthy();\n});\n\ntest.fails(\"conditions are expected to fail but do not, so test will actually fail\", () =\u003e {\n  expect(true).toBeTruthy();\n});\n\ndescribe.skip(\"entire suite skipped\", () =\u003e { /* ... */ });\n\ndescribe.only(\"only this suite runs\", () =\u003e { /* ... */ });\n```\n\n### Inline Test Options\n\n`TestOptions` provides chainable configuration for the vitest behavioral options: `timeout`, `retry`, `skip`, `only`, and `fails`\n- While you define them slightly differently in AssemblyScript than JavaScript, their behavior matches the same options in vitest\n- Options can be placed before or after the callback\n- Suite options (in `describe`) are inherited by nested tests and nested suites\n\n```typescript\n// options before callback\ntest(\"with timeout\", TestOptions.timeout(500), () =\u003e { /* ... */ });\n\n// options after callback\ntest(\"with retry\", () =\u003e { /* ... */ }, TestOptions.retry(3));\n\n// chained options\ntest(\"with both\", TestOptions.timeout(500).retry(2), () =\u003e { /* ... */ });\n\n// suite-level options are inherited by nested tests\ndescribe(\"slow tests\", TestOptions.timeout(1000), () =\u003e {\n  test(\"inherits suite timeout\", () =\u003e { /* ... */ });\n\n  // test-level options override suite options\n  test(\"custom retry\", TestOptions.retry(5), () =\u003e { /* ... */ });\n});\n\n// modifiers and options can be combined\ntest.fails(\"expected failure with retry\", TestOptions.retry(3), () =\u003e {\n  expect(false).toBeTruthy();\n});\n```\n\n### Lifecycle Hooks (Setup \u0026 Teardown)\n\nComing Soon!\n\n### Test Matchers\n\nWe aim to follow the [vitest/jest `expect()` API](https://vitest.dev/api/expect.html) as closely as possible, with some necessary differences given AssemblyScript's static-typing.\n\nSee the AssemblyScript Pool [Matchers API documentation](docs/matchers-api.md) for details on the available `expect()` methods you can use within your tests.\n\n---\n\n## Current Limitations \u0026 Roadmap\n\n### Limitations\n\nThese are known limitations which are currently being worked on.\n\n- **Function-level coverage only**: No statement, branch, or line coverage yet\n- **No lifecycle hooks**: No setup/teardown hooks yet\n- **Watch mode handles specs only**: Re-runs test files when they are directly changed, but not yet based on changed source files\n- **`toEqual` doesn't reflect**: Doesn't yet support deep inspection of user-defined objects\n\n### Near Future Roadmap\n\n**Epic: Enhanced block-level coverage**\n- Block-level statement coverage (line granularity)\n- Branch coverage using CFG analysis\n- All 4 coverage types (function, statement, branch, line)\n\n**Epic: Testing DX**\n- Lifecycle hooks (`beforeEach`, `afterEach`, `beforeAll`, `afterAll`)\n- Watch mode: re-run applicable tests on source file changes\n- `toEqual` reflection for deep equality inspection of user objects\n- `describe.for/each` and `test.for/each`\n- expect.soft to prevent fail-fast behavior\n- Allow delegating JS/TS to istanbul coverage provider in addition to v8\n- Maybe: Per-file compilation setting override\n\n**Epic: Expand expect matcher API**\n- Planned: `toBeDefined`, `toBeUndefined`, `toContain`, `toContainEqual`\n- Likely: `toBeOneOf`, `toBeTypeOf`, `toBeInstanceOf`, `toHaveProperty`, `toMatch`\n\n**Epic: Spy and Mock**\n- Intend to support\n\n**✖️ Out of Scope (Currently):**\n- Generic JS-harness testing of any precompiled WASM binary\n- Compiler \u0026 matcher integration with other compile-to-WASM languages (e.g. Rust and C++ with Emscripten)\n  - I would LOVE to expand this project to cover additional cases, supporting pluggable compilers, ast parsing, and matchers for different WASM ecosystems and toolchains\n  - Not in scope now because of time and effort\n  - If you want to pay me to work on this, please [get in touch](https://github.com/themattspiral)!\n\n---\n\n## Performance\n\nMany efforts have been made to compile and run tests as quickly as possible. Some optimizations that have been most useful:\n- Separate compile and test execution thread pools, worker thread entry points, and runners for quicker startup and thread respawn after test timeouts\n- Compile threads tuned to take advantage of significant Node V8 engine warmup time savings on consecutive AssemblyScript compilations (this is an ongoing investigation as I want to see how it behaves when scaled up significantly)\n- In-memory compiled files and source maps to eliminate intermediate disk I/O\n- Enforced hard timeouts for long-running WASM tests via thread termination, with intelligent resume\n\nAs such, it is capable of compiling dozens of test files comprising hundreds of tests in a few seconds, and is likely faster on your machine than mine:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/images/example-fixtures-suite.gif\" alt=\"vitest-pool-assemblyscript large suite performance demo\"\u003e\n\u003c/p\u003e\n\n---\n\n## Prior Work\n\nThere are several core pieces of software without which this project would not be possible.\n\n- This project makes direct use of the [AssemblyScript language](https://www.assemblyscript.org) and its fantastic [compiler](https://www.assemblyscript.org/compiler.html). AS is a joy to work with when it comes to WASM because it's so familiar to everyday TypeScript usage.\n- The key component that allows us to perform WASM instrumentation is [Binaryen](https://github.com/WebAssembly/binaryen), a C++ toolchain infrastructure library for WebAssembly. We started by using the fantastic [binaryen.js](https://github.com/AssemblyScript/binaryen.js/) - a JS port also from the folks behind AssemblyScript, and eventually migrated to the native library for some advanced source-map regeneration features.\n- Thanks to the [Vitest team](https://github.com/vitest-dev) for creating the framework in the first place and making it extensible for different runtimes. Their internal pools were used as reference throughout development.\n- Thanks to [`@cloudflare/vitest-pool-workers`](https://github.com/cloudflare/workers-sdk/tree/main/packages/vitest-pool-workers) for providing the leading example of a 3rd party vitest custom pool out in the wild.\n- Particular gratitude is also owed to [assemblyscript-unittest-framework](https://github.com/wasm-ecosystem/assemblyscript-unittest-framework) for inspiring our test discovery and instrumentation expression-walking approaches.\n\n---\n\n## License\n\nLicensed under the [MIT](LICENSE)\n\nPortions of this software have been derived from third-party works which are licenced under different terms. These uses have been noted and are accompanied by their respective licenses in the [project license](LICENSE) and/or in applicable source code.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemattspiral%2Fvitest-pool-assemblyscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthemattspiral%2Fvitest-pool-assemblyscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemattspiral%2Fvitest-pool-assemblyscript/lists"}