From c65de59f526bc8d8f6681ec79f49f09ece1cc600 Mon Sep 17 00:00:00 2001 From: "John F. Mercer" Date: Thu, 23 Mar 2017 19:07:58 -0400 Subject: [PATCH] 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 Reviewed-By: Rich Trott Reviewed-By: Yuta Hiroto Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius Reviewed-By: Colin Ihrig Reviewed-By: Franziska Hinkelmann --- test/parallel/test-tls-key-mismatch.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-tls-key-mismatch.js b/test/parallel/test-tls-key-mismatch.js index 65cac6f07a296c..93c7e70d8c61f7 100644 --- a/test/parallel/test-tls-key-mismatch.js +++ b/test/parallel/test-tls-key-mismatch.js @@ -8,6 +8,8 @@ if (!common.hasCrypto) { const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); +const errorMessageRegex = new RegExp('^Error: error:0B080074:x509 ' + + 'certificate routines:X509_check_private_key:key values mismatch$'); const options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), @@ -16,4 +18,4 @@ const options = { assert.throws(function() { tls.createSecureContext(options); -}); +}, errorMessageRegex);