Skip to content

Commit 082c7e2

Browse files
author
Kristján Oddsson
authored
Update README.md
1 parent c245af1 commit 082c7e2

File tree

1 file changed

+7
-25
lines changed

1 file changed

+7
-25
lines changed

README.md

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -71,46 +71,28 @@ You can also use it within the browser; install via npm and use the `chai.js` fi
7171
Import the library in your code, and then pick one of the styles you'd like to use - either `assert`, `expect` or `should`:
7272

7373
```js
74-
var chai = require('chai');
75-
var assert = chai.assert; // Using Assert style
76-
var expect = chai.expect; // Using Expect style
77-
var should = chai.should(); // Using Should style
78-
```
79-
80-
### Pre-Native Modules Usage (_registers the chai testing style globally_)
81-
82-
```js
83-
require('chai/register-assert'); // Using Assert style
84-
require('chai/register-expect'); // Using Expect style
85-
require('chai/register-should'); // Using Should style
86-
```
87-
88-
### Pre-Native Modules Usage (_as local variables_)
89-
90-
```js
91-
const { assert } = require('chai'); // Using Assert style
92-
const { expect } = require('chai'); // Using Expect style
93-
const { should } = require('chai'); // Using Should style
94-
should(); // Modifies `Object.prototype`
95-
96-
const { expect, use } = require('chai'); // Creates local variables `expect` and `use`; useful for plugin use
74+
import { assert } from 'chai'; // Using Assert style
75+
import { expect } from 'chai'; // Using Expect style
76+
import { should } from 'chai'; // Using Should style
9777
```
9878

99-
### Native Modules Usage (_registers the chai testing style globally_)
79+
### Register the chai testing style globally
10080

10181
```js
10282
import 'chai/register-assert'; // Using Assert style
10383
import 'chai/register-expect'; // Using Expect style
10484
import 'chai/register-should'; // Using Should style
10585
```
10686

107-
### Native Modules Usage (_local import only_)
87+
### Import assertion styles as local variables
10888

10989
```js
11090
import { assert } from 'chai'; // Using Assert style
11191
import { expect } from 'chai'; // Using Expect style
11292
import { should } from 'chai'; // Using Should style
11393
should(); // Modifies `Object.prototype`
94+
95+
import { expect, use } from 'chai'; // Creates local variables `expect` and `use`; useful for plugin use
11496
```
11597

11698
### Usage with Mocha

0 commit comments

Comments
 (0)