Skip to content

jest-environment-jsdom 28+ tries to use browser exports instead of default exports #300

@alex-l-miro

Description

@alex-l-miro

Describe the bug
jest-environment-jsdom v28+ tries to use browser exports instead of default exports which generates the following error when Jest testEnvironment: 'jsdom':

Jest encountered an unexpected token
  
      Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.

To Reproduce
Steps to reproduce the behavior:

  1. git clone https://github.com/alex-l-miro/react-hook-bug.git
  2. yarn
  3. yarn test

Expected behavior
Jest should not fail when testEnvironment is jsdom

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions