Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSDOM configuration issue #5578

Closed
valeriimars opened this issue Feb 15, 2018 · 4 comments
Closed

JSDOM configuration issue #5578

valeriimars opened this issue Feb 15, 2018 · 4 comments

Comments

@valeriimars
Copy link

valeriimars commented Feb 15, 2018

JSDOM configuration issue

I'm Running jest tests in jsdom environment and keep getting following error.

TypeError: require(...).evalVMScript is not a function

The same setup works with --env=node so it seems that the problem is with JSDOM itself.

.babelrc

{
  "presets": ["es2015", "react", "stage-2"]
}

package.json

"jest": {
    "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)$": "identity-obj-proxy"
    },
    "modulePaths": [
      "<rootDir>/app_root/"
    ],
    "testEnvironment": "jsdom"
  }

Test

import React from 'react';
import {shallow} from 'enzyme';

test("Test", () => {
  expect(true).toBe(true);
});

Setup:

React: 15.5.4

jest: v22.2.2
babel-jest: 22.0.3
npm: 5.6.0
node: v9.4.0
@rickhanlonii
Copy link
Member

Example code runs fine for me (example repo here).

I've seen this happen though if you have multiple versions of JSDOM installed.

Since this issue tracker isn't a help fourm, I'm happy to help more StackOverflow or our discord channel

@SimenB
Copy link
Member

SimenB commented Feb 16, 2018

@tsoyviktor please provide a full repro if you believe this to be a bug.

@valeriimars
Copy link
Author

The problem was with a scoped dependency @babel/code-frame.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants