developit / developit/jsdom-worker

Testing Worker in Jest

Open
#14 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
291
Forks
20
PR merge metrics
No merged PRs in 30d

Description

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
...
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.