developit / developit/jsdom-worker

Testing Worker in Jest

Aperta
#14 2 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
291
Fork
20
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hi,

I'm trying to test my worker inside a Vue.js project. I load the worker inside my component using the [worker-plugin](https://github.com/GoogleChromeLabs/worker-plugin/) (I also tried loading my Worker using [Webpack worker-loader](https://webpack.js.org/loaders/worker-loader/), unfortunately it doesn't provide a compatible interface and I had to mock the worker in that case)

```js
const worker = new Worker('@/utils.worker.js', { type: 'module' });
```

But when I run my tests with Jest I get

```
console.error node_modules/jsdom-worker/dist/jsdom-worker.js:1
TypeError: Only absolute URLs are supported
...
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.