From 0bd0d52af6fa9f79cd6b04b9b162624ea54c145b Mon Sep 17 00:00:00 2001 From: thelady Date: Sat, 22 Apr 2017 13:43:43 -0700 Subject: [PATCH] test: replace assertion error check with regex PR-URL: https://github.com/nodejs/node/pull/12603 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann Reviewed-By: Alexey Orlenko Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Santiago Gimeno Reviewed-By: Gibson Fahnestock --- test/parallel/test-v8-flag-type-check.js | 6 ++++-- test/parallel/test-v8-flags.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-v8-flag-type-check.js b/test/parallel/test-v8-flag-type-check.js index b5d4d7c2f12665..144e8f7a2e3d07 100644 --- a/test/parallel/test-v8-flag-type-check.js +++ b/test/parallel/test-v8-flag-type-check.js @@ -3,5 +3,7 @@ require('../common'); const assert = require('assert'); const v8 = require('v8'); -assert.throws(function() { v8.setFlagsFromString(1); }, TypeError); -assert.throws(function() { v8.setFlagsFromString(); }, TypeError); +assert.throws(function() { v8.setFlagsFromString(1); }, + /^TypeError: v8 flag must be a string$/); +assert.throws(function() { v8.setFlagsFromString(); }, + /^TypeError: v8 flag is required$/); diff --git a/test/parallel/test-v8-flags.js b/test/parallel/test-v8-flags.js index 99384080516bb2..50d7047a5ddfa9 100644 --- a/test/parallel/test-v8-flags.js +++ b/test/parallel/test-v8-flags.js @@ -12,5 +12,7 @@ assert(eval('%_IsSmi(42)')); assert(vm.runInThisContext('%_IsSmi(43)')); v8.setFlagsFromString('--noallow_natives_syntax'); -assert.throws(function() { eval('%_IsSmi(44)'); }, SyntaxError); -assert.throws(function() { vm.runInThisContext('%_IsSmi(45)'); }, SyntaxError); +assert.throws(function() { eval('%_IsSmi(44)'); }, + /^SyntaxError: Unexpected token %$/); +assert.throws(function() { vm.runInThisContext('%_IsSmi(45)'); }, + /^SyntaxError: Unexpected token %$/);