Version

29.1.2

Steps to reproduce

  1. Place somewhere 2 files:
  • package.json:
{
  "dependencies": {
    "@babel/core": "^7.19.3",
    "@babel/preset-env": "^7.19.3",
    "babel-jest": "^29.1.2",
    "jest": "^29.1.2",
    "parsinator": "2.1.2"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "jsx"
    ],
    "moduleDirectories": [
      "node_modules"
    ],
    "transform": {
      "\\.[jt]sx?$": "babel-jest"
    },
    "transformIgnorePatterns": [],
    "verbose": false
  },
  "babel": {
    "env": {
      "test": {
        "plugins": [
          "@babel/plugin-transform-modules-commonjs"
        ]
      }
    }
  }
}
  • jest.test.js:
import Parsinator from 'parsinator';
  1. npm install
  2. npx jest

Expected behavior

No errors, all fine

Actual behavior

    export { ParseError, VERSION, between, buildExpressionParser, choice, count, debugTrace, end, fail, fromGenerator, many, many1, map, maybe, peek, regex, regexMatch, run, runToEnd, sepBy, sepBy1, sequence, str, surround, until, wrapFail };
    ^^^^^^

    SyntaxError: Unexpected token 'export'

    > 1 | import Parsinator from 'parsinator';
        | ^
      2 |

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1678:14)
      at Object.<anonymous> (jest.test.js:1:1)

Additional context

Tried "transformIgnorePatterns": ["^$"],, "transform": {".*": "babel-jest"} whatever doesn't work

Environment

OS: Linux KDE Neon 5.25 (20.04)
CPU: x86_64
Node: 16.17.1
npm: 8.15.0
1

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

0
© 2022 pullanswer.com - All rights reserved.