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

istanbul ignore next is ignored after upgrade @babel/core from 7.5.5 to 7.6.0 #10432

Closed
mgrybyk opened this issue Sep 11, 2019 · 3 comments · Fixed by #10445
Closed

istanbul ignore next is ignored after upgrade @babel/core from 7.5.5 to 7.6.0 #10432

mgrybyk opened this issue Sep 11, 2019 · 3 comments · Fixed by #10445
Labels
Has PR i: bug i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@mgrybyk
Copy link

mgrybyk commented Sep 11, 2019

Bug Report

Current Behavior
After upgrade @babel/core from 7.5.5 to 7.6.0 jest --coverage ignores /* istanbul ignore next */

Input Code

  1. clone https://github.com/webdriverio/webdriverio
  2. remove node_modules and package-lock.json
  3. set @babel/core version to 7.6.0
  4. npm install
  5. run node_modules/.bin/jest --clearCache ; node_modules/.bin/jest packages/wdio-sync

Actual Result:
executeHooksWithArgs in executeHooksWithArgs.js is NOT ignored which means that /* istanbul ignore next */ is ignored

NOTE:
if you repeat steps from 1 to 5 but set @babel/core version to 7.5.5 executeHooksWithArgs in executeHooksWithArgs.js will be ignored, which means the issue is regression since @babel/core version 7.5.5

Expected behavior/code
/* istanbul ignore next */ should be taken into account

Babel Configuration (.babelrc, package.json, cli command)

https://github.com/webdriverio/webdriverio/blob/master/babel.config.js

Environment

  • Babel version(s): @babel/core 7.6.0
  • Node/npm version: Node 10 / npm 6.9.0
  • OS: OSX 10.3.6 / Ubuntu Xenial
  • Monorepo: lerna

Possible Solution

Additional context/Screenshots
@babel/core 7.6.0
image

@babel/core 7.5.5
image

@babel-bot
Copy link
Collaborator

Hey @mgrybyk! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

@s100
Copy link

s100 commented Sep 16, 2019

It seems as if this is a parsing problem which occurs when the previous line ends with a close-parenthesis. We saw this issue with code looking like:

const socket = socketClient(address)
/* istanbul ignore next */
socket.on('connect', function () {
  debug('Connected to ' + address)
})

where the /* istanbul ignore next */ was not taking effect. We were able to get it to take effect by adding a semicolon to the end of the previous line:

const socket = socketClient(address);
/* istanbul ignore next */
socket.on('connect', function () {
  debug('Connected to ' + address)
})

Of course, now our linter, which is configured to disallow semicolons at the end of lines, gets upset, so we also need a little linter configuration:

/* eslint semi: off */

// ...

const socket = socketClient(address);
/* istanbul ignore next */
socket.on('connect', function () {
  debug('Connected to ' + address)
})

This is only a workaround.

@nicolo-ribaudo
Copy link
Member

I'm working on this. It has been introduced by #10380

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Dec 23, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Dec 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Has PR i: bug i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants