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

chai.use not working when using ES6 import #877

Closed
mir3z opened this issue Nov 30, 2016 · 1 comment
Closed

chai.use not working when using ES6 import #877

mir3z opened this issue Nov 30, 2016 · 1 comment

Comments

@mir3z
Copy link

mir3z commented Nov 30, 2016

Consider the following code

import { use, expect }  from "chai";
use(function (c) {
    console.warn(c.process.title) // echoes /usr/local/bin/node
});

So basically in this case I can't access chai.Assertion because global object goes as the first arguments to use.

This is most likely because use is defined as:

function (fn) {
  if (!~used.indexOf(fn)) {
    fn(this, util); // !!! this == global here
    used.push(fn);
  }

  return this;
}
@meeber
Copy link
Contributor

meeber commented Nov 30, 2016

@mir3z This is fixed per #724. It's available in the upcoming v4 release. A prerelease version is available through npm: chai@4.0.0-canary.1

@meeber meeber closed this as completed Nov 30, 2016
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

2 participants