@@ -71,46 +71,28 @@ You can also use it within the browser; install via npm and use the `chai.js` fi
71
71
Import the library in your code, and then pick one of the styles you'd like to use - either ` assert ` , ` expect ` or ` should ` :
72
72
73
73
``` 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
97
77
```
98
78
99
- ### Native Modules Usage ( _ registers the chai testing style globally _ )
79
+ ### Register the chai testing style globally
100
80
101
81
``` js
102
82
import ' chai/register-assert' ; // Using Assert style
103
83
import ' chai/register-expect' ; // Using Expect style
104
84
import ' chai/register-should' ; // Using Should style
105
85
```
106
86
107
- ### Native Modules Usage ( _ local import only _ )
87
+ ### Import assertion styles as local variables
108
88
109
89
``` js
110
90
import { assert } from ' chai' ; // Using Assert style
111
91
import { expect } from ' chai' ; // Using Expect style
112
92
import { should } from ' chai' ; // Using Should style
113
93
should (); // Modifies `Object.prototype`
94
+
95
+ import { expect , use } from ' chai' ; // Creates local variables `expect` and `use`; useful for plugin use
114
96
```
115
97
116
98
### Usage with Mocha
0 commit comments