* Fix example tests
I went to enable testing for the `synchronous-instantiation` example now
that Firefox supports module workers, but then found that the
`wasm-audio-worklet` example was failing because the test server doesn't
set the headers needed to enable `SharedArrayBuffer`.
It turns out that CI wasn't failing because it's been broken this whole
whole time: it specifies the path to the built examples as simply
`exbuild`, which doesn't work because the tests are run with their
working directory set to `crates/example-tests`, not the root of the
repo. This means that any requests that the examples try to make will
404. So this PR specifies it as an absolute path instead.
At the moment, Firefox doesn't directly indicate any kind of error when
navigation fails, which meant that the tests would just silently fail
without actually testing anything. According to the spec,
`browsingContext.navigate` is supposed to wait for the navigation to
complete, and result in an error if something goes wrong; but I think
Firefox is behind, because it seems to instead immediately return.
To work around this, I've made it so that the tests manually wait for
the `network.responseCompleted` event to check if fetching the page
suceeded, and so this shouldn't happen again.
I've left the actual fix for the `wasm-audio-worklet` example commented
out to make sure that CI actually catches the issue now; that's why this
PR is a draft.
* properly interpolate repo root
* use correct variable
It looks like `env` is specifically for variables that you set manually,
not arbitrary environment variables.
* Fix wasm_audio_worklet
* tweak doc comment
I noticed that none of the examples that compile using `wasm-pack` were working properly in https://rustwasm.github.io/wasm-bindgen/exbuild. I think this is happening because `wasm-pack` generates a `.gitignore` for the `pkg` folder, which the GitHub Pages uploader is interpreting to mean 'don't upload this'.
This PR makes CI delete those `.gitignore`s to try and fix that. It's still a draft because I don't know if it's actually going to work.
This isn't _that_ severe, since the only broken example which is actually linked to from the guide is the WebSockets example. Once I've seen whether this has worked I might go ahead and add links for the rest of the `wasm-pack`-built examples as well.
* Change the bare minimum to be able to remove the wit-* deps
* Remove some holdovers
Namely `Generated` being an enum and the `trap` fields of `Instruction::IntToWasm` and `Instruction::WasmToInt`.
* remove tests for interface types
* update reference tests
* fix reference tests (again)
* Allow enabling multi-value
For some reason wasm-bindgen would only allow enabling multi-value if interface types were enabled, throwing an error otherwise. I couldn't see any reason why, so I changed that.
Since that also meant that multi-value + JS bindings wasn't being tested, allowing it exposed some bugs that I fixed.
* update test expectations
* Don't install binaryen in CI
This is a workaround for rustwasm/wasm-pack#1247, which causes `wasm-pack` to fail to run if a local version of `wasm-opt` is installed. That in turn caused the `build_examples` CI job to break.
This PR fixes that by not having it download binaryen, instead letting `wasm-pack` install it itself, which still works.
* Put back the binaryen-installing step, but only install wasm2js instead of the whole thing.
I also updated to binaryen 112 while I was at it.
* Add a test that examples don't throw any errors
TODO:
- run all the tests, not just the ones which use webpack (also an issue with CI)
- fix webxr test
- run in CI
- share WebDriver instance between tests
- maybe ditch async, since we don't really need it here and it adds a bunch of dependencies and build time.
* Disable testing WebXR example
It isn't supported in Firefox yet, which is where we're running our tests.
* Test examples that aren't built with webpack
* Remove `WEBDRIVER` environment variable
It wouldn't have worked anyway because at least for the moment, I'm using one WebDriver session per test, and Firefox at least only allows one session to be connected.
I would like to make them share a session, in which case I could add this back, but I can't right now because Firefox hasn't implemented `LogEntry.source` yet, which is needed to figure out which log entries should fail which tests.
* Run in CI
* Use `Once` instead of `Mutex`
* Build `webxr` and `synchronous-instantiation` in CI
Although we can't test them, we can still build them.
* Add missing '`'
* Fix running of tests
* Only include dev deps when not compiling for wasm
* oops, those are the native tests
* Create build dirs before copying to them
* Install binaryen
* decompress
* Follow redirects
* Set `PATH` properly
* Use an absolute path
* Don't symlink `node_modules` and fix artifact download
* Enable `web_sys_unstable_apis`
This is needed for the `webxr` example.
* Increase timeout to 10s
* Increase timeout to 20s
This seems excessive but 10s is still sometimes failing.
* Disable testing the webgl example
* Add binaryen to PATH directly after installing
* Properly download the raytrace example artifacts
* Disable example tests instead of enabling everything else
* Move to a separate `example-tests` crate
* Make `Closure::new` work on stable
I've removed the nightly requirement by replacing `Unsize<T>` with a custom `IntoWasmClosure<T>` trait, implemented for `Fn` and `FnMut`.
I don't think this is a breaking change, since I don't think any stability guarantees are provided for nightly.
* Update docs
I also removed an outdated note about closures only being able to take WASM primitive types.
* Remove nightly CI
* Don't attempt to enable the removed nightly feature in doc generation