From 02eb2f91aff422fb74b931935f58fb4eebc4b3bd Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Thu, 21 Jun 2018 16:44:54 +0100 Subject: [PATCH] Add expected arguments to assert.throws calls --- test/test-base64.js | 4 ++-- test/test-source-map-generator.js | 8 ++++---- test/test-source-node.js | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/test-base64.js b/test/test-base64.js index 20f98820..787aeb4e 100644 --- a/test/test-base64.js +++ b/test/test-base64.js @@ -10,10 +10,10 @@ const base64 = require("../lib/base64"); exports["test out of range encoding"] = function(assert) { assert.throws(function() { base64.encode(-1); - }); + }, /Must be between 0 and 63/); assert.throws(function() { base64.encode(64); - }); + }, /Must be between 0 and 63/); }; exports["test normal encoding and decoding"] = function(assert) { diff --git a/test/test-source-map-generator.js b/test/test-source-map-generator.js index 31ef5f89..383a828e 100644 --- a/test/test-source-map-generator.js +++ b/test/test-source-map-generator.js @@ -84,7 +84,7 @@ exports["test adding mappings (invalid)"] = function(assert) { // Not enough info. assert.throws(function() { map.addMapping({}); - }); + }, /"generated" is a required argument/); // Original file position, but no source. assert.throws(function() { @@ -92,7 +92,7 @@ exports["test adding mappings (invalid)"] = function(assert) { generated: { line: 1, column: 1 }, original: { line: 1, column: 1 } }); - }); + }, /Invalid mapping/); }; exports["test adding mappings with skipValidation"] = function(assert) { @@ -105,7 +105,7 @@ exports["test adding mappings with skipValidation"] = function(assert) { // Not enough info, caught by `util.getArgs` assert.throws(function() { map.addMapping({}); - }); + }, /"generated" is a required argument/); // Original file position, but no source. Not checked. assert.doesNotThrow(function() { @@ -113,7 +113,7 @@ exports["test adding mappings with skipValidation"] = function(assert) { generated: { line: 1, column: 1 }, original: { line: 1, column: 1 } }); - }); + }, /Invalid mapping/); }; exports["test that the correct mappings are being generated"] = function(assert) { diff --git a/test/test-source-node.js b/test/test-source-node.js index 02c26c42..337952c3 100644 --- a/test/test-source-node.js +++ b/test/test-source-node.js @@ -35,10 +35,10 @@ exports["test .add()"] = function(assert) { // Adding other stuff doesn't. assert.throws(function() { node.add({}); - }); + }, /TypeError: Expected a SourceNode, string, or an array of SourceNodes and strings/); assert.throws(function() { node.add(function() {}); - }); + }, /TypeError: Expected a SourceNode, string, or an array of SourceNodes and strings/); }; exports["test .prepend()"] = function(assert) { @@ -70,10 +70,10 @@ exports["test .prepend()"] = function(assert) { // Prepending other stuff doesn't. assert.throws(function() { node.prepend({}); - }); + }, /TypeError: Expected a SourceNode, string, or an array of SourceNodes and strings/); assert.throws(function() { node.prepend(function() {}); - }); + }, /TypeError: Expected a SourceNode, string, or an array of SourceNodes and strings/); }; exports["test .toString()"] = function(assert) {