-
Notifications
You must be signed in to change notification settings - Fork 624
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(node/assert): enable test-assert-fail.js and align assert.fail to…
… it (#874) Co-authored-by: Yoshiya Hinosawa <[email protected]>
- Loading branch information
Showing
3 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// deno-fmt-ignore-file | ||
// deno-lint-ignore-file | ||
|
||
// Copyright Joyent and Node contributors. All rights reserved. MIT license. | ||
// Taken from Node 15.5.1 | ||
// This file is automatically generated by "node/_tools/setup.ts". Do not modify this file manually | ||
|
||
'use strict'; | ||
|
||
require('../common'); | ||
const assert = require('assert'); | ||
|
||
// No args | ||
assert.throws( | ||
() => { assert.fail(); }, | ||
{ | ||
code: 'ERR_ASSERTION', | ||
name: 'AssertionError', | ||
message: 'Failed', | ||
operator: 'fail', | ||
actual: undefined, | ||
expected: undefined, | ||
generatedMessage: true, | ||
stack: /Failed/ | ||
} | ||
); | ||
|
||
// One arg = message | ||
assert.throws(() => { | ||
assert.fail('custom message'); | ||
}, { | ||
code: 'ERR_ASSERTION', | ||
name: 'AssertionError', | ||
message: 'custom message', | ||
operator: 'fail', | ||
actual: undefined, | ||
expected: undefined, | ||
generatedMessage: false | ||
}); | ||
|
||
// One arg = Error | ||
assert.throws(() => { | ||
assert.fail(new TypeError('custom message')); | ||
}, { | ||
name: 'TypeError', | ||
message: 'custom message' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters