When using features in a test that are not supported by a browser, JSPerf will move on to the next test upon failure if there is one.
However, if you have a setup function that relies on browser-specific methods before any tests start running, those tests will only work in that particular browser and not others. To address this issue, you may need an alternative setup function using a shim or polyfill.
As far as I know, you cannot set a jsPerf testcase to run only on a specific browser, but you can specify a Browserscope result filter:
According to jsPerf FAQ - Result filters:
Is it possible to preset a specific Browserscope result filter when sharing a test case link?
Yes, for instance, adding #filterBy=mobile
to the test case URL will display results only for mobile browsers by default. Other available result filters include popular
, all
, desktop
, major
, minor
, and prerelease
.
Referencing jsPerf FAQ - Browserscope:
Why do the Browserscope results appear different from my own?
Browserscope presents the highest known result for each test. Due to the margin of error in each test, we submit results without this margin (lower limit of the confidence interval, indicating the lowest suspected value) to Browserscope.
Furthermore, testing across multiple browsers can be automated:
See jsPerf FAQ - autorun:
I prefer automated testing. Can tests be configured to run automatically upon page load?
Absolutely, simply add #run
to the test case's URL, like so:
http://jsperf.com/document-getelementbyid#run.