Commit Graph

1100 Commits

Author SHA1 Message Date
Alex Crichton
7b4f0072c8 Add support for headless testing
This commit adds support to the `wasm-bindgen-test-runner` binary to
perform headless testing via browsers. The previous commit introduced a
local server to serve up files and run tests in a browser, and this
commit adds support for executing that in an automated fashion.

The general idea here is that each browser has a binary that implements
the WebDriver specification. These binaries (typically `foodriver` for
the browser "Foo") are interfaced with using HTTP and JSON messages. The
implementation was simple enough and the crates.io support was lacking
enough that a small implementation of the WebDriver protocol was added
directly to this crate.

Currently Firefox (`geckodriver`), Chrome (`chromedriver`), and Safari
(`safaridriver`) are supported for running tests. The test harness will
recognize env vars like `GECKODRIVER=foo` to specifically use one or
otherwise detects the first driver in `PATH`. Eventually we may wish to
automatically download a driver if one isn't found, but that isn't
implemented yet.

Headless testing is turned on with the `CI=1` env var currently to be
amenable with things like Travis and AppVeyor, but this may wish to grow
an explicit option to run headless tests in the future.
2018-07-30 11:07:07 -07:00
Alex Crichton
8fc40e4c0f Update test harness for browser testing
This commit updates the test harness for in-browser testing. It now no longer
unconditionally uses `fs.writeSync`, for example. Instead a `Formatter` trait is
introduced for both Node/browser environments and at runtime we detect which is
the appropriate one to use.
2018-07-30 11:07:07 -07:00
Alex Crichton
0770f830e7 Start supporting in-browser testing
This commit starts to add support for in-browser testing with
`wasm-bindgen-test-runner`. The current idea here is that somehow it'll be
configured and it'll spawn a little HTTP server serving up files from the
filesystem. This has been tested in various ways but isn't hooked up just yet,
wanted to make sure this was somewhat standalone! Future support for actually
running these tests will be coming in later commits.
2018-07-30 11:07:07 -07:00
Alex Crichton
7e16690f10
Migrate webidl tests to wasm_bindgen_test (#590)
This commit moves the `webidl/tests` folder to a new `crates/webidl-tests` crate
(to have a test-only build script) and ports them to the `#[wasm_bindgen_test]`
attribute, which should hopefully make testing much speedier for execution!
2018-07-30 11:06:29 -07:00
Alex Crichton
d876475ce3
Fix some situations with duplicate imports (#589)
* Fix importing the same identifier from two modules

This needed a fix in two locations:

* First the generated descriptor function needed its hash to include the module
  that the import came from in order to generate unique descriptor functions.
* Second the generation of the JS shim needed to handle duplicate identifiers in
  a more uniform fashion, ensuring that imported names didn't clash.

* Fix importing the same name in two modules

Previously two descriptor functions with duplicate symbols were emitted, and now
only one function is emitted by using a global table to keep track of state
across macro invocations.
2018-07-30 10:50:43 -07:00
afdw
7fda07f797 Add renaming of conflicting constructors and operations (#579)
* Add renaming of conflicting constructors and operations

* Rename conflicting to overloaded

* Fix newlines

* Use or_insert_with, add a comment to TypeToString

* Use more Rust-like names

* Use opt instead of nullable

* Use argument names instead of argument types if possible

* Drop new for overloaded constructots

* Remove extra newline

* Move WebIDL files from unavailable_overloaded_fn

* Move RTCDataChannel, RTCPeerConnection and Selection to unavailable_option_primitive
2018-07-30 07:41:22 -07:00
dependabot[bot]
457ed3ffcb Bump webpack from 4.16.2 to 4.16.3
Bumps [webpack](https://github.com/webpack/webpack) from 4.16.2 to 4.16.3.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.16.2...v4.16.3)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-30 08:52:33 +00:00
dependabot[bot]
caad633ef4 Bump @types/node from 10.5.3 to 10.5.4
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped) from 10.5.3 to 10.5.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-30 08:34:39 +00:00
Sendil Kumar N
c975895c98
Merge pull request #585 from twilco/master
Add web_sys binding for XPathResult
2018-07-30 07:04:03 +02:00
twilco
70f5183985 Add web_sys binding for XPathResult 2018-07-29 22:43:09 -05:00
Michael Hoffmann
f5f541337c Create bindings for RegExp (#580)
* Create bindings for RegExp

* Address review comments

- Split the constructor into two: `new` and `new_regexp`. This way we
  can write RegExp::new("foo", "g") rather than
  RegExp::new(&JsValue::from("foo"), "g").

- The js_name for the setter for lastIndex should be `lastIndex` and
  not `set_lastIndex`. But fixing this causes a panic. Remove the
  method for now.
2018-07-29 16:13:42 -07:00
Richard Dodd (dodj)
71255acf5d Try to enable all webidls (#573)
* Try to enable all webidls

* Separate out unavailable webidl files by reason.

* Create record of fully tested WebIDL files

* Update notes to reflect new situation with web-idl

* Make a blank ident fail, disable the necessary widls.

It turns out that all the blank idents came from blank enum variants,
which is allowed in webidl apparently.
2018-07-29 16:07:19 -07:00
Jonathan Kingston
b7af4e3169 Add documentation and MDN links for webidl files. Fixes #513 (#581) 2018-07-29 09:12:36 -07:00
konstin
0bd21b7bd2 Move the macro support code into its own crate (#529) 2018-07-29 08:59:46 -07:00
Jonathan Kingston
0f50f39079 Adding tests for script and style elements. (#578) 2018-07-28 14:44:41 -07:00
Jonathan Kingston
2a721737ab Add button element tests for web-sys. (#577) 2018-07-28 09:36:50 -07:00
Noumir Poutipou
fa4b636c25 Fix very small typo in guide (#575) 2018-07-28 09:36:23 -07:00
Nick Fitzgerald
decdbd92b8 Js sys contributing (#574)
* guide: js-sys testing page should refer to js-sys not web-sys

* guide: Use checklist for adding new js-sys APIs
2018-07-27 16:22:33 -07:00
Joel Gallant
01194558bf Adds Array.prototype.splice() to js-sys (#571) 2018-07-27 10:07:21 -07:00
Alex Crichton
66649018ae
Speed up examples CI builder (#572)
No need to `npm install` a bunch of times, we only need to do it once!
2018-07-27 10:07:00 -07:00
Jonathan Kingston
67b43ee389 Adding in initial support for all HTML*Element interfaces. (#568)
* Adding in initial support for all HTML*Element interfaces.

* Fix camelcasing of short HTML interface names

* Disabling span test as breaks on taskcluster
2018-07-27 09:57:24 -07:00
Alex Crichton
55e2ce9b53 Note that new WebIDL may need TODO comments
We don't support all features just yet!

Closes #570
2018-07-27 08:50:41 -07:00
Alex Crichton
f90f53c540 Fix some links in the guide
Closes #569
2018-07-27 08:48:10 -07:00
Sendil Kumar N
68ef6b429e
Merge pull request #567 from jontro/patch-1
Fix incorrect url
2018-07-27 12:06:04 +02:00
Jonas Trollvik
037915827b
Fix incorrect url 2018-07-27 10:10:11 +02:00
Alex Crichton
00bb6736e3
Add guide documentation for the js-sys crate (#566) 2018-07-26 17:56:55 -07:00
Alex Crichton
f893e3475c Only publish artifacts for main crate changes 2018-07-26 15:51:43 -07:00
Alex Crichton
de0776948d Tweak travis config 2018-07-26 15:50:51 -07:00
Nick Fitzgerald
28cb007c1b guide: Also publish the test crates 2018-07-26 15:12:04 -07:00
Nick Fitzgerald
7da0220b10 test: Add cargo.toml metadata 2018-07-26 15:11:34 -07:00
Nick Fitzgerald
da1e16d46c test-macro: Add Cargo.toml metadata 2018-07-26 15:08:59 -07:00
Nick Fitzgerald
8ec9713dd9 js-sys: Add some more Cargo.toml metadata like license 2018-07-26 15:06:24 -07:00
Nick Fitzgerald
6203fc8f98 js-sys: Add a js-sys specific CHANGELOG.md 2018-07-26 15:05:00 -07:00
Nick Fitzgerald
08a449f667 guide: Also tag the release commit and push it 2018-07-26 15:01:36 -07:00
Nick Fitzgerald
7a7d0d4097 guide: Allow dirty when publishing wasm-bindgen
Because we comment out the `[patch]` section and don't commit it.
2018-07-26 14:58:57 -07:00
Nick Fitzgerald
9a0470b1c4 Bump to 0.2.15 2018-07-26 14:53:59 -07:00
Nick Fitzgerald
a204c8d4b7
Merge pull request #565 from fitzgen/js-sys-iterator-protocol
js-sys: Unify all iterators under one generic iterator type
2018-07-26 14:22:34 -07:00
Nick Fitzgerald
58482b07a8
Merge pull request #558 from alexcrichton/wasm2es6js
Simplify wasm2es6js output
2018-07-26 13:51:56 -07:00
Nick Fitzgerald
62de3bad67 js-sys: Unify all iterators under one generic iterator type
The JS iterator protocol uses duck typing and we don't need separate
ArrayIterator and SetIterator etc types, we can have a single iterator type for
the whole protocol.
2018-07-26 13:48:52 -07:00
Sendil Kumar N
5ef5de6d45
Merge pull request #564 from alexcrichton/tweak-ci
Tweak Travis/AppVeyor config
2018-07-26 22:19:48 +02:00
Nick Fitzgerald
54109f9ccf
Merge pull request #556 from alexcrichton/fewer-copies
Optimize the execution time of wasm-bindgen tools
2018-07-26 12:38:25 -07:00
Nick Fitzgerald
b3458307a7
Merge pull request #557 from alexcrichton/pass-in-firefox
Tweak js-sys tests to pass in Firefox
2018-07-26 12:35:49 -07:00
Alex Crichton
eda1033246 Tweak Travis/AppVeyor config
* Fix running dist builds on tags
* Only run dist builds on tags, no need to run the full matrix.
* Fix dist builds on AppVeyor to include `wasm-bindgen-test-runner.exe`
* Only cache `~/.cargo` on Travis for the guide build, the `target` dir changes
  too much to cache it.
2018-07-26 11:31:38 -07:00
Tyler Wilcock
ba98491fc1 Enable History Web API (#561)
* Add Number.isNaN() binding

* Add binding for Math.hypot()

* Implement Math.min() and Math.max() bindings

* Enable History API
2018-07-26 10:21:04 -07:00
Alex Crichton
0d3f877ec4 Build tags on Travis 2018-07-26 10:16:11 -07:00
Richard Dodd (dodj)
2c69d25289 Add file location information when failing to parse WebIDL files. (#562) 2018-07-26 10:09:04 -07:00
Alex Crichton
55a9ec1b21 Simplify wasm2es6js output
Currently it generates a lot of shim functions which delegate to the wasm module
when loaded, but it turns out with `export let` we can just update the bindings!
Instead of exporting a bunch of shims this updates the export functionality to
only update the `export let` directives with the direct values from the wasm
module once the module is done loading.
2018-07-25 16:56:43 -07:00
Alex Crichton
41200743af Tweak js-sys tests to pass in Firefox
Turns out date parsing is slightly different there!
2018-07-25 16:55:11 -07:00
Nick Fitzgerald
64591ef403 Js sys use &str arguments (#555)
* js-sys: imports should take &str parameters instead of &JsString

* js-sys: Imports should take Option<&str> instead of Option<String>
2018-07-25 18:50:30 -05:00
Alex Crichton
0992e45e7f Use std::fs read/write conveniences
In addition to being more ergonomic these are much more efficient at reading
large files as they preallocate internally. This provides a nice speed boost
locally, reducing the overhead of `wasm-bindgen-test-runner` from 0.23s to
0.19s, yay!
2018-07-25 16:08:42 -07:00