summaryrefslogtreecommitdiff
path: root/test/parallel/test-assert-fail.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-assert-fail.js')
-rw-r--r--test/parallel/test-assert-fail.js85
1 files changed, 40 insertions, 45 deletions
diff --git a/test/parallel/test-assert-fail.js b/test/parallel/test-assert-fail.js
index 99f7c4e3da..12cff99e66 100644
--- a/test/parallel/test-assert-fail.js
+++ b/test/parallel/test-assert-fail.js
@@ -17,57 +17,52 @@ assert.throws(
);
// One arg = message
-assert.throws(
- () => { assert.fail('custom message'); },
- common.expectsError({
- code: 'ERR_ASSERTION',
- type: assert.AssertionError,
- message: 'custom message',
- operator: undefined,
- actual: undefined,
- expected: undefined
- })
-);
+common.expectsError(() => {
+ assert.fail('custom message');
+}, {
+ code: 'ERR_ASSERTION',
+ type: assert.AssertionError,
+ message: 'custom message',
+ operator: undefined,
+ actual: undefined,
+ expected: undefined
+});
// Two args only, operator defaults to '!='
-assert.throws(
- () => { assert.fail('first', 'second'); },
- common.expectsError({
- code: 'ERR_ASSERTION',
- type: assert.AssertionError,
- message: '\'first\' != \'second\'',
- operator: '!=',
- actual: 'first',
- expected: 'second'
-
- })
-);
+common.expectsError(() => {
+ assert.fail('first', 'second');
+}, {
+ code: 'ERR_ASSERTION',
+ type: assert.AssertionError,
+ message: '\'first\' != \'second\'',
+ operator: '!=',
+ actual: 'first',
+ expected: 'second'
+});
// Three args
-assert.throws(
- () => { assert.fail('ignored', 'ignored', 'another custom message'); },
- common.expectsError({
- code: 'ERR_ASSERTION',
- type: assert.AssertionError,
- message: 'another custom message',
- operator: undefined,
- actual: 'ignored',
- expected: 'ignored'
- })
-);
+common.expectsError(() => {
+ assert.fail('ignored', 'ignored', 'another custom message');
+}, {
+ code: 'ERR_ASSERTION',
+ type: assert.AssertionError,
+ message: 'another custom message',
+ operator: undefined,
+ actual: 'ignored',
+ expected: 'ignored'
+});
// No third arg (but a fourth arg)
-assert.throws(
- () => { assert.fail('first', 'second', undefined, 'operator'); },
- common.expectsError({
- code: 'ERR_ASSERTION',
- type: assert.AssertionError,
- message: '\'first\' operator \'second\'',
- operator: 'operator',
- actual: 'first',
- expected: 'second'
- })
-);
+common.expectsError(() => {
+ assert.fail('first', 'second', undefined, 'operator');
+}, {
+ code: 'ERR_ASSERTION',
+ type: assert.AssertionError,
+ message: '\'first\' operator \'second\'',
+ operator: 'operator',
+ actual: 'first',
+ expected: 'second'
+});
// The stackFrameFunction should exclude the foo frame
assert.throws(