build: enable service-worker tests on saucelabs (#36129)
Enables the `service-worker` tests on Saucelabs and fixes some issues that were preventing them from running on IE. The issues were: 1. We were serving es2017 code during tests. I've set it to es5. 2. The check which was verifying whether the environment is supported ended up hitting a `require` call in the browser which caused it to fail on browsers that don't support the `URL` API. PR Close #36129
This commit is contained in:
@ -100,6 +100,12 @@ export class SwTestHarness implements ServiceWorkerGlobalScope, Adapter, Context
|
||||
return true;
|
||||
}
|
||||
|
||||
// If we're in a browser that doesn't support URL at this point, don't go any further
|
||||
// since browser builds use requirejs which will fail on the `require` call below.
|
||||
if (typeof window !== 'undefined' && window) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// In older Node.js versions, the `URL` global does not exist. We can use `url` instead.
|
||||
const url = (typeof require === 'function') && require('url');
|
||||
return url && (typeof url.parse === 'function') && (typeof url.resolve === 'function');
|
||||
|
Reference in New Issue
Block a user