unexpected
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -258,3 +258,3 @@ // Copyright (c) 2013 Sune Simonsen <sune@we-knowhow.dk> | ||
function ensureValidUseOfParenthesisOrBrackets(pattern) { | ||
function ensureValidUseOfParenthesesOrBrackets(pattern) { | ||
var counts = { | ||
@@ -277,3 +277,3 @@ '[': 0, | ||
if (counts['('] !== counts[')']) { | ||
throw new Error("Assertion patterns must not contain flags with parenthesis: '" + pattern + "'"); | ||
throw new Error("Assertion patterns must not contain flags with parentheses: '" + pattern + "'"); | ||
} | ||
@@ -286,3 +286,3 @@ | ||
if (counts['('] === counts[')'] + 1) { | ||
throw new Error("Assertion patterns must not contain alternations with parenthesis: '" + pattern + "'"); | ||
throw new Error("Assertion patterns must not contain alternations with parentheses: '" + pattern + "'"); | ||
} | ||
@@ -307,3 +307,3 @@ | ||
if (counts['('] !== counts[')']) { | ||
throw new Error("Assertion patterns must not contain unbalanced parenthesis: '" + pattern + "'"); | ||
throw new Error("Assertion patterns must not contain unbalanced parentheses: '" + pattern + "'"); | ||
} | ||
@@ -320,3 +320,3 @@ } | ||
ensureValidUseOfParenthesisOrBrackets(pattern); | ||
ensureValidUseOfParenthesesOrBrackets(pattern); | ||
} | ||
@@ -417,2 +417,14 @@ | ||
forEach(['string', 'array'], function (type) { | ||
expect.addAssertion('to be (the|an) empty ' + type, function () { | ||
expect(this.obj, 'to be a', type); | ||
expect(this.obj, 'to be empty'); | ||
}); | ||
expect.addAssertion('to be a non-empty ' + type, function () { | ||
expect(this.obj, 'to be a', type); | ||
expect(this.obj, 'not to be empty'); | ||
}); | ||
}); | ||
expect.addAssertion('[not] to match', function (regexp) { | ||
@@ -419,0 +431,0 @@ this.assert(regexp.exec(this.obj)); |
{ | ||
"name": "unexpected", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"author": "Sune Sloth Simonsen <sune@we-knowhow.dk>", | ||
@@ -22,3 +22,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"mocha": "~1.9.0", | ||
"mocha": "~1.14.0", | ||
"mocha-slow-reporter": "*", | ||
@@ -25,0 +25,0 @@ "serve": "*" |
@@ -125,5 +125,12 @@ # Unexpected | ||
expect('abc', 'to be a', 'string'); | ||
expect('abc', 'to be a string'); | ||
expect('', 'to be an empty string'); | ||
expect('abc', 'to be a non-empty string'); | ||
expect([], 'to be an', 'array'); | ||
expect([], 'to be an array'); | ||
expect([], 'to be an', Array); | ||
expect([], 'to be an empty array'); | ||
expect([123], 'to be a non-empty array'); | ||
@@ -139,4 +146,4 @@ expect([], 'to be an', 'object'); | ||
expect("".substring, 'to be a', 'function'); | ||
expect("".substring, 'to be a function'); | ||
expect(expect, 'to be a', 'function'); | ||
expect(expect, 'to be a function'); | ||
``` | ||
@@ -143,0 +150,0 @@ |
@@ -85,4 +85,11 @@ /*global describe, it, expect*/ | ||
expect(5, 'to be a number'); | ||
expect('abc', 'to be a', 'string'); | ||
expect('', 'to be a string'); | ||
expect('', 'to be the empty string'); | ||
expect('', 'to be an empty string'); | ||
expect('abc', 'to be a non-empty string'); | ||
expect([], 'to be an', 'array'); | ||
expect([], 'to be an array'); | ||
expect([], 'to be an empty array'); | ||
expect([123], 'to be a non-empty array'); | ||
expect([], 'to be an', 'object'); | ||
@@ -101,4 +108,4 @@ expect([], 'to be an object'); | ||
expect(true, 'to be a boolean'); | ||
expect("".substring, 'to be a', 'function'); | ||
expect("".substring, 'to be a function'); | ||
expect(expect, 'to be a', 'function'); | ||
expect(expect, 'to be a function'); | ||
}); | ||
@@ -635,10 +642,10 @@ | ||
it("must not contain unbalanced parenthesis", function () { | ||
it("must not contain unbalanced parentheses", function () { | ||
expect(function () { | ||
expect.addAssertion('foo (', function () {}); | ||
}, 'to throw', "Assertion patterns must not contain unbalanced parenthesis: 'foo ('"); | ||
}, 'to throw', "Assertion patterns must not contain unbalanced parentheses: 'foo ('"); | ||
expect(function () { | ||
expect.addAssertion('foo )', function () {}); | ||
}, 'to throw', "Assertion patterns must not contain unbalanced parenthesis: 'foo )'"); | ||
}, 'to throw', "Assertion patterns must not contain unbalanced parentheses: 'foo )'"); | ||
}); | ||
@@ -669,10 +676,10 @@ | ||
it("must not contain parenthesis", function () { | ||
it("must not contain parentheses", function () { | ||
expect(function () { | ||
expect.addAssertion('foo [(bar]', function () {}); | ||
}, 'to throw', "Assertion patterns must not contain flags with parenthesis: 'foo [(bar]'"); | ||
}, 'to throw', "Assertion patterns must not contain flags with parentheses: 'foo [(bar]'"); | ||
expect(function () { | ||
expect.addAssertion('foo [bar)]', function () {}); | ||
}, 'to throw', "Assertion patterns must not contain flags with parenthesis: 'foo [bar)]'"); | ||
}, 'to throw', "Assertion patterns must not contain flags with parentheses: 'foo [bar)]'"); | ||
}); | ||
@@ -710,10 +717,10 @@ }); | ||
it("must not contain parenthesis", function () { | ||
it("must not contain parentheses", function () { | ||
expect(function () { | ||
expect.addAssertion('foo ((bar)', function () {}); | ||
}, 'to throw', "Assertion patterns must not contain alternations with parenthesis: 'foo ((bar)'"); | ||
}, 'to throw', "Assertion patterns must not contain alternations with parentheses: 'foo ((bar)'"); | ||
expect(function () { | ||
expect.addAssertion('foo ((bar))', function () {}); | ||
}, 'to throw', "Assertion patterns must not contain alternations with parenthesis: 'foo ((bar))'"); | ||
}, 'to throw', "Assertion patterns must not contain alternations with parentheses: 'foo ((bar))'"); | ||
}); | ||
@@ -733,3 +740,3 @@ }); | ||
it('changes to the clone does not affect the orignal instance', function () { | ||
it('changes to the clone does not affect the original instance', function () { | ||
expect(expect.assertions, 'not to have keys', | ||
@@ -736,0 +743,0 @@ 'to be answer to the Ultimate Question of Life, the Universe, and Everything', |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
208773
6433
384
1