-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/util: use internal/errors.js
PR-URL: #11301 Refs: #11273 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
- Loading branch information
Showing
4 changed files
with
16 additions
and
7 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
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 |
---|---|---|
@@ -1,14 +1,16 @@ | ||
// Flags: --expose-internals | ||
'use strict'; | ||
require('../common'); | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const util = require('internal/util'); | ||
|
||
const expectedError = common.expectsError({ | ||
code: 'ERR_NO_CRYPTO', | ||
type: Error | ||
}); | ||
|
||
if (!process.versions.openssl) { | ||
assert.throws( | ||
() => util.assertCrypto(), | ||
/^Error: Node\.js is not compiled with openssl crypto support$/ | ||
); | ||
assert.throws(() => util.assertCrypto(), expectedError); | ||
} else { | ||
assert.doesNotThrow(() => util.assertCrypto()); | ||
} |