@locustjs/test 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,7 @@ npm i @locustjs/test
8
8
 
9
9
  ## Current Version
10
10
  ```
11
- 2.0.0
11
+ 2.0.2
12
12
  ```
13
13
 
14
14
  # Usage
@@ -16,9 +16,9 @@ npm i @locustjs/test
16
16
  import { TestRunner } from '@locustjs/test';
17
17
 
18
18
  const tests = [
19
- ['test 1', expect => expect(2 + 2).toBe(4)],
20
- ['test 2', expect => expect(undefined).toBeUndefined()],
21
- ['test 3', expect => expect(5).toBeGt(10)], // this test fails
19
+ ['test 1', () => expect(2 + 2).toBe(4)],
20
+ ['test 2', () => expect(undefined).toBeUndefined()],
21
+ ['test 3', () => expect(5).toBeGt(10)], // this test fails
22
22
  ...
23
23
  ];
24
24
 
@@ -48,7 +48,7 @@ Sample output:
48
48
  <div style="color:gray; margin-left: 50px">error 501: test 'Test 7: error' failed.</div>
49
49
  <div style="color:yellow; margin-left: 50px">10 is not greater than 20</div>
50
50
 
51
- 8. <b>Test 8: not expected:</b> <span style="color:magenta">expect not used</span> (0 sec)
51
+ 8. <b>Test 8: not satisfied:</b> <span style="color:magenta">expect not used</span> (0 sec)
52
52
 
53
53
  9. <b>Test 9: error without expect:</b> <span style="color:yellow">faulted</span> (0 sec)
54
54
  <div style="color:gray; margin-left: 50px">error 501: test 'Test 9: error without expect' failed.</div>
@@ -71,6 +71,19 @@ Sample output:
71
71
 
72
72
  Pay attention: `TestRunner` runs test simultaneously. Thus, tests should not have side-effects.
73
73
 
74
+ ## Various examples:
75
+ ```javascript
76
+ import { Test, TestRunner } from '@locustjs/test';
77
+
78
+ const t1 = new Test('test 1', () => expect(2 + 2).toBe(4));
79
+ const t2 = () => expect(2 + 2).toBe(4);
80
+ const t3 = [t1]
81
+ const t4 = [t1, t2]
82
+ const t5 = ['test 5', () => expect(2 + 2).toBe(4)]
83
+
84
+ TestRunner.start(t1, t2, t3, t4, t5)
85
+ ```
86
+
74
87
  ## expect
75
88
  Positive
76
89
  - `toBe(value)`
@@ -152,7 +165,7 @@ Negative
152
165
  - `async notToThrowAsync(ex, shape = false, strict = false)`
153
166
  - `notToBeNaN()`
154
167
 
155
- ## Qucik Testing
168
+ ## Quick Testing
156
169
 
157
170
  `TestRunner` has a static method `start()` that simplifies running tests.
158
171
 
@@ -174,13 +187,13 @@ import tests3 from './test3.js'
174
187
  TestRunner.start(tests1, tests2, tests3);
175
188
  ```
176
189
 
177
- The above example is equal to merging all tests arrays and pass one array to `start()`.
190
+ The above example is equal to merging all tests and pass one array to `start()`.
178
191
 
179
192
  ```javascript
180
193
  TestRunner.start([...tests1, ...tests2, ...tests3])
181
194
  ```
182
195
 
183
- By default, test runner shows detailed output only when there is at least one error. However, by passing `true` as the last argument of `start()` method, we can ask the detailed output is always shows.
196
+ By default, test runner shows detailed output only when there is at least one error. However, by passing `true` as the last argument of `start()` method, we can ask the detailed output to be always shown.
184
197
 
185
198
  ```javascript
186
199
  TestRunner.start(tests, true);