Skip to content
Snippets Groups Projects
README.md 2.18 KiB

xxdk-WASM

This repository contains the WebAssembly bindings for xxDK. It also includes a test server to serve the compiled WebAssembly module.

Building

The repository can only be compiled to a WebAssembly binary using GOOS=js and GOARCH=wasm.

$ GOOS=js GOARCH=wasm go build -o xxdk.wasm

Running Unit Tests

Because the bindings use syscall/js, tests cannot only be run in a browser. To automate this process first install wasmbrowsertest. Then, tests can be run using the following command.

$ GOOS=js GOARCH=wasm go test ./...

Note, this will fail because wasm/wasm_js.s contains commands only recognized by the Go WebAssembly compiler and for some reason not recognized by the test runner. To get tests to run, temporarily delete the body of wasm/wasm_js.s during testing.

Testing