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

Add script that registers expect as a side-effect #868

Merged
merged 6 commits into from
Nov 17, 2016
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,28 @@ var expect = chai.expect;
var should = chai.should();
```

## Usage for ES6+
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be named "Native Modules Usage" or something like that. "Usage for ES6" sounds a bit strong and makes it look like its the only way to use it in ES6.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I updated it like you suggested:


```js
// Using Assert style
import assert from 'chai/assert'
// Using Expect style
import expect from 'chai/expect'
// Using Should style
import should from 'chai/should'
```

## Usage with Mocha

```bash
# Using Assert style
mocha spec.js -r chai/assert # OR:
# Using Expect style
mocha spec.js -r chai/expect # OR:
# Using Should style
mocha spec.js -r chai/should
```

[Read more about these styles in our docs](http://chaijs.com/guide/styles/).

## Plugins
Expand Down
1 change: 1 addition & 0 deletions assert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global.assert = module.exports = require('./').assert;
1 change: 1 addition & 0 deletions expect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global.expect = module.exports = require('./').expect;
2 changes: 1 addition & 1 deletion should.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./').should();
global.should = module.exports = require('./').should();