Commit Graph

1166 Commits

Author SHA1 Message Date
Alex Crichton
16c2bee9c5 Don't run the test runner in release mode
It's gotten some improvements to the debug mode runtime that the extra
optimizations aren't worth it on CI (take too much time)
2018-08-04 08:22:47 -07:00
Sendil Kumar N
d66b834afd
Merge pull request #638 from afdw/master
Add applying of typedefs, remove generation of type aliases
2018-08-04 13:50:23 +02:00
Anton Danilkin
da9203142f Add applying of typedefs, remove generation of type aliases 2018-08-04 14:04:24 +03:00
Nick Fitzgerald
2b8e092f78 guide: Note that wasm-pack is preferred over using the wasm-bindgen CLI directly 2018-08-03 22:35:19 -05:00
Nick Fitzgerald
9b87e0c0b0 guide: clean up introduction to the supported types table 2018-08-03 22:35:19 -05:00
Nick Fitzgerald
1e1188d9e5 guide: Add String to "Supported Types" reference 2018-08-03 22:35:19 -05:00
Nick Fitzgerald
93b3216014 guide: Add imported and exported types to "supported types" reference 2018-08-03 22:35:19 -05:00
Nick Fitzgerald
536bf5e0d7 guide: Rename "Type Reference" section to "Supported Types" 2018-08-03 22:35:19 -05:00
Nick Fitzgerald
9e03dba413 guide: Overhaul the CLI reference content
* Add missing documentation for a couple existing flags.

* Make each flag its own header, so it gets an anchor, and can be permalinked
  to.

* Streamline some content and descriptions.
2018-08-03 22:35:19 -05:00
Nick Fitzgerald
2b83f6aa9b guide: Clean up title and URL of CLI reference section 2018-08-03 22:35:19 -05:00
Anton Danilkin
9c275d1f1d Use instantiateStreaming for --no-modules mode if possible 2018-08-03 22:34:59 -05:00
Nick Fitzgerald
94fe55ce80
Merge pull request #635 from fitzgen/organize-docs-into-tour-and-reference
guide: Organize docs into "Whirlwind Tour" and "Reference" sections
2018-08-03 16:26:59 -07:00
Tyler Wilcock
0624b0cf2e Add unit tests for even more 'web-sys' bindings
That list includes:
 * HtmlMenuElement
 * HtmlMenuItemElement
 * HtmlMetaElement
 * HtmlMeterElement
2018-08-03 17:41:38 -05:00
Anton Danilkin
07b4ef5838 Add support for empty enum variants and enum variants that start with a digit 2018-08-03 17:41:24 -05:00
Nick Fitzgerald
39e576d0be guide: Organize docs into "Whirlwind Tour" and "Reference" sections
First part of #616
2018-08-03 15:16:22 -07:00
Anton Danilkin
61b3d52dc9 Rename the test 2018-08-03 15:59:27 -05:00
Anton Danilkin
afaf94a428 Add support for optional chars 2018-08-03 15:59:27 -05:00
Anton Danilkin
4a0c69ffed Add support for optional bools 2018-08-03 15:59:27 -05:00
Anton Danilkin
0ef528165f Rename functions, remove escaped newlines 2018-08-03 15:59:27 -05:00
Anton Danilkin
2249032ba8 Revert WebIDLs with optional enum types, they are still not implemented 2018-08-03 15:59:27 -05:00
Anton Danilkin
3d9401aca6 Fix JS style 2018-08-03 15:59:27 -05:00
Anton Danilkin
81cbb2e26d Migrate the test 2018-08-03 15:59:27 -05:00
Anton Danilkin
c49c18826d Add support for optional numbers 2018-08-03 15:59:27 -05:00
Alex Crichton
2a6d98a6c9
Remove usage of syn's visit-mut feature (#631)
Looks like we're the only one in the dependency graph enabling this, so let's
try to cut down on compile times by not requiring it.
2018-08-03 14:11:44 -05:00
Nick Fitzgerald
1588a3cbcf
Merge pull request #632 from fitzgen/update-geckodriver
deps: Update geckodriver, package-lock.json
2018-08-03 10:55:51 -07:00
Nick Fitzgerald
7c6516991d deps: Update geckodriver, package-lock.json 2018-08-03 10:25:08 -07:00
YUyz
3d3bf5dc83 add test for HTMLTableElement in web-sys crate (#629) 2018-08-03 09:02:31 -05:00
dependabot[bot]
595bb78d26 Bump webpack from 4.16.3 to 4.16.4
Bumps [webpack](https://github.com/webpack/webpack) from 4.16.3 to 4.16.4.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.16.3...v4.16.4)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-03 09:29:54 +00:00
Sendil Kumar N
bf44fcbfe6
Merge pull request #626 from alexcrichton/optional-arg
Add support for `Option<&T>` in imported argument lists
2018-08-03 10:30:50 +02:00
Alex Crichton
88db12669f Add support for Option<&T> in imported argument lists
Closes #619
2018-08-02 22:40:42 -07:00
Alex Crichton
fe51cf9857 Add tests for by-value options 2018-08-02 22:23:11 -07:00
Tyler Wilcock
d47fc61c36 Add unit tests for more 'web-sys' HTML bindings (#617)
That list includes:
 * HtmlOptionElement
 * HtmlOptGroupElement
 * HtmlOListElement
 * HtmlModElement
2018-08-02 18:40:32 -05:00
Alex Crichton
4a78769349
Convert some more macro panics to diagnostics (#611)
This should hopefully be the last of the manually written diagnostics!
2018-08-02 11:12:50 -05:00
Alex Crichton
71dbd08c00
Default to headless testing for the test runner (#610)
We've gotten a number of reports that the interactive tests are a bit surprising
and confusing (also because it barely prints anything!). Instead let's default
to headless testing which matches the Rust style of testing much better.

The error message for a missing WebDriver binary has been updated with a note of
how to *not* do headless testing and the message for interactive testing was
also updated to display more information as well.
2018-08-02 10:30:07 -05:00
YUyz
7cc5dcf32d Fix link in the guide book (#609) 2018-08-02 08:12:18 -05:00
Alex Crichton
bdec2582aa
Result-ify src/parser.rs (#608)
* Make ConvertToAst trait fallible

It's got some panics, and we'll be switching those to errors!

* First example of a diagnostic-driven error

Add a diagnostic-driven error `#[wasm_bindgen]` being attached to public
functions, and add some macros to boot to make it easier to generate errors!

* Result-ify `src/parser.rs`

This commit converts all of `src/parser.rs` away from panics to using
`Diagnostic` instead. Along the way this adds a test case per changed `panic!`,
ensuring that we don't regress in these areas!
2018-08-01 18:59:59 -05:00
Nick Fitzgerald
d90802a40c
Merge pull request #607 from twilco/master
Add unit tests for various `web-sys` HTML element bindings
2018-08-01 16:54:25 -07:00
Nick Fitzgerald
ae7a9a7394 Readme tweaks (#606)
* Use ES modules in README example

* Remove introduction blog post from README

While the blog post is great, the README and the guide should be a good enough
intro to wasm-bindgen, and are more likely to be kept up to date.
2018-08-01 18:42:23 -05:00
Tyler Wilcock
e3546863bb Add unit tests for various 'web-sys' HTML element bindings
That list includes:
 * HtmlOptionsCollection
 * HtmlOutputElement
 * HtmlParagraphElement
 * HtmlParamElement
 * HtmlPreElement
 * HtmlProgressElement
 * HtmlQuoteElement
 * HtmlSlotElement
2018-08-01 18:14:03 -05:00
Alex Crichton
c4dcaee1b9
Prepare to have targeted error diagnostics (#604)
This commit starts to add infrastructure for targeted diagnostics in the
`#[wasm_bindgen]` attribute, intended eventually at providing much better errors
as they'll be pointing to exactly the code in question rather than always to a
`#[wasm_bindgen]` attribute.

The general changes are are:

* A new `Diagnostic` error type is added to the backend. A `Diagnostic` is
  created with a textual error or with a span, and it can also be created from a
  list of diagnostics. A `Diagnostic` implements `ToTokens` which emits a bunch
  of invocations of `compile_error!` that will cause rustc to later generate
  errors.

* Fallible implementations of `ToTokens` have switched to using a new trait,
  `TryToTokens`, which returns a `Result` to use `?` with.

* The `MacroParse` trait has changed to returning a `Result` to propagate errors
  upwards.

* A new `ui-tests` crate was added which uses `compiletest_rs` to add UI tests.
  These UI tests will verify that our output improves over time and does not
  regress. This test suite is added to CI as a new builder as well.

* No `Diagnostic` instances are created just yet, everything continues to panic
  and return `Ok`, with the one exception of the top-level invocations of
  `syn::parse` which now create a `Diagnostic` and pass it along.

This commit does not immediately improve diagnostics but the intention is that
it is laying the groundwork for improving diagnostics over time. It should
ideally be much easier to contribute improved diagnostics after this commit!

cc #601
2018-08-01 17:15:27 -05:00
Alex Crichton
fce687cf7b Retry installing yarn on CI
This was flaky enough in the past that the extra tries should hopefully make
this less flaky
2018-08-01 14:56:14 -07:00
Alex Crichton
6def60681b
Upgrade failure and fix deprecation warnings (#605) 2018-08-01 16:15:09 -05:00
Alex Crichton
eee71de0ce
Support asynchronous tests (#600)
* Tweak the implementation of heap closures

This commit updates the implementation of the `Closure` type to internally store
an `Rc` and be suitable for dropping a `Closure` during the execution of the
closure. This is currently needed for promises but may be generally useful as
well!

* Support asynchronous tests

This commit adds support for executing tests asynchronously. This is modeled
by tests returning a `Future` instead of simply executing inline, and is
signified with `#[wasm_bindgen_test(async)]`.

Support for this is added through a new `wasm-bindgen-futures` crate which is a
binding between the `futures` crate and JS `Promise` objects.

Lots more details can be found in the details of the commit, but one of the end
results is that the `web-sys` tests are now entirely contained in the same test
suite and don't need `npm install` to be run to execute them!

* Review tweaks

* Add some bindings for `Function.call` to `js_sys`

Name them `call0`, `call1`, `call2`, ... for the number of arguments being
passed.

* Use oneshots channels with `JsFuture`

It did indeed clean up the implementation!
2018-08-01 15:52:24 -05:00
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