diff --git a/should/should-tests.ts b/should/should-tests.ts
index 43b21d0ef..41c814aea 100644
--- a/should/should-tests.ts
+++ b/should/should-tests.ts
@@ -15,6 +15,20 @@ should.throws(() => {});
should.doesNotThrow(() => {});
should.ifError('value');
+(0).should
+ .a
+ .an
+ .and
+ .be
+ .has
+ .have
+ .is
+ .it
+ .of
+ .the
+ .which
+ .with
+ .equal(0)
class User {
name: string;
@@ -60,36 +74,48 @@ should.not.exist(null);
should.not.exist('');
should.not.exist({});
-true.should.be.ok;
-'yay'.should.be.ok;
-(1).should.be.ok;
+true.should.be.ok();
+'yay'.should.be.ok();
+(1).should.be.ok();
-false.should.not.be.ok;
-''.should.not.be.ok;
-(0).should.not.be.ok;
+false.should.not.be.ok();
+''.should.not.be.ok();
+(0).should.not.be.ok();
-true.should.be.true
-'1'.should.not.be.true
-false
+true.should.be.true();
+true.should.be.True();
+'1'.should.not.be.true();
-false.should.be.false;
-(0).should.not.be.false;
+false.should.be.false();
+false.should.be.False();
+(0).should.not.be.false();
var args = function (a: string, b: string, c: string) { return arguments; };
-args.should.be.arguments;
-['a'].should.not.be.arguments;
+args.should.be.arguments();
+args.should.be.Arguments();
+['a'].should.not.be.arguments();
-['a'].should.be.empty;
-''.should.be.empty;
-({ length: 0 }).should.be.empty;
+['a'].should.be.empty();
+''.should.be.empty();
+({ length: 0 }).should.be.empty();
({ foo: 'bar' }).should.eql({ foo: 'bar' });
[1, 2, 3].should.eql([1, 2, 3]);
+[1, 2, 3].should.deepEqual([1, 2, 3]);
(4).should.equal(4);
'test'.should.equal('test');
[1, 2, 3].should.not.equal([1, 2, 3]);
+'ab'.should.equalOneOf('a', 10, 'ab');
+'ab'.should.equalOneOf(['a', 10, 'ab']);
+
+({a: 10}).should.be.oneOf('a', 10, 'ab', {a: 10});
+({a: 10}).should.be.oneOf(['a', 10, 'ab', {a: 10}]);
+
+'1'.should.be.exactly('1');
+'1'.should.not.be.exactly(1);
+
user.age.should.be.within(5, 50);
user.should.be.of.type('object');
@@ -114,7 +140,29 @@ user.should.have.property('age', 15);
user.should.not.have.property('rawr');
user.should.not.have.property('age', 0);
+({ a: 10 }).should.have.properties('a');
+({ a: 10, b: 20 }).should.have.properties([ 'a' ]);
+({ a: 10, b: 20 }).should.have.properties({ b: 20 });
({ foo: 'bar' }).should.have.ownProperty('foo');
+({ foo: 'bar' }).should.hasOwnProperty('foo');
+({ a: {b: 10}}).should.have.propertyByPath('a', 'b').eql(10);
+({ a: 10 }).should.have.propertyWithDescriptor('a', { enumerable: true });
+
+NaN.should.be.NaN();
+Infinity.should.be.Infinity();
+new Date().should.be.a.Date();
+({}).should.be.an.Object();
+"".should.be.a.String();
+true.should.be.a.Boolean();
+(4).should.be.a.Number();
+new ReferenceError("error").should.be.an.Error();
+(function() {}).should.be.a.Function();
+User.should.be.a.class();
+User.should.be.a.Class();
+'a'.should.not.be.a.generator();
+[].should.be.iterable();
+[].should.be.an.iterator();
+[].should.be.an.Array();
var res = {};
res.should.have.status(200);
@@ -123,30 +171,60 @@ res.should.have.header('content-length');
res.should.have.header('Content-Length', '123');
res.should.have.header('content-length', '123');
-res.should.be.json;
+res.should.be.json();
-res.should.be.html;
+res.should.be.html();
-[1, 2, 3].should.include(3);
-[1, 2, 3].should.include(2);
-[1, 2, 3].should.not.include(4);
+[1, 2, 3].should.containEql(3);
+[1, 2, 3].should.containEql(2);
+[1, 2, 3].should.not.containEql(4);
-'foo bar baz'.should.include('foo');
-'foo bar baz'.should.include('bar');
-'foo bar baz'.should.include('baz');
-'foo bar baz'.should.not.include('FOO');
+'foo bar baz'.should.containEql('foo');
+'foo bar baz'.should.containEql('bar');
+'foo bar baz'.should.containEql('baz');
+'foo bar baz'.should.not.containEql('FOO')
var tobi = { name: 'Tobi', age: 1 };
var jane = { name: 'Jane', age: 5 };
var tj = { name: 'TJ', pet: tobi };
-tj.should.include({ pet: tobi });
-tj.should.include({ pet: tobi, name: 'TJ' });
-tj.should.not.include({ pet: jane });
-tj.should.not.include({ name: 'Someone' });
+tj.should.containEql({ pet: tobi });
+tj.should.containEql({ pet: tobi, name: 'TJ' });
+tj.should.not.containEql({ pet: jane });
+tj.should.not.containEql({ name: 'Someone' });
-[[1], [2], [3]].should.includeEql([3]);
-[[1], [2], [3]].should.includeEql([2]);
-[[1], [2], [3]].should.not.includeEql([4]);
+[[1], [2], [3]].should.containEql([3]);
+[[1], [2], [3]].should.containEql([2]);
+[[1], [2], [3]].should.not.containEql([4]);
+
+var spy = function() { };
+spy.should.be.alwaysCalledOn({});
+spy.should.be.alwaysCalledWith(1, 2);
+spy.should.be.alwaysCalledWithExactly(1, 2);
+spy.should.be.alwaysCalledWithMatch(1, 2);
+spy.should.have.alwaysThrew("ReferenceError");
+spy.should.have.callCount(1);
+spy.should.be.called();
+spy.should.be.calledOn({});
+spy.should.be.calledOnce();
+spy.should.be.calledTwice();
+spy.should.be.calledThrice();
+spy.should.be.calledWith(1, 2);
+spy.should.be.calledWithExactly(1, 2);
+spy.should.be.calledWithMatch(1, 2);
+spy.should.be.calledWithNew();
+spy.should.be.neverCalledWith(1, 2);
+spy.should.be.neverCalledWithMatch(1, 2);
+spy.should.have.threw("ReferenceError");
+
+(10).should.be.aboveOrEqual(0);
+(10).should.be.aboveOrEqual(10);
+(10).should.be.greaterThanOrEqual(0);
+(10).should.be.greaterThanOrEqual(10);
+
+(0).should.be.belowOrEqual(10);
+(0).should.be.belowOrEqual(0);
+(0).should.be.lessThanOrEqual(10);
+(0).should.be.lessThanOrEqual(0);
(function () {
throw new Error('fail');
@@ -170,9 +248,17 @@ tj.should.not.include({ name: 'Someone' });
var obj = { foo: 'bar', baz: 'raz' };
obj.should.have.keys('foo', 'bar');
obj.should.have.keys(['foo', 'bar']);
+obj.should.have.key('foo');
+
+({ a: 10 }).should.have.enumerable('a');
+({ a: 10 }).should.have.enumerable('a', 10);
+({ a: 10, b: 10 }).should.have.enumerables('a', 'b');
(1).should.eql(0, 'some useful description');
+[ 1, 2, 3].should.containDeep([2, 1]);
+[ 1, 2, [ 1, 2, 3 ]].should.containDeep([ 1, [ 3, 1 ]]);
+
[ 1, 2, 3].should.containDeepOrdered([1, 2]);
[ 1, 2, [ 1, 2, 3 ]].should.containDeepOrdered([ 1, [ 2, 3 ]]);
diff --git a/should/should.d.ts b/should/should.d.ts
index 26a42d7ed..d4ab3ef38 100644
--- a/should/should.d.ts
+++ b/should/should.d.ts
@@ -1,5 +1,5 @@
-// Type definitions for should.js 3.1.2
-// Project: https://github.com/visionmedia/should.js
+// Type definitions for should.js v8.1.1
+// Project: https://github.com/shouldjs/should.js
// Definitions by: Alex Varju , Maxime LUCE
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -13,34 +13,49 @@ interface ShouldAssertion {
an: ShouldAssertion;
and: ShouldAssertion;
be: ShouldAssertion;
+ has: ShouldAssertion;
have: ShouldAssertion;
+ is: ShouldAssertion;
+ it: ShouldAssertion;
with: ShouldAssertion;
+ which: ShouldAssertion;
+ the: ShouldAssertion;
of: ShouldAssertion;
not: ShouldAssertion;
// validators
- arguments: ShouldAssertion;
- empty: ShouldAssertion;
- ok: ShouldAssertion;
- true: ShouldAssertion;
- false: ShouldAssertion;
- NaN: ShouldAssertion;
- Infinity: ShouldAssertion;
- Array: ShouldAssertion;
- Object: ShouldAssertion;
- String: ShouldAssertion;
- Boolean: ShouldAssertion;
- Number: ShouldAssertion;
- Error: ShouldAssertion;
- Function: ShouldAssertion;
+ arguments(): ShouldAssertion;
+ empty(): ShouldAssertion;
+ ok(): ShouldAssertion;
+ true(): ShouldAssertion;
+ false(): ShouldAssertion;
+ NaN(): ShouldAssertion;
+ Infinity(): ShouldAssertion;
+ Array(): ShouldAssertion;
+ Object(): ShouldAssertion;
+ String(): ShouldAssertion;
+ Boolean(): ShouldAssertion;
+ Number(): ShouldAssertion;
+ Error(): ShouldAssertion;
+ Function(): ShouldAssertion;
+ Date(): ShouldAssertion;
+ Class(): ShouldAssertion;
+ generator(): ShouldAssertion;
+ iterable(): ShouldAssertion;
+ iterator(): ShouldAssertion;
eql(expected: any, description?: string): ShouldAssertion;
equal(expected: any, description?: string): ShouldAssertion;
+ equalOneOf(...values: any[]): ShouldAssertion;
within(start: number, finish: number, description?: string): ShouldAssertion;
approximately(value: number, delta: number, description?: string): ShouldAssertion;
type(expected: any, description?: string): ShouldAssertion;
instanceof(constructor: Function, description?: string): ShouldAssertion;
above(n: number, description?: string): ShouldAssertion;
below(n: number, description?: string): ShouldAssertion;
+ aboveOrEqual(n: number, description?: string): ShouldAssertion;
+ greaterThanOrEqual(n: number, description?: string): ShouldAssertion;
+ belowOrEqual(n: number, description?: string): ShouldAssertion;
+ lessThanOrEqual(n: number, description?: string): ShouldAssertion;
match(other: {}, description?: string): ShouldAssertion;
match(other: (val: any) => any, description?: string): ShouldAssertion;
match(regexp: RegExp, description?: string): ShouldAssertion;
@@ -60,32 +75,60 @@ interface ShouldAssertion {
properties(name: string): ShouldAssertion;
properties(descriptor: any): ShouldAssertion;
properties(...properties: string[]): ShouldAssertion;
+ propertyByPath(...properties: string[]): ShouldAssertion;
+ propertyWithDescriptor(name: string, descriptor: PropertyDescriptor): ShouldAssertion;
+ oneOf(...values: any[]): ShouldAssertion;
ownProperty(name: string, description?: string): ShouldAssertion;
- contain(obj: any): ShouldAssertion;
containEql(obj: any): ShouldAssertion;
containDeep(obj: any): ShouldAssertion;
containDeepOrdered(obj: any): ShouldAssertion;
keys(...allKeys: string[]): ShouldAssertion;
keys(allKeys: string[]): ShouldAssertion;
- header(field: string, val?: string): ShouldAssertion;
- status(code: number): ShouldAssertion;
- json: ShouldAssertion;
- html: ShouldAssertion;
+ enumerable(property: string, value?: any): ShouldAssertion;
+ enumerables(...properties: string[]): ShouldAssertion;
startWith(expected: string, message?: any): ShouldAssertion;
endWith(expected: string, message?: any): ShouldAssertion;
throw(message?: any): ShouldAssertion;
- // deprecated
- include(obj: any, description?: string): ShouldAssertion;
- includeEql(obj: any[], description?: string): ShouldAssertion;
+ //http
+ header(field: string, val?: string): ShouldAssertion;
+ status(code: number): ShouldAssertion;
+ json(): ShouldAssertion;
+ html(): ShouldAssertion;
+
+ //stubs
+ alwaysCalledOn(thisTarget: any): ShouldAssertion;
+ alwaysCalledWith(...arguments: any[]): ShouldAssertion;
+ alwaysCalledWithExactly(...arguments: any[]): ShouldAssertion;
+ alwaysCalledWithMatch(...arguments: any[]): ShouldAssertion;
+ alwaysCalledWithNew(): ShouldAssertion;
+ alwaysThrew(exception?: any): ShouldAssertion;
+ callCount(count: number): ShouldAssertion;
+ called(): ShouldAssertion;
+ calledOn(thisTarget: any): ShouldAssertion;
+ calledOnce(): ShouldAssertion;
+ calledTwice(): ShouldAssertion;
+ calledThrice(): ShouldAssertion;
+ calledWith(...arguments: any[]): ShouldAssertion;
+ calledWithExactly(...arguments: any[]): ShouldAssertion;
+ calledWithMatch(...arguments: any[]): ShouldAssertion;
+ calledWithNew(): ShouldAssertion;
+ neverCalledWith(...arguments: any[]): ShouldAssertion;
+ neverCalledWithMatch(...arguments: any[]): ShouldAssertion;
+ threw(exception?: any): ShouldAssertion;
// aliases
+ True(): ShouldAssertion;
+ False(): ShouldAssertion;
+ Arguments(): ShouldAssertion;
+ class(): ShouldAssertion;
+ deepEqual(expected: any, description?: string): ShouldAssertion;
exactly(expected: any, description?: string): ShouldAssertion;
instanceOf(constructor: Function, description?: string): ShouldAssertion;
throwError(message?: any): ShouldAssertion;
lengthOf(n: number, description?: string): ShouldAssertion;
key(key: string): ShouldAssertion;
- haveOwnProperty(name: string, description?: string): ShouldAssertion;
+ hasOwnProperty(name: string, description?: string): ShouldAssertion;
greaterThan(n: number, description?: string): ShouldAssertion;
lessThan(n: number, description?: string): ShouldAssertion;
}