PhantomJS doesn't support the handy [1,2,3].includes(1) function, so
replace it with the tried-and-true indexOf();
Avoid logging errors on failure to connect to the shared offline worker
when running within phantomjs.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
}
service.worker.onerror = function(err) {
- console.error('Error loading shared worker', err);
+ // avoid spamming unit test runner on failure to connect.
+ if (!navigator.userAgent.match(/PhantomJS/)) {
+ console.error('Error loading shared worker', err);
+ }
service.cannotConnect = true;
}
// Create and connect to the give schema
service.connectToSchema = function(schema) {
- if (service.connectedSchemas.includes(schema)) {
+ if (service.connectedSchemas.indexOf(schema) >= 0) {
// already connected
return $q.when();
}