@@ -326,7 +326,7 @@ rejected. See [`assert.rejects()`][] for more details.
326
326
When ` assert.doesNotReject() ` is called, it will immediately call the ` block `
327
327
function, and awaits for completion.
328
328
329
- Besides the async nature to await the completion behaves identical to
329
+ Besides the async nature to await the completion behaves identically to
330
330
[ ` assert.doesNotThrow() ` ] [ ] .
331
331
332
332
``` js
@@ -844,40 +844,6 @@ assert(0);
844
844
// assert(0)
845
845
```
846
846
847
- ## assert.strictEqual(actual, expected[ , message] )
848
- <!-- YAML
849
- added: v0.1.21
850
- changes:
851
- - version: REPLACEME
852
- pr-url: https://github.com/nodejs/node/pull/17003
853
- description: Used comparison changed from Strict Equality to `Object.is()`
854
- -->
855
- * ` actual ` {any}
856
- * ` expected ` {any}
857
- * ` message ` {any}
858
-
859
- Tests strict equality between the ` actual ` and ` expected ` parameters as
860
- determined by the [ SameValue Comparison] [ ] .
861
-
862
- ``` js
863
- const assert = require (' assert' ).strict ;
864
-
865
- assert .strictEqual (1 , 2 );
866
- // AssertionError: 1 strictEqual 2
867
-
868
- assert .strictEqual (1 , 1 );
869
- // OK
870
-
871
- assert .strictEqual (1 , ' 1' );
872
- // AssertionError: 1 strictEqual '1'
873
- ```
874
-
875
- If the values are not strictly equal, an ` AssertionError ` is thrown with a
876
- ` message ` property set equal to the value of the ` message ` parameter. If the
877
- ` message ` parameter is undefined, a default error message is assigned. If the
878
- ` message ` parameter is an instance of an [ ` Error ` ] [ ] then it will be thrown
879
- instead of the ` AssertionError ` .
880
-
881
847
## assert.rejects(block[ , error] [ , message ] )
882
848
<!-- YAML
883
849
added: REPLACEME
@@ -891,7 +857,7 @@ Awaits for promise returned by function `block` to be rejected.
891
857
When ` assert.rejects() ` is called, it will immediately call the ` block `
892
858
function, and awaits for completion.
893
859
894
- Besides the async nature to await the completion behaves identical to
860
+ Besides the async nature to await the completion behaves identically to
895
861
[ ` assert.throws() ` ] [ ] .
896
862
897
863
If specified, ` error ` can be a constructor, [ ` RegExp ` ] [ ] , a validation
@@ -920,6 +886,40 @@ assert.rejects(
920
886
});
921
887
```
922
888
889
+ ## assert.strictEqual(actual, expected[ , message] )
890
+ <!-- YAML
891
+ added: v0.1.21
892
+ changes:
893
+ - version: REPLACEME
894
+ pr-url: https://github.com/nodejs/node/pull/17003
895
+ description: Used comparison changed from Strict Equality to `Object.is()`
896
+ -->
897
+ * ` actual ` {any}
898
+ * ` expected ` {any}
899
+ * ` message ` {any}
900
+
901
+ Tests strict equality between the ` actual ` and ` expected ` parameters as
902
+ determined by the [ SameValue Comparison] [ ] .
903
+
904
+ ``` js
905
+ const assert = require (' assert' ).strict ;
906
+
907
+ assert .strictEqual (1 , 2 );
908
+ // AssertionError: 1 strictEqual 2
909
+
910
+ assert .strictEqual (1 , 1 );
911
+ // OK
912
+
913
+ assert .strictEqual (1 , ' 1' );
914
+ // AssertionError: 1 strictEqual '1'
915
+ ```
916
+
917
+ If the values are not strictly equal, an ` AssertionError ` is thrown with a
918
+ ` message ` property set equal to the value of the ` message ` parameter. If the
919
+ ` message ` parameter is undefined, a default error message is assigned. If the
920
+ ` message ` parameter is an instance of an [ ` Error ` ] [ ] then it will be thrown
921
+ instead of the ` AssertionError ` .
922
+
923
923
## assert.throws(block[ , error] [ , message ] )
924
924
<!-- YAML
925
925
added: v0.1.21
@@ -1051,12 +1051,13 @@ second argument. This might lead to difficult-to-spot errors.
1051
1051
[ `WeakSet` ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet
1052
1052
[ `assert.deepEqual()` ] : #assert_assert_deepequal_actual_expected_message
1053
1053
[ `assert.deepStrictEqual()` ] : #assert_assert_deepstrictequal_actual_expected_message
1054
+ [ `assert.doesNotThrow()` ] : #assert_assert_doesnotthrow_block_error_message
1054
1055
[ `assert.notDeepStrictEqual()` ] : #assert_assert_notdeepstrictequal_actual_expected_message
1055
1056
[ `assert.notStrictEqual()` ] : #assert_assert_notstrictequal_actual_expected_message
1056
1057
[ `assert.ok()` ] : #assert_assert_ok_value_message
1058
+ [ `assert.rejects()` ] : #assert_assert_rejects_block_error_message
1057
1059
[ `assert.strictEqual()` ] : #assert_assert_strictequal_actual_expected_message
1058
1060
[ `assert.throws()` ] : #assert_assert_throws_block_error_message
1059
- [ `assert.rejects()` ] : #assert_assert_rejects_block_error_message
1060
1061
[ `strict mode` ] : #assert_strict_mode
1061
1062
[ Abstract Equality Comparison ] : https://tc39.github.io/ecma262/#sec-abstract-equality-comparison
1062
1063
[ Object.prototype.toString() ] : https://tc39.github.io/ecma262/#sec-object.prototype.tostring
0 commit comments