Re: Using WPT as unit tests for polyfill libraries?


Glad to hear they can be merged.

As for classList.force, since we are explicitly passing an ECMAScript value
to it, according to WebIDL, it will first be converted to boolean by using
ToBoolean(undefined), which returns false. So toggle("name", undefined)
should actually remove the class and not toggling it. But I haven't go
through WebIDL very throughly, so I'm not absolutely sure that's correct,
will go through it more carefully when I'm writing the tests.


Thank you for bringing that up, I was thinking about that too, but I
haven't tried out wptrunner yet, so I stop worrying about it until I have
more understanding of wptrunner. Maybe it support injecting custom js
scripts before the tests? If not, maybe I will try to add that feature and
send a pull request. Are you using wpt as unit tests too? Do you have any
good luck with it?

On Wed, Feb 18, 2015 at 7:07 PM, James Graham <>

> On 17/02/15 07:54, Glen Huang wrote:
> > Hi,
> >
> > I’m writing a polyfill library that would like to use Web Platform
> > Tests as unit tests, but I encounter a few obstacles:
> >
> > - How to automate the tests in multiple browsers? More specifically,
> > is it possible to integrate WPT into, say, saucelabs? - Some tests
> > are just too edge-case (e.g., toString(Event) should equal "[object
> > Function]” or class=“name name” should only return one class name) to
> > be covered by a polyfill library. Is it possible to cherry-pick tests
> > without forking the project?
> >
> > Or is WPT never meant to be used as unit tests for other libraries,
> > and I’m looking at the wrong project?
> So the thing I haven't worked out is how you plan to inject the
> polyfilly itself into the testcase dom. I can think of some crazy
> schemes involving testharnessreport.js that might work for some
> polyfills, but nothing obviously good.

Received on Thursday, 19 February 2015 04:25:38 UTC