babel: Upgrading from `@babel/parser@7.3.3` to `7.3.4` causes segfault/parser errors on Node 6
Bug Report
Current Behavior
Upgrading the Jest repo from @babel/parser@7.3.3
to @babel/parser@7.3.4
causes Node 6 to either seemingly stop transpiling (leading to syntax errors in every test) or just die with a segfault. I’ve spent most of today tweaking different versions in our lockfile to try to narrow down which version it regressed on, and I’m quite certain the issue is in 7.3.4
- I had 3 failures with it and 3 passes with 7.3.3
reverting between them with no other changes to the code.
You can see my adventure here: https://github.com/facebook/jest/pull/8014
Most of the time it just seemingly stops parsing correctly, but sometimes it leads to segfault. I’ve never seen it fail on node 8, 10 or 11.
Input Code
- REPL or Repo link if applicable: https://github.com/facebook/jest/pull/8011
You can see in that PR that the only change is using just @babel/parse@7.3.4
, and it fails CI. Upgrading @babel/core
as well makes no difference. CircleCI running Node 6 is the interesting CI - the other failures are either me cancelling builds or the CI provider cancelling redundant builds.
I’m sorry I’m not able to reduce it more - it happens locally for me as well on Node 6 (but not all the time) after a few minutes running the tests. Hopefully this is enough information for you to investigate. It’s at least isolated to a patch release of a single package.
Expected behavior/code I expect it to not fail 😃
Babel Configuration (.babelrc, package.json, cli command)
https://github.com/facebook/jest/blob/ae8280f7b009c141b81576171ee784d336d09800/babel.config.js
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
module.exports = {
babelrcRoots: ['examples/*'],
overrides: [
{
presets: ['@babel/preset-flow'],
test: '**/*.js',
},
{
plugins: [
'babel-plugin-typescript-strip-namespaces',
require.resolve(
'./scripts/babel-plugin-jest-replace-ts-export-assignment.js'
),
],
presets: ['@babel/preset-typescript'],
test: /\.tsx?$/,
},
],
plugins: [
['@babel/plugin-transform-modules-commonjs', {allowTopLevelThis: true}],
'@babel/plugin-transform-strict-mode',
],
presets: [
[
'@babel/preset-env',
{
shippedProposals: true,
targets: {node: 6},
},
],
],
};
Environment
- Babel version(s):
core@7.3.3
,parser@7.3.4
- Node/npm version: Node 6, yarn 1.13.0
- OS: macOS, but CI is Linux
- Monorepo: Yes, Yarn Workspaces
- How you are using Babel:
babel-jest
Additional context/Screenshots Stopped transpiling: https://circleci.com/gh/facebook/jest/54093 Segfault: https://circleci.com/gh/facebook/jest/54414
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 21 (19 by maintainers)
I will have a look. There weren’t that many changes between this two versions.
My guess is that the segfault is coming from jest which gets overwhelmed when thousands of tests fail. I experienced this (or at least similar behavior) also in babel when I make stupid changes that make every test explode.
Never the less will look into the Syntax errors.