wasm-bindgen/examples/without-a-bundler-no-modules
Liam Murphy 643a773429
Test examples in CI (#3015)
* 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
2022-08-05 10:51:41 -05:00
..
src Implement the local JS snippets RFC 2019-03-05 08:00:47 -08:00
build.sh Test examples in CI (#3015) 2022-08-05 10:51:41 -05:00
Cargo.toml Implement the local JS snippets RFC 2019-03-05 08:00:47 -08:00
index.html Remove type=module from no-modules example 2020-06-03 08:40:54 -07:00
README.md Fix incorrect link to --target no-modules example (#2501) 2021-03-18 09:03:51 -05:00

Without a Bundler Using --target no-modules

View documentation for this example online

You can build the example locally with:

$ wasm-pack build --target no-modules

and then opening index.html in a browser should run the example!

Note that this example is in contrast to the without a bundler example which performs a similar purpose except it uses --target no-modules instead of --target web. The main difference here is how the shim JS and module are loaded, where this example uses old-school script tags while --target web uses ES modules.