Commit Graph

1123 Commits

Author SHA1 Message Date
Alex Crichton
4181afea45
Start migrating wasm_bindgen tests to wasm_bindgen_test (#602)
This commit starts migrating the `wasm_bindgen` tests to the `wasm_bindgen_test`
framework, starting to assemble the coffin for
`wasm-bindgen-test-project-builder`. Over time all of the tests in
`tests/all/*.rs` should be migrated to `wasm_bindgen_test`, although they may
not all want to go into a monolithic test suite so we can continue to test for
some more subtle situations with `#[wasm_bindgen]`.

In the meantime those, the `tests/all/api.rs` tests can certainly migrate!
2018-08-01 14:19:19 -05:00
dependabot[bot]
bbfdcc833f Bump @types/node from 10.5.4 to 10.5.5
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped) from 10.5.4 to 10.5.5.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-01 08:41:29 +00:00
Tyler Wilcock
c1f182cca7 Add unit test for HtmlSelectElement binding. (#598) 2018-08-01 00:01:03 -05:00
Jonathan Kingston
26a3e57536 Testing web-sys for input, heading and title elements. (#596) 2018-07-31 08:57:16 -07:00
Tyler Wilcock
05f3eec76d Fix web-sys history unit test (#592)
In an actual browser, the changing of the history using the binding
worked a little too well, and caused the test to fail if you refreshed
the page or manually used the back and forward buttons.  The stateful
stuff has been removed - the remaining two assertions should adequately
test that the binding works, which is the point of these tests anyways.
2018-07-31 06:55:30 -07:00
dependabot[bot]
33e5223dd6 Bump geckodriver from 1.11.0 to 1.12.0
Bumps [geckodriver](https://github.com/vladikoff/node-geckodriver) from 1.11.0 to 1.12.0.
- [Release notes](https://github.com/vladikoff/node-geckodriver/releases)
- [Commits](https://github.com/vladikoff/node-geckodriver/compare/v1.11.0...v1.12.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-31 09:53:26 +00:00
dependabot[bot]
63949eb14d Bump typescript from 2.9.2 to 3.0.1
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 2.9.2 to 3.0.1.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v2.9.2...v3.0.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-31 08:51:08 +00:00
Tyler Wilcock
c971620039 Add unit test for HtmlHrElement web_sys binding (#591) 2018-07-30 18:25:48 -07:00
Nick Fitzgerald
05d3b934c8
Merge pull request #559 from alexcrichton/browser-tests
Initial support for in-browser and headless testing
2018-07-30 13:20:34 -07:00
Alex Crichton
1ef9067952 Install geckodriver for web-sys 2018-07-30 11:16:12 -07:00
Alex Crichton
c760b2120a No need to work around ourselves any more 2018-07-30 11:10:48 -07:00
Alex Crichton
fcda44c967 Update that web-sys tests require --target now 2018-07-30 11:07:07 -07:00
Alex Crichton
4282ec25bd Move web-sys tests to the new test framework
Migrate most `web-sys` tests to the new `wasm_bindgen_test` framework with the
new headless browser capabilities!
2018-07-30 11:07:07 -07:00
Alex Crichton
79e281128e Clarify test suite 2018-07-30 11:07:07 -07:00
Alex Crichton
ae034bb410 More descriptive error with no WebDriver binary 2018-07-30 11:07:07 -07:00
Alex Crichton
738372f769 Use Drop implementations instead of OnDrop 2018-07-30 11:07:07 -07:00
Alex Crichton
081f2fdc65 Add Function construtor to js-sys 2018-07-30 11:07:07 -07:00
Alex Crichton
8cd8ae6d10 Don't reformat browser errors 2018-07-30 11:07:07 -07:00
Alex Crichton
833024fe3e Don't reformat browser errors 2018-07-30 11:07:07 -07:00
Alex Crichton
63c86aa4e3 Download geckodriver for headless tests 2018-07-30 11:07:07 -07:00
Alex Crichton
851debbec1 Fix compile on Windows 2018-07-30 11:07:07 -07:00
Alex Crichton
74cb40189c Fix MUSL builder by compiling OpenSSL 2018-07-30 11:07:07 -07:00
Alex Crichton
a1ffa8abd3 Add some dox 2018-07-30 11:07:07 -07:00
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