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

Missing helpers only throw once #10187

Closed
nicolo-ribaudo opened this issue Jul 9, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@nicolo-ribaudo
Copy link
Member

commented Jul 9, 2019

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]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.