Skip to content

Missing helpers only throw once #10187

Description

@nicolo-ribaudo

Bug Report

Input Code

const input = ``;

const out = babel.transformSync(input, {
  configFile: false,
  plugins: [
    function() {
      return {
        visitor: {
          Program(path) {
            try {
              path.pushContainer("body", this.addHelper("fooBar"));
            } catch {}
            path.pushContainer("body", this.addHelper("fooBar"));
          },
        },
      };
    },
  ],
});

console.log(out.code);

Expected behavior/code
It should fail, because the second addHelper call should throw.

*Actual behavior

_fooBar

Environment

  • Babel version(s): 7.5.0
  • Node/npm version: [e.g. Node 8/npm 5]
  • OS: [e.g. OSX 10.13.4, Windows 10]
  • Monorepo: [e.g. yes/no/Lerna]
  • How you are using Babel: [e.g. cli, register, loader]

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions