service-workers
service-workers copied to clipboard
A collection of utilities for creating/testing/experimenting with service workers.
When triggering native SW events, they do not receive the event type. https://github.com/zackargyle/service-workers/blob/526ee36ece5a761dfaa0464442f3ad6d9da56f8c/packages/service-worker-mock/utils/eventHandler.js#L7-L20 This is breaking pre-caching from Workbox, which specifically asserts the install event's type. ```js function createEvent(event, args)...
What I expect: ```js // given a response: const responseA = new Response('hello', { status: 200, headers: { Foo: 'Bar' } }) // when you clone it: const responseB =...
Implemented removeEventListener and verified tests
Relevant spec part: https://w3c.github.io/ServiceWorker/#cache-addAll > If r’s url's scheme is not one of "http" and "https", or r’s method is not `GET`, return a promise rejected with a TypeError. Not...
I happened across this typo in the `service-worker-mock` README and thought you might like the fix. :smiley:
[MDN says](https://developer.mozilla.org/en-US/docs/Web/API/Request) of `request.body` > A simple getter used to expose a ReadableStream of the body contents. In particular, I would expect `const { value, done } = await request.body.getReader().read()`...
### What happens ``` headers.append('foo', 'A') headers.append('foo', 'B') headers.entries() // [ ['foo', 'A,B' ] ] ``` ### What I expect ``` headers.append('foo', 'A') headers.append('foo', 'B') headers.entries() // [ ['foo', 'A'...
Hi, When using `self.trigger("fetch", request)` in _service-worker-mock_ we can only pass the request to the listener while in real browser the fetch callback also receives a _clientId_ in the event....
Hello! Thanks for creating and maintaining the server-worker-mock package. It's been super helpful for our service worker testing. However, we are having one issue when testing actions in our `notificationclick`...
According to [the spec](https://w3c.github.io/ServiceWorker/#client), `Client` is not a child of the `EventTarget` class. Also the [`Notification` class](https://notifications.spec.whatwg.org/#api) is a child of the `EventTarget` class. FWIW [TypeScript](https://github.com/microsoft/TypeScript/blob/master/lib/lib.webworker.d.ts) agrees with what is...