mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 23:37:04 +00:00
Merge pull request #21879 from segayuu/types-chai-cleanup-lint-errors
[@types/chai] Cleanup lint errors
This commit is contained in:
+42
-45
@@ -1,3 +1,4 @@
|
||||
/// <reference types="node" />
|
||||
import * as chai from "chai";
|
||||
|
||||
const expect = chai.expect;
|
||||
@@ -132,7 +133,9 @@ function _typeof() {
|
||||
expect(5).to.be.a('number');
|
||||
(5).should.be.a('number');
|
||||
|
||||
// tslint:disable-next-line:no-construct
|
||||
expect(new Number(1)).to.be.a('number');
|
||||
// tslint:disable-next-line:no-construct
|
||||
(new Number(1)).should.be.a('number');
|
||||
expect(Number(1)).to.be.a('number');
|
||||
Number(1).should.be.a('number');
|
||||
@@ -348,10 +351,6 @@ function eql() {
|
||||
(4).should.eql(3, 'blah');
|
||||
}
|
||||
|
||||
class Buffer {
|
||||
constructor(arr: number[]) {
|
||||
}
|
||||
}
|
||||
function buffer() {
|
||||
expect(new Buffer([1])).to.eql(new Buffer([1]));
|
||||
(new Buffer([1])).should.eql(new Buffer([1]));
|
||||
@@ -726,7 +725,6 @@ function frozen() {
|
||||
Object.freeze({}).should.be.frozen;
|
||||
}
|
||||
|
||||
|
||||
class PoorlyConstructedError { }
|
||||
function _throw() {
|
||||
// See GH-45: some poorly-constructed custom errors don't have useful names
|
||||
@@ -736,11 +734,11 @@ function _throw() {
|
||||
|
||||
const specificError = new RangeError('boo');
|
||||
|
||||
const goodFn = () => { }
|
||||
, badFn = () => { throw new Error('testing'); }
|
||||
, refErrFn = () => { throw new ReferenceError('hello'); }
|
||||
, ickyErrFn = () => { throw new PoorlyConstructedError(); }
|
||||
, specificErrFn = () => { throw specificError; };
|
||||
const goodFn = () => { };
|
||||
const badFn = () => { throw new Error('testing'); };
|
||||
const refErrFn = () => { throw new ReferenceError('hello'); };
|
||||
const ickyErrFn = () => { throw new PoorlyConstructedError(); };
|
||||
const specificErrFn = () => { throw specificError; };
|
||||
|
||||
expect(goodFn).to.not.throw();
|
||||
goodFn.should.not.throw();
|
||||
@@ -891,7 +889,7 @@ function use() {
|
||||
_chai.can.use.any();
|
||||
});
|
||||
|
||||
let expect = chai
|
||||
const expect = chai
|
||||
.use((_chai, util) => {})
|
||||
.use((_chai, util) => {})
|
||||
.expect;
|
||||
@@ -1090,7 +1088,7 @@ function oneOf() {
|
||||
expect(obj).to.not.be.oneOf([{ z: 3 }]);
|
||||
}
|
||||
|
||||
//tdd
|
||||
// tdd
|
||||
declare function suite(description: string, action: Function): void;
|
||||
declare function test(description: string, action: Function): void;
|
||||
|
||||
@@ -1105,9 +1103,8 @@ class CrashyObject {
|
||||
}
|
||||
|
||||
suite('assert', () => {
|
||||
|
||||
test('assert', () => {
|
||||
const foo: string = 'bar';
|
||||
const foo = 'bar' as string;
|
||||
assert(foo === 'bar', 'expected foo to equal `bar`');
|
||||
|
||||
assert(foo === 'baz', 'expected foo to equal `bar`');
|
||||
@@ -1207,26 +1204,26 @@ suite('assert', () => {
|
||||
assert.deepEqual({ tea: 'chai' }, { tea: 'chai' });
|
||||
assert.deepEqual({ tea: 'chai' }, { tea: 'black' });
|
||||
|
||||
const obja = Object.create({ tea: 'chai' })
|
||||
, objb = Object.create({ tea: 'chai' });
|
||||
const obja = Object.create({ tea: 'chai' });
|
||||
const objb = Object.create({ tea: 'chai' });
|
||||
|
||||
assert.deepEqual(obja, objb);
|
||||
|
||||
const obj1 = Object.create({ tea: 'chai' })
|
||||
, obj2 = Object.create({ tea: 'black' });
|
||||
const obj1 = Object.create({ tea: 'chai' });
|
||||
const obj2 = Object.create({ tea: 'black' });
|
||||
|
||||
assert.deepEqual(obj1, obj2);
|
||||
});
|
||||
|
||||
test('deepEqual (ordering)', () => {
|
||||
const a = { a: 'b', c: 'd' }
|
||||
, b = { c: 'd', a: 'b' };
|
||||
const a = { a: 'b', c: 'd' };
|
||||
const b = { c: 'd', a: 'b' };
|
||||
assert.deepEqual(a, b);
|
||||
});
|
||||
|
||||
test('deepEqual (circular)', () => {
|
||||
const circularObject: any = {}
|
||||
, secondCircularObject: any = {};
|
||||
const circularObject: any = {};
|
||||
const secondCircularObject: any = {};
|
||||
circularObject.field = circularObject;
|
||||
secondCircularObject.field = secondCircularObject;
|
||||
|
||||
@@ -1242,8 +1239,8 @@ suite('assert', () => {
|
||||
});
|
||||
|
||||
test('notDeepEqual (circular)', () => {
|
||||
const circularObject: any = {}
|
||||
, secondCircularObject: any = { tea: 'jasmine' };
|
||||
const circularObject: any = {};
|
||||
const secondCircularObject: any = { tea: 'jasmine' };
|
||||
circularObject.field = circularObject;
|
||||
secondCircularObject.field = secondCircularObject;
|
||||
|
||||
@@ -1309,6 +1306,7 @@ suite('assert', () => {
|
||||
|
||||
test('isString', () => {
|
||||
assert.isString('Foo');
|
||||
// tslint:disable-next-line:no-construct
|
||||
assert.isString(new String('foo'));
|
||||
assert.isString(1);
|
||||
});
|
||||
@@ -1372,13 +1370,13 @@ suite('assert', () => {
|
||||
});
|
||||
|
||||
test('nestedInclude', () => {
|
||||
assert.nestedInclude({'.a': {'b': 'x'}}, {'\\.a.[b]': 'x'});
|
||||
assert.nestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'x'});
|
||||
assert.nestedInclude({'.a': {b: 'x'}}, {'\\.a.[b]': 'x'});
|
||||
assert.nestedInclude({a: {'[b]': 'x'}}, {'a.\\[b\\]': 'x'});
|
||||
});
|
||||
|
||||
test('notNestedInclude', () => {
|
||||
assert.notNestedInclude({'.a': {'b': 'x'}}, {'\\.a.b': 'y'});
|
||||
assert.notNestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'y'});
|
||||
assert.notNestedInclude({'.a': {b: 'x'}}, {'\\.a.b': 'y'});
|
||||
assert.notNestedInclude({a: {'[b]': 'x'}}, {'a.\\[b\\]': 'y'});
|
||||
});
|
||||
|
||||
test('deepNestedInclude', () => {
|
||||
@@ -1387,7 +1385,7 @@ suite('assert', () => {
|
||||
});
|
||||
|
||||
test('notDeepNestedInclude', () => {
|
||||
assert.notDeepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {y: 1}})
|
||||
assert.notDeepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {y: 1}});
|
||||
assert.notDeepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {y: 2}});
|
||||
});
|
||||
|
||||
@@ -1548,7 +1546,6 @@ suite('assert', () => {
|
||||
assert.sameMembers([1, 54], [6, 1, 54]);
|
||||
});
|
||||
|
||||
|
||||
test('isAbove', () => {
|
||||
assert.isAbove(10, 5);
|
||||
assert.isAbove(1, 5);
|
||||
@@ -1738,7 +1735,7 @@ suite('assert', () => {
|
||||
test('hasAllKeys', () => {
|
||||
assert.hasAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'bar', 'baz']);
|
||||
assert.hasAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, bar: 99, baz: 1337});
|
||||
assert.hasAllKeys(new Map<any,any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']);
|
||||
assert.hasAllKeys(new Map<any, any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']);
|
||||
assert.hasAllKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}, 'anotherKey']);
|
||||
});
|
||||
|
||||
@@ -1747,8 +1744,8 @@ suite('assert', () => {
|
||||
assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'bar', 'baz']);
|
||||
assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, baz: 1337});
|
||||
assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, bar: 99, baz: 1337});
|
||||
assert.containsAllKeys(new Map<any,any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}]);
|
||||
assert.containsAllKeys(new Map<any,any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']);
|
||||
assert.containsAllKeys(new Map<any, any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}]);
|
||||
assert.containsAllKeys(new Map<any, any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']);
|
||||
assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}]);
|
||||
assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}, 'anotherKey']);
|
||||
});
|
||||
@@ -1756,21 +1753,21 @@ suite('assert', () => {
|
||||
test('doesNotHaveAnyKeys', () => {
|
||||
assert.doesNotHaveAnyKeys({foo: 1, bar: 2, baz: 3}, ['one', 'two', 'example']);
|
||||
assert.doesNotHaveAnyKeys({foo: 1, bar: 2, baz: 3}, {one: 1, two: 2, example: 'foo'});
|
||||
assert.doesNotHaveAnyKeys(new Map<any,any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']);
|
||||
assert.doesNotHaveAnyKeys(new Map<any, any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']);
|
||||
assert.doesNotHaveAnyKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{one: 'two'}, 'example']);
|
||||
});
|
||||
|
||||
test('doesNotHaveAllKeys', () => {
|
||||
assert.doesNotHaveAllKeys({foo: 1, bar: 2, baz: 3}, ['one', 'two', 'example']);
|
||||
assert.doesNotHaveAllKeys({foo: 1, bar: 2, baz: 3}, {one: 1, two: 2, example: 'foo'});
|
||||
assert.doesNotHaveAllKeys(new Map<any,any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']);
|
||||
assert.doesNotHaveAllKeys(new Map<any, any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']);
|
||||
assert.doesNotHaveAllKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{one: 'two'}, 'example']);
|
||||
});
|
||||
|
||||
test('hasAnyDeepKeys', () => {
|
||||
assert.hasAnyDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'});
|
||||
assert.hasAnyDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [1, 2]]), [{one: 'one'}, {two: 'two'}]);
|
||||
assert.hasAnyDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);
|
||||
assert.hasAnyDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'});
|
||||
assert.hasAnyDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [1, 2]]), [{one: 'one'}, {two: 'two'}]);
|
||||
assert.hasAnyDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);
|
||||
assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {one: 'one'});
|
||||
assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {three: 'three'}]);
|
||||
assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]);
|
||||
@@ -1778,28 +1775,28 @@ suite('assert', () => {
|
||||
|
||||
test('hasAllDeepKeys', () => {
|
||||
assert.hasAllDeepKeys(new Map([[{one: 'one'}, 'valueOne']]), {one: 'one'});
|
||||
assert.hasAllDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);
|
||||
assert.hasAllDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);
|
||||
assert.hasAllDeepKeys(new Set([{one: 'one'}]), {one: 'one'});
|
||||
assert.hasAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]);
|
||||
});
|
||||
|
||||
test('containsAllDeepKeys', () => {
|
||||
assert.containsAllDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'});
|
||||
assert.containsAllDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);
|
||||
assert.containsAllDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'});
|
||||
assert.containsAllDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);
|
||||
assert.containsAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {one: 'one'});
|
||||
assert.containsAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]);
|
||||
});
|
||||
|
||||
test('doesNotHaveAnyDeepKeys', () => {
|
||||
assert.doesNotHaveAnyDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'});
|
||||
assert.doesNotHaveAnyDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {fifty: 'fifty'}]);
|
||||
assert.doesNotHaveAnyDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'});
|
||||
assert.doesNotHaveAnyDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {fifty: 'fifty'}]);
|
||||
assert.doesNotHaveAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {twenty: 'twenty'});
|
||||
assert.doesNotHaveAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{twenty: 'twenty'}, {fifty: 'fifty'}]);
|
||||
});
|
||||
|
||||
test('doesNotHaveAllDeepKeys', () => {
|
||||
assert.doesNotHaveAllDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'});
|
||||
assert.doesNotHaveAllDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {one: 'one'}]);
|
||||
assert.doesNotHaveAllDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'});
|
||||
assert.doesNotHaveAllDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {one: 'one'}]);
|
||||
assert.doesNotHaveAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {twenty: 'twenty'});
|
||||
assert.doesNotHaveAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {fifty: 'fifty'}]);
|
||||
});
|
||||
|
||||
Vendored
+31
-69
@@ -1,4 +1,4 @@
|
||||
// Type definitions for chai 4.0.0
|
||||
// Type definitions for chai 4.0
|
||||
// Project: http://chaijs.com/
|
||||
// Definitions by: Jed Mao <https://github.com/jedmao>,
|
||||
// Bart van der Schoor <https://github.com/Bartvds>,
|
||||
@@ -13,7 +13,6 @@
|
||||
// <reference types="assertion-error"/>
|
||||
|
||||
declare namespace Chai {
|
||||
|
||||
interface ChaiStatic {
|
||||
expect: ExpectStatic;
|
||||
should(): Should;
|
||||
@@ -27,20 +26,20 @@ declare namespace Chai {
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface ExpectStatic extends AssertionStatic {
|
||||
interface ExpectStatic extends AssertionStatic {
|
||||
fail(actual?: any, expected?: any, message?: string, operator?: Operator): void;
|
||||
}
|
||||
|
||||
export interface AssertStatic extends Assert {
|
||||
interface AssertStatic extends Assert {
|
||||
}
|
||||
|
||||
export interface AssertionStatic {
|
||||
interface AssertionStatic {
|
||||
(target: any, message?: string): Assertion;
|
||||
}
|
||||
|
||||
export type Operator = string; // "==" | "===" | ">" | ">=" | "<" | "<=" | "!=" | "!==";
|
||||
type Operator = string; // "==" | "===" | ">" | ">=" | "<" | "<=" | "!=" | "!==";
|
||||
|
||||
export type OperatorComparable = boolean | null | number | string | undefined | Date;
|
||||
type OperatorComparable = boolean | null | number | string | undefined | Date;
|
||||
|
||||
interface ShouldAssertion {
|
||||
equal(value1: any, value2: any, message?: string): void;
|
||||
@@ -55,8 +54,7 @@ declare namespace Chai {
|
||||
}
|
||||
|
||||
interface ShouldThrow {
|
||||
(actual: Function): void;
|
||||
(actual: Function, expected: string|RegExp, message?: string): void;
|
||||
(actual: Function, expected?: string|RegExp, message?: string): void;
|
||||
(actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void;
|
||||
}
|
||||
|
||||
@@ -219,9 +217,7 @@ declare namespace Chai {
|
||||
}
|
||||
|
||||
interface Include {
|
||||
(value: Object, message?: string): Assertion;
|
||||
(value: string, message?: string): Assertion;
|
||||
(value: number, message?: string): Assertion;
|
||||
(value: Object | string | number, message?: string): Assertion;
|
||||
keys: Keys;
|
||||
deep: Deep;
|
||||
ordered: Ordered;
|
||||
@@ -236,18 +232,12 @@ declare namespace Chai {
|
||||
|
||||
interface Keys {
|
||||
(...keys: string[]): Assertion;
|
||||
(keys: any[]): Assertion;
|
||||
(keys: Object): Assertion;
|
||||
(keys: any[]|Object): Assertion;
|
||||
}
|
||||
|
||||
interface Throw {
|
||||
(): Assertion;
|
||||
(expected: string, message?: string): Assertion;
|
||||
(expected: RegExp, message?: string): Assertion;
|
||||
(constructor: Error, expected?: string, message?: string): Assertion;
|
||||
(constructor: Error, expected?: RegExp, message?: string): Assertion;
|
||||
(constructor: Function, expected?: string, message?: string): Assertion;
|
||||
(constructor: Function, expected?: RegExp, message?: string): Assertion;
|
||||
(expected?: string|RegExp, message?: string): Assertion;
|
||||
(constructor: Error|Function, expected?: string|RegExp, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface RespondTo {
|
||||
@@ -266,7 +256,7 @@ declare namespace Chai {
|
||||
(object: Object, property: string, message?: string): Assertion;
|
||||
}
|
||||
|
||||
export interface Assert {
|
||||
interface Assert {
|
||||
/**
|
||||
* @param expression Expression to test for truthiness.
|
||||
* @param message Message to display on error.
|
||||
@@ -698,21 +688,11 @@ declare namespace Chai {
|
||||
/**
|
||||
* Asserts that haystack does not include needle.
|
||||
*
|
||||
* @param haystack Container string.
|
||||
* @param haystack Container string or array.
|
||||
* @param needle Potential expected substring of haystack.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
notInclude(haystack: string, needle: any, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that haystack does not include needle.
|
||||
*
|
||||
* @param haystack Container array.
|
||||
* @param needle Potential value contained in haystack.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
notInclude(haystack: any[], needle: any, message?: string): void;
|
||||
|
||||
notInclude(haystack: string | any[], needle: any, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that haystack includes needle. Can be used to assert the inclusion of a value in an array or a subset of properties in an object. Deep equality is used.
|
||||
@@ -735,20 +715,11 @@ declare namespace Chai {
|
||||
/**
|
||||
* Asserts that haystack does not include needle. Can be used to assert the absence of a value in an array or a subset of properties in an object. Deep equality is used.
|
||||
*
|
||||
* @param haystack Container string.
|
||||
* @param haystack Container string or array.
|
||||
* @param needle Potential expected substring of haystack.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
notDeepInclude(haystack: string, needle: any, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that haystack does not include needle. Can be used to assert the absence of a value in an array or a subset of properties in an object. Deep equality is used.
|
||||
*
|
||||
* @param haystack
|
||||
* @param needle
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
notDeepInclude(haystack: any[], needle: any, message?: string): void;
|
||||
notDeepInclude(haystack: string | any[], needle: any, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object.
|
||||
@@ -1014,19 +985,10 @@ declare namespace Chai {
|
||||
* Asserts that function will throw an error with message matching regexp.
|
||||
*
|
||||
* @param fn Function that may throw.
|
||||
* @param regExp Potential expected message match.
|
||||
* @param errType Potential expected message match or error constructor.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
throws(fn: Function, regExp: RegExp, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that function will throw an error that is an instance of constructor.
|
||||
*
|
||||
* @param fn Function that may throw.
|
||||
* @param constructor Potential expected error constructor.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
throws(fn: Function, errType: Function, message?: string): void;
|
||||
throws(fn: Function, errType: RegExp|Function, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that function will throw an error that is an instance of constructor
|
||||
@@ -1289,7 +1251,7 @@ declare namespace Chai {
|
||||
* @param property Property of object expected to be modified.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
changes<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void
|
||||
changes<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that a function does not change the value of a property.
|
||||
@@ -1300,7 +1262,7 @@ declare namespace Chai {
|
||||
* @param property Property of object expected not to be modified.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
doesNotChange<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void
|
||||
doesNotChange<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that a function increases an object property.
|
||||
@@ -1311,7 +1273,7 @@ declare namespace Chai {
|
||||
* @param property Property of object expected to be increased.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
increases<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void
|
||||
increases<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that a function does not increase an object property.
|
||||
@@ -1322,7 +1284,7 @@ declare namespace Chai {
|
||||
* @param property Property of object expected not to be increased.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
doesNotIncrease<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void
|
||||
doesNotIncrease<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that a function decreases an object property.
|
||||
@@ -1333,7 +1295,7 @@ declare namespace Chai {
|
||||
* @param property Property of object expected to be decreased.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
decreases<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void
|
||||
decreases<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that a function does not decrease an object property.
|
||||
@@ -1344,7 +1306,7 @@ declare namespace Chai {
|
||||
* @param property Property of object expected not to be decreased.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
doesNotDecrease<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void
|
||||
doesNotDecrease<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts if value is not a false value, and throws if it is a true value.
|
||||
@@ -1625,7 +1587,7 @@ declare namespace Chai {
|
||||
doesNotHaveAllDeepKeys<T>(object: T, keys: Array<Object | string> | { [key: string]: any }, message?: string): void;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
interface Config {
|
||||
/**
|
||||
* Default: false
|
||||
*/
|
||||
@@ -1642,7 +1604,7 @@ declare namespace Chai {
|
||||
truncateThreshold: number;
|
||||
}
|
||||
|
||||
export class AssertionError {
|
||||
class AssertionError {
|
||||
constructor(message: string, _props?: any, ssf?: Function);
|
||||
name: string;
|
||||
message: string;
|
||||
@@ -1653,10 +1615,10 @@ declare namespace Chai {
|
||||
|
||||
declare const chai: Chai.ChaiStatic;
|
||||
|
||||
declare module "chai" {
|
||||
export = chai;
|
||||
}
|
||||
export = chai;
|
||||
|
||||
interface Object {
|
||||
should: Chai.Assertion;
|
||||
declare global {
|
||||
interface Object {
|
||||
should: Chai.Assertion;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-69
@@ -1,79 +1,11 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user