developit / developit/jsdom-worker

Error when running with jest

Open
#4 5 comments 4 reactions 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
291
Forks
20
PR merge metrics
No merged PRs in 30d

Description

```js
console.error node_modules/jsdom-worker/dist/jsdom-inline-worker.js:1
Error: only absolute urls are supported
at /Users/aaronvasquez/Oyster/webnode/directories/node_modules/node-fetch/index.js:54:10
at new Promise ()
at new Fetch (/Users/aaronvasquez/Oyster/webnode/directories/node_modules/node-fetch/index.js:49:9)
at Fetch (/Users/aaronvasquez/Oyster/webnode/directories/node_modules/node-fetch/index.js:37:10)
at Object..global.fetch (/Users/aaronvasquez/Oyster/webnode/directories/node_modules/jsdom-worker/dist/jsdom-inline-worker.js:1:876)
at new Worker (/Users/aaronvasquez/Oyster/webnode/directories/node_modules/jsdom-worker/dist/jsdom-inline-worker.js:1:1780)
at /Users/aaronvasquez/Oyster/webnode/directories/src/utils/bg-worker/index.js:12:29
at new Promise ()
at performTask (/Users/aaronvasquez/Oyster/webnode/directories/src/utils/bg-worker/index.js:11:5)
at Object. (/Users/aaronvasquez/Oyster/webnode/directories/src/utils/bg-worker/bg-worker.test.js:9:29)
at resolve (/Users/aaronvasquez/Oyster/webnode/directories/node_modules/jest-jasmine2/build/queueRunner.js:38:12)
at new Promise ()
at mapper (/Users/aaronvasquez/Oyster/webnode/directories/node_modules/jest-jasmine2/build/queueRunner.js:31:21)
at Promise.resolve.then.el (/Users/aaronvasquez/Oyster/webnode/directories/node_modules/p-map/index.js:46:16)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
```

This is what I have in my test file:
```js
import "jsdom-worker";
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running src/utils/bg-worker/bg-worker.test.js and read src/utils/bg-worker/index.js, focusing on the Worker construction shown in the stack trace. Trace how importing jsdom-worker leads to node-fetch receiving a non-absolute URL; done means the Jest test runs without this error and retains its expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.