Browse Source

test: validate full error messages

test: changed test2 of test-vm-timeout.js so that entire error message
      would be matched in assert.throw.

      Before test 2 of test-vm-timeout.js would match any RangeError,
      now it looks specifically for the error message
      "RangeError: timeout must be a positive number"

test: changed test 3 of test-vm-timeout.js so that entire error message
      would be matched in assert.throw.

      Before test 3 of test-vm-timeout.js would match any RangeError,
      now it looks specifically for the error message
      "RangeError: timeout must be a positive number"

PR-URL: https://github.com/nodejs/node/pull/13453
Refs: https://github.com/nodejs/node/issues/13454
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
v6.x
aniketshukla 8 years ago
committed by Myles Borins
parent
commit
779402ec5f
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 4
      test/parallel/test-vm-timeout.js

4
test/parallel/test-vm-timeout.js

@ -11,12 +11,12 @@ assert.throws(function() {
// Test 2: Timeout must be >= 0ms // Test 2: Timeout must be >= 0ms
assert.throws(function() { assert.throws(function() {
vm.runInThisContext('', { timeout: -1 }); vm.runInThisContext('', { timeout: -1 });
}, RangeError); }, /^RangeError: timeout must be a positive number$/);
// Test 3: Timeout of 0ms // Test 3: Timeout of 0ms
assert.throws(function() { assert.throws(function() {
vm.runInThisContext('', { timeout: 0 }); vm.runInThisContext('', { timeout: 0 });
}, RangeError); }, /^RangeError: timeout must be a positive number$/);
// Test 4: Timeout of 1000ms, script finishes first // Test 4: Timeout of 1000ms, script finishes first
vm.runInThisContext('', { timeout: 1000 }); vm.runInThisContext('', { timeout: 1000 });

Loading…
Cancel
Save