question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bumping @babel/preset-env from 7.12.1 to 7.12.7 breaks tests (jest)

See original GitHub issue

Bug Report

  • I would like to work on a fix!

Current behavior

Bumping @babel/preset-env from 7.12.1 to 7.12.7 breaks tests

Nullish coalescing and optional chaining operator are not parsed anymore.

Input Code

Example:

const getElement = container => container?.firstChild;

Expected behavior

To transform correctly

Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)

  • Filename: package.json#babel
  "babel": {
    "presets": [
      "@babel/preset-env",
      [
        "@babel/preset-react",
        {
          "runtime": "automatic"
        }
      ]
    ]
  }

Environment

  System:
    OS: macOS 11.0.1
  Binaries:
    Node: 12.19.0 - ~/.nvm/versions/node/v12.19.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.8 - ~/.nvm/versions/node/v12.19.0/bin/npm
  npmPackages:
    @babel/core: ^7.12.8 => 7.12.8
    @babel/preset-env: ^7.12.7 => 7.12.7
    @babel/preset-react: ^7.12.7 => 7.12.7
    babel-jest: ^26.6.3 => 26.6.3
    eslint: ^7.14.0 => 7.14.0
    jest: ^26.6.3 => 26.6.3

Possible Solution

  • Maybe enabling these features is required in the babel config but I would not expect that since it works before bumping patch version.
  • Maybe babel-jest is ignoring babel config

Additional context

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nicolo-ribaudocommented, Nov 24, 2020

Sure!

0reactions
wachuneicommented, Nov 24, 2020

I did not use environment keys in my package.json@browserslist config because it was not being picked up correctly by parcel@v1. I resolved to upgrade to use node 14 for development. Thank you for the help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started - Jest
You just successfully wrote your first test using Jest! This test used expect and toBe to test that two values were exactly identical....
Read more >
How to Use `import.meta` When Testing With Jest
I found the currently best solution is to use babel-plugin-transform-import-meta. That simple plugin replaces the import.meta.url syntax with Node.js code ...
Read more >
php-parser - Projects - FOSSA
... dependabot/npm_and_yarn/babel/preset-env-7.12.1 ... test-call; test-continue-break; test-curly-offsetlookup; test-heredoc-and-nowdoc; test-magic-node ...
Read more >
Mender server
fix CVEs rebuilding using the latest workflows:master; Update mender-artifact tool to latest. Dependency updates. Aggregated Dependabot Changelogs: Bumps github ...
Read more >
jest encountered an unexpected token uuid - You.com | The AI ...
Out of the box Jest supports Babel, which will be used to transform your files ... the Angular Jest Preset docs seems to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found