Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add expected arguments to assert.throws calls #347

Merged
merged 1 commit into from
Jun 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/test-base64.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions test/test-source-map-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ 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() {
map.addMapping({
generated: { line: 1, column: 1 },
original: { line: 1, column: 1 }
});
});
}, /Invalid mapping/);
};

exports["test adding mappings with skipValidation"] = function(assert) {
Expand All @@ -105,15 +105,15 @@ 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() {
map.addMapping({
generated: { line: 1, column: 1 },
original: { line: 1, column: 1 }
});
});
}, /Invalid mapping/);
};

exports["test that the correct mappings are being generated"] = function(assert) {
Expand Down
8 changes: 4 additions & 4 deletions test/test-source-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down