-
Notifications
You must be signed in to change notification settings - Fork 45
Add WASM unit tests with browser execution #195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v2
Are you sure you want to change the base?
Conversation
9b879db to
006e78e
Compare
| - name: Run WASM tests in headless browser | ||
| run: | | ||
| cd whoami | ||
| wasm-pack test --headless --chrome --all-features |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to use wasmtime instead?
|
@naoNao89 Thanks for the PR! I think a number of changes will be needed before merging, but it's pretty cool as-is. I think mostly it seems like the platform specific code wouldn't be compiled when running the wasm tests since it's gated on |
- Add 20 WASM integration tests running in headless Chrome - Add 10 native Unix error handling tests with mock FFI - Add Windows error handling test infrastructure - Add CI job for automated WASM testing - Add wasm-bindgen-test dev dependency
006e78e to
f38d13d
Compare
|
Done, removed the redundant console dep and dead test code. Added a big TODO about potentially switching to wasmtime instead of Chrome for CI. Would eliminate browser dependencies and speed up tests, worth discussing for a future PR. |
|
@naoNao89 I'm still not quite sure how this PR all comes together. As far as I can tell My eventual vision, (that I didn't fully write out) should contain something like this: {
mock_set_pass_wd(PassWd { .. });
mock_set_getpwuid_r(Ok(()));
let res = whoami::username();
assert!(res, Ok("mock_username"));
mock_set_errno(EIO);
mock_set_getpwuid_r(Err(()));
let res = whoami::username();
assert!(res, Err(..));
}I think for a next step, if you could split part of this (probably targeting a specific platform to wasm) into a smaller PR, that would be really helpful for me. Thank you! |
Implements WebAssembly unit tests as requested in #73. Adds 20 WASM browser tests running in headless Chrome, 10 native error handling tests with mock FFI, and CI automation.
fixes #73