Skip to content

Error: global leak detected: __core-js_shared__ #152

Closed
@asimpletune

Description

@asimpletune

Hi! I'm using babel-core/register in some tests that're run with mocha, and it seems to be complaining about a global leak from

mocha.before(function (done) {
      createEnvironment(function (err, newDir) {
        if (err) return done(err);
        dir = newDir;
        var onlyTranspileEs6 = require("babel-core/register");
        done();
      });
    });

But I get an error when I run the test

npm test

> [email protected] test /Users/Spencer/Developer/generator
> mocha --reporter spec --bail --check-leaks test/



  1) "before all" hook
  express(1)
    (no args)
    --es6
    --ejs
    --git
    -h
    --hbs
    --help


  0 passing (2s)
  1 failing

  1)  "before all" hook:
     Error: global leak detected: __core-js_shared__
      at test/cmd.js:134:9
      at ondir (test/cmd.js:493:5)
      at FSReqWrap.oncomplete (fs.js:95:15)



npm ERR! Test failed.  See above for more details.

To give you more context, Mocha creates a temporary directory for each test setup, and I'm calling require on babel-core/register just within the line of code that's testing my es6 case. It's important that I avoid transpiling code that shouldn't have any ES6 in it.

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