test: add regex for expected error message
Provide a regex to validate the error message. PR-URL: https://github.com/nodejs/node/pull/12011 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
This commit is contained in:
parent
1377d5ac2e
commit
c13dda1c43
@ -29,6 +29,8 @@ if (!common.hasCrypto) {
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const tls = require('tls');
|
const tls = require('tls');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const errorMessageRegex = new RegExp('^Error: error:0B080074:x509 ' +
|
||||||
|
'certificate routines:X509_check_private_key:key values mismatch$');
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
|
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
|
||||||
@ -37,4 +39,4 @@ const options = {
|
|||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
tls.createSecureContext(options);
|
tls.createSecureContext(options);
|
||||||
});
|
}, errorMessageRegex);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user