Skip to content

Jest hangs indefinitely using external jsdom #2288

@EnoahNetzach

Description

@EnoahNetzach

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

A bug.

What is the current behavior?

Running tests with jsdom.jsdom(undefined, { url: URL }) hangs indefinitely.
If the CLI var --env=jsdom is provided, the number of tests in one single file that can use jsdom grows to ~12 (but this could be machine-dependent), but adding one additional test makes it hang once again.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal repository on GitHub that we can npm install and npm test.

git clone https://github.com/EnoahNetzach/jsdom-server-test, then follow the instructions on its README.

A real-life example is facebook/create-react-app#1187.

What is the expected behavior?

It shouldn't hang.

Run Jest again with --debug and provide the full configuration it prints. Please mention your node and npm version and operating system.

  • uname -mrs: Linux 4.8.8-200.fc24.x86_64 x86_64
  • npm --version: 3.10.8
  • node --version: v6.9.1
  • jest config:
{
  "collectCoverageFrom": [
    "src/**/*.{js,jsx}"
  ],
  "setupFiles": [
    "/home/netzach/Develop/jest-jsdom/node_modules/react-scripts/config/polyfills.js"
  ],
  "testPathIgnorePatterns": [
    "/home/netzach/Develop/jest-jsdom[/\\\\](build|docs|node_modules)[/\\\\]"
  ],
  "testEnvironment": "/home/netzach/Develop/jest-jsdom/node_modules/jest-environment-node/build/index.js",
  "testURL": "http://localhost",
  "transform": [
    [
      "^.+\\.(js|jsx)$",
      "/home/netzach/Develop/jest-jsdom/node_modules/react-scripts/config/jest/babelTransform.js"
    ],
    [
      "^.+\\.css$",
      "/home/netzach/Develop/jest-jsdom/node_modules/react-scripts/config/jest/cssTransform.js"
    ],
    [
      "^(?!.*\\.(js|jsx|css|json)$)",
      "/home/netzach/Develop/jest-jsdom/node_modules/react-scripts/config/jest/fileTransform.js"
    ]
  ],
  "transformIgnorePatterns": [
    "[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
  ],
  "moduleNameMapper": [
    [
      "^react-native$",
      "react-native-web"
    ]
  ],
  "rootDir": "/home/netzach/Develop/jest-jsdom",
  "name": "-home-netzach-Develop-jest-jsdom",
  "testRunner": "/home/netzach/Develop/jest-jsdom/node_modules/jest-jasmine2/build/index.js",
  "automock": false,
  "bail": false,
  "browser": false,
  "cacheDirectory": "/tmp/jest",
  "coveragePathIgnorePatterns": [
    "/node_modules/"
  ],
  "coverageReporters": [
    "json",
    "text",
    "lcov",
    "clover"
  ],
  "expand": false,
  "globals": {},
  "haste": {
    "providesModuleNodeModules": []
  },
  "mocksPattern": "__mocks__",
  "moduleDirectories": [
    "node_modules"
  ],
  "moduleFileExtensions": [
    "js",
    "json",
    "jsx",
    "node"
  ],
  "modulePathIgnorePatterns": [],
  "noStackTrace": false,
  "notify": false,
  "preset": null,
  "resetMocks": false,
  "resetModules": false,
  "snapshotSerializers": [],
  "testPathDirs": [
    "/home/netzach/Develop/jest-jsdom"
  ],
  "testRegex": "(/__tests__/.*|\\.(test|spec))\\.jsx?$",
  "timers": "real",
  "useStderr": false,
  "verbose": null,
  "watch": false,
  "cache": true,
  "watchman": true
}

I'm not entirely sure this is a jest bug.
It could be a jsdom one, although I can reproduce this only with jest.

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