diff --git a/chai-as-promised/chai-as-promised-tests-with-bluebird.ts b/chai-as-promised/chai-as-promised-tests-with-bluebird.ts deleted file mode 100644 index e27205c41..000000000 --- a/chai-as-promised/chai-as-promised-tests-with-bluebird.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// -/// - -// Compatibility check for Promise/A+ valid libraries -var thenableNum: Chai.Thenable; -import Bluebird = require('bluebird'); -thenableNum = Bluebird.resolve(1); diff --git a/chai-as-promised/chai-as-promised-tests-with-q.ts b/chai-as-promised/chai-as-promised-tests-with-q.ts deleted file mode 100644 index 91fe676cd..000000000 --- a/chai-as-promised/chai-as-promised-tests-with-q.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// -/// - -// Compatibility check for Promise/A+ valid libraries -var thenableNum: Chai.Thenable; -import Q = require('q'); -thenableNum = Q.resolve(1); diff --git a/chai-as-promised/chai-as-promised-tests.ts b/chai-as-promised/chai-as-promised-tests.ts index dd528e9f6..0b747d2c4 100644 --- a/chai-as-promised/chai-as-promised-tests.ts +++ b/chai-as-promised/chai-as-promised-tests.ts @@ -1,4 +1,5 @@ /// +/// /// import chai = require('chai'); @@ -9,7 +10,7 @@ chai.use(chaiAsPromised); // ReSharper disable WrongExpressionStatement // BDD API (expect) -var thenableNum: Chai.Thenable; +var thenableNum: PromisesAPlus.Thenable; thenableNum = chai.expect(thenableNum).to.eventually.equal(3); thenableNum = chai.expect(thenableNum).to.eventually.have.property('foo'); thenableNum = chai.expect(thenableNum).to.become(3); @@ -39,7 +40,7 @@ Q.all([ ]).should.notify(() => console.log('done')); // Assert API -var thenableVoid: Chai.Thenable; +var thenableVoid: PromisesAPlus.Thenable; thenableVoid = chai.assert.eventually.equal(thenableNum, 4, 'Message'); thenableVoid = chai.assert.isFulfilled(thenableNum, "optional message"); thenableVoid = chai.assert.becomes(thenableNum, "foo", "optional message"); diff --git a/chai-as-promised/chai-as-promised.d.ts b/chai-as-promised/chai-as-promised.d.ts index e6644b03c..51255b490 100644 --- a/chai-as-promised/chai-as-promised.d.ts +++ b/chai-as-promised/chai-as-promised.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +/// declare module 'chai-as-promised' { function chaiAsPromised(chai: any, utils: any): void; @@ -12,12 +13,6 @@ declare module 'chai-as-promised' { declare module Chai { - // chai-as-promised can take Promise/A+ valid promises. - interface Thenable { - then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; - then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Thenable; - } - // For BDD API interface Assertion extends LanguageChains, NumericComparison, TypeComparison { eventually: PromisedAssertion; @@ -31,7 +26,7 @@ declare module Chai { // Eventually does not have .then(), but PromisedAssertion have. interface Eventually extends PromisedLanguageChains, PromisedNumericComparison, PromisedTypeComparison { // From chai-as-promised - become(expected: Thenable): PromisedAssertion; + become(expected: PromisesAPlus.Thenable): PromisedAssertion; fulfilled: PromisedAssertion; rejected: PromisedAssertion; rejectedWith(expected: any): PromisedAssertion; @@ -77,7 +72,7 @@ declare module Chai { members: PromisedMembers; } - interface PromisedAssertion extends Eventually, Thenable { + interface PromisedAssertion extends Eventually, PromisesAPlus.Thenable { } interface PromisedLanguageChains { @@ -179,111 +174,111 @@ declare module Chai { // For Assert API interface Assert { eventually: PromisedAssert; - isFulfilled(promise: Thenable, message?: string): Thenable; - becomes(promise: Thenable, expected: any, message?: string): Thenable; - doesNotBecome(promise: Thenable, expected: any, message?: string): Thenable; - isRejected(promise: Thenable, message?: string): Thenable; - isRejected(promise: Thenable, expected: any, message?: string): Thenable; - isRejected(promise: Thenable, match: RegExp, message?: string): Thenable; - notify(fn: Function): Thenable; + isFulfilled(promise: PromisesAPlus.Thenable, message?: string): PromisesAPlus.Thenable; + becomes(promise: PromisesAPlus.Thenable, expected: any, message?: string): PromisesAPlus.Thenable; + doesNotBecome(promise: PromisesAPlus.Thenable, expected: any, message?: string): PromisesAPlus.Thenable; + isRejected(promise: PromisesAPlus.Thenable, message?: string): PromisesAPlus.Thenable; + isRejected(promise: PromisesAPlus.Thenable, expected: any, message?: string): PromisesAPlus.Thenable; + isRejected(promise: PromisesAPlus.Thenable, match: RegExp, message?: string): PromisesAPlus.Thenable; + notify(fn: Function): PromisesAPlus.Thenable; } export interface PromisedAssert { - fail(actual?: any, expected?: any, msg?: string, operator?: string): Thenable; + fail(actual?: any, expected?: any, msg?: string, operator?: string): PromisesAPlus.Thenable; - ok(val: any, msg?: string): Thenable; - notOk(val: any, msg?: string): Thenable; + ok(val: any, msg?: string): PromisesAPlus.Thenable; + notOk(val: any, msg?: string): PromisesAPlus.Thenable; - equal(act: any, exp: any, msg?: string): Thenable; - notEqual(act: any, exp: any, msg?: string): Thenable; + equal(act: any, exp: any, msg?: string): PromisesAPlus.Thenable; + notEqual(act: any, exp: any, msg?: string): PromisesAPlus.Thenable; - strictEqual(act: any, exp: any, msg?: string): Thenable; - notStrictEqual(act: any, exp: any, msg?: string): Thenable; + strictEqual(act: any, exp: any, msg?: string): PromisesAPlus.Thenable; + notStrictEqual(act: any, exp: any, msg?: string): PromisesAPlus.Thenable; - deepEqual(act: any, exp: any, msg?: string): Thenable; - notDeepEqual(act: any, exp: any, msg?: string): Thenable; + deepEqual(act: any, exp: any, msg?: string): PromisesAPlus.Thenable; + notDeepEqual(act: any, exp: any, msg?: string): PromisesAPlus.Thenable; - isTrue(val: any, msg?: string): Thenable; - isFalse(val: any, msg?: string): Thenable; + isTrue(val: any, msg?: string): PromisesAPlus.Thenable; + isFalse(val: any, msg?: string): PromisesAPlus.Thenable; - isNull(val: any, msg?: string): Thenable; - isNotNull(val: any, msg?: string): Thenable; + isNull(val: any, msg?: string): PromisesAPlus.Thenable; + isNotNull(val: any, msg?: string): PromisesAPlus.Thenable; - isUndefined(val: any, msg?: string): Thenable; - isDefined(val: any, msg?: string): Thenable; + isUndefined(val: any, msg?: string): PromisesAPlus.Thenable; + isDefined(val: any, msg?: string): PromisesAPlus.Thenable; - isFunction(val: any, msg?: string): Thenable; - isNotFunction(val: any, msg?: string): Thenable; + isFunction(val: any, msg?: string): PromisesAPlus.Thenable; + isNotFunction(val: any, msg?: string): PromisesAPlus.Thenable; - isObject(val: any, msg?: string): Thenable; - isNotObject(val: any, msg?: string): Thenable; + isObject(val: any, msg?: string): PromisesAPlus.Thenable; + isNotObject(val: any, msg?: string): PromisesAPlus.Thenable; - isArray(val: any, msg?: string): Thenable; - isNotArray(val: any, msg?: string): Thenable; + isArray(val: any, msg?: string): PromisesAPlus.Thenable; + isNotArray(val: any, msg?: string): PromisesAPlus.Thenable; - isString(val: any, msg?: string): Thenable; - isNotString(val: any, msg?: string): Thenable; + isString(val: any, msg?: string): PromisesAPlus.Thenable; + isNotString(val: any, msg?: string): PromisesAPlus.Thenable; - isNumber(val: any, msg?: string): Thenable; - isNotNumber(val: any, msg?: string): Thenable; + isNumber(val: any, msg?: string): PromisesAPlus.Thenable; + isNotNumber(val: any, msg?: string): PromisesAPlus.Thenable; - isBoolean(val: any, msg?: string): Thenable; - isNotBoolean(val: any, msg?: string): Thenable; + isBoolean(val: any, msg?: string): PromisesAPlus.Thenable; + isNotBoolean(val: any, msg?: string): PromisesAPlus.Thenable; - typeOf(val: any, type: string, msg?: string): Thenable; - notTypeOf(val: any, type: string, msg?: string): Thenable; + typeOf(val: any, type: string, msg?: string): PromisesAPlus.Thenable; + notTypeOf(val: any, type: string, msg?: string): PromisesAPlus.Thenable; - instanceOf(val: any, type: Function, msg?: string): Thenable; - notInstanceOf(val: any, type: Function, msg?: string): Thenable; + instanceOf(val: any, type: Function, msg?: string): PromisesAPlus.Thenable; + notInstanceOf(val: any, type: Function, msg?: string): PromisesAPlus.Thenable; - include(exp: string, inc: any, msg?: string): Thenable; - include(exp: any[], inc: any, msg?: string): Thenable; + include(exp: string, inc: any, msg?: string): PromisesAPlus.Thenable; + include(exp: any[], inc: any, msg?: string): PromisesAPlus.Thenable; - notInclude(exp: string, inc: any, msg?: string): Thenable; - notInclude(exp: any[], inc: any, msg?: string): Thenable; + notInclude(exp: string, inc: any, msg?: string): PromisesAPlus.Thenable; + notInclude(exp: any[], inc: any, msg?: string): PromisesAPlus.Thenable; - match(exp: any, re: RegExp, msg?: string): Thenable; - notMatch(exp: any, re: RegExp, msg?: string): Thenable; + match(exp: any, re: RegExp, msg?: string): PromisesAPlus.Thenable; + notMatch(exp: any, re: RegExp, msg?: string): PromisesAPlus.Thenable; - property(obj: Object, prop: string, msg?: string): Thenable; - notProperty(obj: Object, prop: string, msg?: string): Thenable; - deepProperty(obj: Object, prop: string, msg?: string): Thenable; - notDeepProperty(obj: Object, prop: string, msg?: string): Thenable; + property(obj: Object, prop: string, msg?: string): PromisesAPlus.Thenable; + notProperty(obj: Object, prop: string, msg?: string): PromisesAPlus.Thenable; + deepProperty(obj: Object, prop: string, msg?: string): PromisesAPlus.Thenable; + notDeepProperty(obj: Object, prop: string, msg?: string): PromisesAPlus.Thenable; - propertyVal(obj: Object, prop: string, val: any, msg?: string): Thenable; - propertyNotVal(obj: Object, prop: string, val: any, msg?: string): Thenable; + propertyVal(obj: Object, prop: string, val: any, msg?: string): PromisesAPlus.Thenable; + propertyNotVal(obj: Object, prop: string, val: any, msg?: string): PromisesAPlus.Thenable; - deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): Thenable; - deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): Thenable; + deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): PromisesAPlus.Thenable; + deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): PromisesAPlus.Thenable; - lengthOf(exp: any, len: number, msg?: string): Thenable; + lengthOf(exp: any, len: number, msg?: string): PromisesAPlus.Thenable; //alias frenzy - throw(fn: Function, msg?: string): Thenable; - throw(fn: Function, regExp: RegExp): Thenable; - throw(fn: Function, errType: Function, msg?: string): Thenable; - throw(fn: Function, errType: Function, regExp: RegExp): Thenable; + throw(fn: Function, msg?: string): PromisesAPlus.Thenable; + throw(fn: Function, regExp: RegExp): PromisesAPlus.Thenable; + throw(fn: Function, errType: Function, msg?: string): PromisesAPlus.Thenable; + throw(fn: Function, errType: Function, regExp: RegExp): PromisesAPlus.Thenable; - throws(fn: Function, msg?: string): Thenable; - throws(fn: Function, regExp: RegExp): Thenable; - throws(fn: Function, errType: Function, msg?: string): Thenable; - throws(fn: Function, errType: Function, regExp: RegExp): Thenable; + throws(fn: Function, msg?: string): PromisesAPlus.Thenable; + throws(fn: Function, regExp: RegExp): PromisesAPlus.Thenable; + throws(fn: Function, errType: Function, msg?: string): PromisesAPlus.Thenable; + throws(fn: Function, errType: Function, regExp: RegExp): PromisesAPlus.Thenable; - Throw(fn: Function, msg?: string): Thenable; - Throw(fn: Function, regExp: RegExp): Thenable; - Throw(fn: Function, errType: Function, msg?: string): Thenable; - Throw(fn: Function, errType: Function, regExp: RegExp): Thenable; + Throw(fn: Function, msg?: string): PromisesAPlus.Thenable; + Throw(fn: Function, regExp: RegExp): PromisesAPlus.Thenable; + Throw(fn: Function, errType: Function, msg?: string): PromisesAPlus.Thenable; + Throw(fn: Function, errType: Function, regExp: RegExp): PromisesAPlus.Thenable; - doesNotThrow(fn: Function, msg?: string): Thenable; - doesNotThrow(fn: Function, regExp: RegExp): Thenable; - doesNotThrow(fn: Function, errType: Function, msg?: string): Thenable; - doesNotThrow(fn: Function, errType: Function, regExp: RegExp): Thenable; + doesNotThrow(fn: Function, msg?: string): PromisesAPlus.Thenable; + doesNotThrow(fn: Function, regExp: RegExp): PromisesAPlus.Thenable; + doesNotThrow(fn: Function, errType: Function, msg?: string): PromisesAPlus.Thenable; + doesNotThrow(fn: Function, errType: Function, regExp: RegExp): PromisesAPlus.Thenable; - operator(val: any, operator: string, val2: any, msg?: string): Thenable; - closeTo(act: number, exp: number, delta: number, msg?: string): Thenable; + operator(val: any, operator: string, val2: any, msg?: string): PromisesAPlus.Thenable; + closeTo(act: number, exp: number, delta: number, msg?: string): PromisesAPlus.Thenable; - sameMembers(set1: any[], set2: any[], msg?: string): Thenable; - includeMembers(set1: any[], set2: any[], msg?: string): Thenable; + sameMembers(set1: any[], set2: any[], msg?: string): PromisesAPlus.Thenable; + includeMembers(set1: any[], set2: any[], msg?: string): PromisesAPlus.Thenable; - ifError(val: any, msg?: string): Thenable; + ifError(val: any, msg?: string): PromisesAPlus.Thenable; } }