{"id":18016644,"url":"https://github.com/seclerp/dotnet-wasm-unit-tests","last_synced_at":"2025-03-26T18:32:24.764Z","repository":{"id":257019383,"uuid":"856928890","full_name":"seclerp/dotnet-wasm-unit-tests","owner":"seclerp","description":"An example of how .NET assemblies compiled into wasi-wasm module could be tested in true WASI WASM environment","archived":false,"fork":false,"pushed_at":"2024-09-13T20:10:42.000Z","size":15,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T21:47:01.003Z","etag":null,"topics":["extism","wasi","wasm","webassembly"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seclerp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-09-13T13:29:07.000Z","updated_at":"2024-09-16T09:02:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"690f49a1-ffc2-4ac8-b101-ef0fea7ab773","html_url":"https://github.com/seclerp/dotnet-wasm-unit-tests","commit_stats":null,"previous_names":["seclerp/dotnet-wasm-unit-tests"],"tags_count":0,"template":false,"template_full_name":"seclerp/dotnet-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seclerp%2Fdotnet-wasm-unit-tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seclerp%2Fdotnet-wasm-unit-tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seclerp%2Fdotnet-wasm-unit-tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seclerp%2Fdotnet-wasm-unit-tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seclerp","download_url":"https://codeload.github.com/seclerp/dotnet-wasm-unit-tests/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245713089,"owners_count":20660342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["extism","wasi","wasm","webassembly"],"created_at":"2024-10-30T04:18:44.717Z","updated_at":"2025-03-26T18:32:24.751Z","avatar_url":"https://github.com/seclerp.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dotnet-wasm-unit-tests\n\n!['main' Build status](../../actions/workflows/build.yml/badge.svg?branch=main)\n\nAn example of how .NET assemblies compiled into wasi-wasm module could be tested in true WASI WASM environment.\n\nThe example is based on the Extism platform - a high level interop and serialization abstraction over regular WASI WASM modules\ninitially designed for enriching applications with plugin support.\n\n## How it works\n\n- `Example.Library`: the code that should be tested, zero dependencies on Wasm stuff\n- `Example.Tests.WasiHost`: a project that bundles actual library, compiles to wasi-wasm module and provides exports used by test project\n- `Example.Tests.Shared`: contains payloads used by both test project and library\n- `Example.Tests`: the xUnit test project that hosts Extism runtime and executes exports from WasiHost\n\nDeclared MSBuild target from `wasi-experimental` workload builds `Example.Tests.WasiHost` as a `.wasm` module. This module already\ncontains library logic, as it references `Example.Library`. Then, `Example.Tests` test project loads `.wasm` module as an Extism plugin\nand executes the logic under test execution. The interop between WASI runtime and compiled module is done by Extism, including serialization of complex objects.\nShared models are placed in `Example.Tests.Shared` project.\n\n## Dependencies\n\n### .NET SDK 8\nMinimal supported version of .NET SDK is 8. \n\n### `wasi-experimental`\nExtism uses `wasi-experimental` toolset and `wasi-wasm` runtime identifier, so the appropriate workload should be installed\n```shell\ndotnet workload install wasi-experimental\n```\n\n### WASI SDK\nTo build native part of the party WASI SDK is required.\n\n1. Download WASI SDK from [the releases page](https://github.com/WebAssembly/wasi-sdk/releases)\n2. Export env var `WASI_SDK_PATH=/path/to/wasi-sdk`\n\nAlternatively, you could install WASI SDK using the Powershell script from \n[dotnet/runtimelab](https://github.com/dotnet/runtimelab/blob/feature/NativeAOT-LLVM/eng/pipelines/runtimelab/install-wasi-sdk.ps1).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseclerp%2Fdotnet-wasm-unit-tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseclerp%2Fdotnet-wasm-unit-tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseclerp%2Fdotnet-wasm-unit-tests/lists"}