Skip to content

[regression] [5.1.2] variable override #201

@pi0

Description

@pi0

This issue introduced with 5.1.2 (5.1.1 and below are fine)

Reproduction repo: https://github.com/pi0/babel-plugin-istanbul-bug (Use yarn test)

Reverting this change by #192 fixes problem.

Details

When using @babel/preset-env:

import path from 'path'

function test() {
  const _path = 'test'
  return path.relative(__dirname, _path)
}

Transpiles into: (Correct)

var _path2 = _interopRequireDefault(require("path"));

function test() {
  const _path = 'test';
  return _path2.default.relative(__dirname, _path);
}

Using babel-plugin-istanbul@5.1.2: (Bug)

var _path = _interopRequireDefault(require("path"));

function test() {
  cov_1523mz691.f[0]++;

  const _path = (cov_1523mz691.s[0]++, 'test');

  cov_1523mz691.s[1]++;
  return _path.default.relative(__dirname, _path);
}

Using babel-plugin-istanbul@5.1.1 (Correct)

var _path2 = _interopRequireDefault(require("path"));

function test() {
  cov_1523mz691.f[0]++;

  const _path = (cov_1523mz691.s[0]++, 'test');

  cov_1523mz691.s[1]++;
  return _path2.default.relative(__dirname, _path);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy