Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create infrastructure for runtime correctness tests for closurized code #328

Closed
traviskaufman opened this issue Feb 22, 2017 · 3 comments
Closed
Labels

Comments

@traviskaufman
Copy link
Contributor

traviskaufman commented Feb 22, 2017

Come up with a way to compile each of our tests along with our code, and run those tests in a browser using karma. This will ensure that users who bundle our code with closure do not run into any issues.

Should be distinct from npm test, but should run on CI.

@traviskaufman traviskaufman added this to the Closure Compiler Compatibility milestone Feb 22, 2017
@lynnmercier lynnmercier removed this from the Closure Compiler Compatibility milestone Jul 19, 2017
@ribrdb
Copy link

ribrdb commented Dec 18, 2017

I started playing with this at master...ribrdb:closure-tests

Basically I updated the rewriter script to support the unit tests too.
At first I tried just leaving everything as es6 modules, but the compiler seemed to have problems correctly calculating dependencies between modules.
So for the packages and test helpers the script converts them to use goog.module.
The script doesn't properly handle "export function foo()...", so I also updated the helpers to just do "function foo(){} export {foo}".
I left the .test.js files as es6 modules, because the compiler automatically treats es6 modules with no exports as entry points. Seemed a lot cleaner than passing in a ton of entry points.

I don't really understand how you're trying to handle externs: how are you supposed to package up an external library with these goog.provides? Also the script was generating nonsense for the unit test libraries like chai, so I converted it to handle them the way I'm used to: you include the browser version of chai.js on the page before the unit tests and just refer to the chai global.

I'm using Bazel to compile the javascript because it's what I'm used to, but I'm sure you can get it working in a shell script if you don't want to add that dependency.

I got the animation tests passing in chrome compiled with this. But there's more that needs to be fixed to get the rest working.

@ribrdb
Copy link

ribrdb commented Dec 19, 2017

I've got the tests for the whitelisted packages to compile, but there lots of failures (151/421):
https://ribrdb.github.io/material-components-web/

@ribrdb
Copy link

ribrdb commented Jan 23, 2018

Why is this closed? Does that mean you're now compiling the tests with closure? Or you don't care about it any more?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants