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

Error: global leak detected: __core-js_shared__ #152

Closed
asimpletune opened this issue Nov 13, 2015 · 6 comments
Closed

Error: global leak detected: __core-js_shared__ #152

asimpletune opened this issue Nov 13, 2015 · 6 comments

Comments

@asimpletune
Copy link

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.

@zloirock
Copy link
Member

Expected behavior. zloirock/core-js#51

@robkorv
Copy link

robkorv commented Nov 14, 2015

This also happens when testing with lab.

The following leaks were detected:__core-js_shared__

I noticed that the library i need babel for ignores this error in it's own test.
https://github.com/jedireza/hapi-react-views/blob/d0529ad389c7c51d2c8b5d2d62870a02b8dae9ac/package.json#L7

@zloirock is ignoring the leak something you would recommend?

@CodisRedding
Copy link

@robkorv did you ever figure out the issue with lab?

@robkorv
Copy link

robkorv commented Apr 6, 2016

@FourQ, no I just ignored the error like hapi-react-views does in it's tests.

@CodisRedding
Copy link

@robkorv thanks, that's what I've been doing.

@miguelcobain
Copy link

me too

elhigu pushed a commit to knex/knex that referenced this issue Sep 26, 2018
* WIP changes

* Use Babel 7

* Fix build

* Fix Node 6 compatibility (apparently Babel has no idea how to transform Object.values)

* Try ignoring "expected behaviour" error (babel/babel-loader#152)

* Coverage dropped since less code gets generated now, time to revisit threshold
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants