Skip to content

Worker is not defined #3449

Closed
Closed
@patoncrispy

Description

@patoncrispy

Do you want to request a feature or report a bug?
A bug.

What is the current behavior?
When trying to test a web worker, the Worker constructor is throwing an error saying it is undefined.
Here is an example: https://repl.it/HdhL/0

What is the expected behavior?
The Worker constructor creates a new Web Worker.

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.

Jest Config:

"jest": {
    "globals": {
      "window": true
    },
    "testResultsProcessor": "./node_modules/jest-junit",
    "moduleFileExtensions": [
      "js"
    ],
    "moduleDirectories": [
      "node_modules"
    ],
    "moduleNameMapper": {
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
      "\\.(css|scss|html)$": "identity-obj-proxy"
    }
  }

Jest Version: 19.0.2
Yarn: 0.23.2
Windows 10 (w/ Creators Update)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions