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

Load expect with chai/expect #716

Closed
ghost opened this issue May 31, 2016 · 2 comments
Closed

Load expect with chai/expect #716

ghost opened this issue May 31, 2016 · 2 comments

Comments

@ghost
Copy link

ghost commented May 31, 2016

Could expect have the same behavior of should here?

The possibility to use:

  • import { expect } from 'chai'
  • import expect from 'chai/expect'
@meeber
Copy link
Contributor

meeber commented May 31, 2016

Hi @llfm.

With proper transpiling, this should already work:

import { expect } from 'chai'

Edit: I should add that the purpose of the issue you linked is that, unlike expect, should requires modifications to Object.prototype, which are performed by calling should() after importing it. Therefore, the import chai/should form was added as a shortcut to condense the two steps of importing should + running should() into one step.

@keithamus
Copy link
Member

@llfm see my comment here for a complete list of available syntaxes (as of the upcoming 4.0.0 release):

// Plugin-less
import { expect } from 'chai'
import { assert } from 'chai'
import 'chai/should'
// if you need should.exist/should.fail etc:
import should from 'chai/should'

// With plugins
import chai from 'chai';
import somePlugin from 'some-plugin';
const expect = chai.use(somePlugin).expect

import chai from 'chai';
import somePlugin from 'some-plugin';
const assert = chai.use(somePlugin).assert

import chai from 'chai';
import somePlugin from 'some-plugin';
const should = chai.use(somePlugin).should()

@meeber meeber closed this as completed Jun 1, 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