Contributing
Important
Please refer to
mono-devfor contribution guidelines and tools setup for my projects.You will need to set up tools for Rust and TypeScript. The instructions are in the link above.
You will also need
Bunfor building the JS code.If you want to run the e2e tests, you need to install:
Denoto run tests for denodockerto build the playwright container for browser tests
Repo Setup
After cloning the repo, cd to the repo and run the following commands:
pnpm install
task install
task icets
# ^ this installs additional tools directly on your system,
# please read Taskfile.yml before running
Building the library
Caution
The
build-abortandbuild-unwindpackages are meta files for building the example crate and the library itself using eitherpanic=abortorpanic=unwind.Do not run
cargo buildorcargo build --target wasm32-unknown-unknownin either theexampleorlibpackages, as those packages by themselves lack the cargo config to build.
cd to the test package and run:
task build
This will build the example crate using panic=abort and panic=unwind,
as well as generating bundles for testing.
Run the tests
The test task accepts the following flags:
task run -- --<engine>... -E<test> TRIPLES... [-1]
--<engine>: specify the engines to run the tests on, for example --node only uses NodeJS
-E<test>: specify test filters, for example -Ejoin only runs tests with 'join' in the name
TRIPLES: specify triple filters, for example 'debug' only runs tests built with debug profile
-1: special flag to only run tests for the first triple after filtering the triples
For example, if you make a change, the minimal test procedure is:
task build
task run -- --node -1 abort
task run -- --node -1 unwind
This runs all test cases for both the abort and unwind panic strategies.
To test the browsers, you have 2 options:
- Ensure you have
dockerinstalled and run a browser e2e test such astask run -- --chrome - Alternatively, build the playground website and manually run the examples:
- Run
task devin thewebsitepackage.
- Run
Checks
Run task check in the root of the repo to run all linters and formatters.
Run task fix to automatically fix formatting issues.