mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
Use @types for a few d.ts files in src (#20157)
This commit is contained in:
parent
42335c57f5
commit
22fdff9baf
|
@ -56,7 +56,7 @@ function createCompile(build, emitError) {
|
|||
function compileTask(out, build) {
|
||||
var compile = createCompile(build, true);
|
||||
return function () {
|
||||
var src = es.merge(gulp.src('src/**', { base: 'src' }), gulp.src('node_modules/typescript/lib/lib.d.ts'));
|
||||
var src = es.merge(gulp.src('src/**', { base: 'src' }), gulp.src('node_modules/typescript/lib/lib.d.ts'), gulp.src('node_modules/@types/**/index.d.ts'));
|
||||
return src
|
||||
.pipe(compile())
|
||||
.pipe(gulp.dest(out))
|
||||
|
@ -67,7 +67,7 @@ exports.compileTask = compileTask;
|
|||
function watchTask(out, build) {
|
||||
var compile = createCompile(build);
|
||||
return function () {
|
||||
var src = es.merge(gulp.src('src/**', { base: 'src' }), gulp.src('node_modules/typescript/lib/lib.d.ts'));
|
||||
var src = es.merge(gulp.src('src/**', { base: 'src' }), gulp.src('node_modules/typescript/lib/lib.d.ts'), gulp.src('node_modules/@types/**/index.d.ts'));
|
||||
var watchSrc = watch('src/**', { base: 'src' });
|
||||
return watchSrc
|
||||
.pipe(util.incremental(compile, src, true))
|
||||
|
|
|
@ -69,7 +69,8 @@ export function compileTask(out: string, build: boolean): () => NodeJS.ReadWrite
|
|||
return function () {
|
||||
const src = es.merge(
|
||||
gulp.src('src/**', { base: 'src' }),
|
||||
gulp.src('node_modules/typescript/lib/lib.d.ts')
|
||||
gulp.src('node_modules/typescript/lib/lib.d.ts'),
|
||||
gulp.src('node_modules/@types/**/index.d.ts')
|
||||
);
|
||||
|
||||
return src
|
||||
|
@ -85,7 +86,8 @@ export function watchTask(out: string, build: boolean): () => NodeJS.ReadWriteSt
|
|||
return function () {
|
||||
const src = es.merge(
|
||||
gulp.src('src/**', { base: 'src' }),
|
||||
gulp.src('node_modules/typescript/lib/lib.d.ts')
|
||||
gulp.src('node_modules/typescript/lib/lib.d.ts'),
|
||||
gulp.src('node_modules/@types/**/index.d.ts')
|
||||
);
|
||||
const watchSrc = watch('src/**', { base: 'src' });
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ var Lint = require("tslint");
|
|||
var Rule = (function (_super) {
|
||||
__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super.apply(this, arguments) || this;
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
return this.applyWithWalker(new ImportPatterns(sourceFile, this.getOptions()));
|
||||
|
|
|
@ -13,7 +13,7 @@ var minimatch = require("minimatch");
|
|||
var Rule = (function (_super) {
|
||||
__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super.apply(this, arguments) || this;
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var configs = this.getOptions().ruleArguments;
|
||||
|
|
|
@ -13,7 +13,7 @@ var path_1 = require("path");
|
|||
var Rule = (function (_super) {
|
||||
__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super.apply(this, arguments) || this;
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var parts = path_1.dirname(sourceFile.fileName).split(/\\|\//);
|
||||
|
|
|
@ -16,7 +16,7 @@ var Lint = require("tslint");
|
|||
var Rule = (function (_super) {
|
||||
__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super.apply(this, arguments) || this;
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
return this.applyWithWalker(new NoUnexternalizedStringsRuleWalker(sourceFile, this.getOptions()));
|
||||
|
@ -90,8 +90,8 @@ var NoUnexternalizedStringsRuleWalker = (function (_super) {
|
|||
return;
|
||||
}
|
||||
if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName])) {
|
||||
var s_1 = node.getText();
|
||||
var replacement = new Lint.Replacement(node.getStart(), node.getWidth(), "nls.localize('KEY-" + s_1.substring(1, s_1.length - 1) + "', " + s_1 + ")");
|
||||
var s = node.getText();
|
||||
var replacement = new Lint.Replacement(node.getStart(), node.getWidth(), "nls.localize('KEY-" + s.substring(1, s.length - 1) + "', " + s + ")");
|
||||
var fix = new Lint.Fix("Unexternalitzed string", [replacement]);
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), "Unexternalized string found: " + node.getText(), fix));
|
||||
return;
|
||||
|
|
|
@ -40,6 +40,10 @@
|
|||
"yauzl": "2.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/minimist": "^1.2.0",
|
||||
"@types/mocha": "^2.2.39",
|
||||
"@types/semver": "^5.3.30",
|
||||
"@types/sinon": "^1.16.34",
|
||||
"azure-storage": "^0.3.1",
|
||||
"clean-css": "3.4.6",
|
||||
"coveralls": "^2.11.11",
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
"sourceMap": false,
|
||||
"experimentalDecorators": true,
|
||||
"declaration": true,
|
||||
"noImplicitReturns": true
|
||||
"noImplicitReturns": true,
|
||||
"typeRoots": [
|
||||
"typings",
|
||||
"../node_modules/@types"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
35
src/typings/minimist.d.ts
vendored
35
src/typings/minimist.d.ts
vendored
|
@ -1,35 +0,0 @@
|
|||
// Type definitions for minimist 1.1.3
|
||||
// Project: https://github.com/substack/minimist
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Necroskillz <https://github.com/Necroskillz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'minimist' {
|
||||
function minimist(args?: string[], opts?: minimist.Opts): minimist.ParsedArgs;
|
||||
|
||||
namespace minimist {
|
||||
export interface Opts {
|
||||
// a string or array of strings argument names to always treat as strings
|
||||
string?: string | string[];
|
||||
// a string or array of strings to always treat as booleans
|
||||
boolean?: boolean | string | string[];
|
||||
// an object mapping string names to strings or arrays of string argument names to use
|
||||
alias?: { [key: string]: string | string[] };
|
||||
// an object mapping string argument names to default values
|
||||
default?: { [key: string]: any };
|
||||
// when true, populate argv._ with everything after the first non-option
|
||||
stopEarly?: boolean;
|
||||
// a function which is invoked with a command line parameter not defined in the opts configuration object.
|
||||
// If the function returns false, the unknown option is not added to argv
|
||||
unknown?: (arg: string) => boolean;
|
||||
// when true, populate argv._ with everything before the -- and argv['--'] with everything after the --
|
||||
'--'?: boolean;
|
||||
}
|
||||
|
||||
export interface ParsedArgs {
|
||||
[arg: string]: any;
|
||||
_: string[];
|
||||
}
|
||||
}
|
||||
|
||||
export = minimist;
|
||||
}
|
14
src/typings/mocha.d.ts
vendored
14
src/typings/mocha.d.ts
vendored
|
@ -1,14 +0,0 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
declare function run(): void;
|
||||
|
||||
declare function suite(name: string, fn: (err?) => void);
|
||||
declare function test(name: string, fn: () => void);
|
||||
declare function test(name: string, fn: (done: (err?) => void) => void);
|
||||
declare function suiteSetup(fn: (done?: (err?) => void) => void);
|
||||
declare function suiteTeardown(fn: (done?: (err?) => void) => void);
|
||||
declare function setup(fn: (done?: (err?) => void) => void);
|
||||
declare function teardown(fn: (done?: (err?) => void) => void);
|
125
src/typings/semver.d.ts
vendored
125
src/typings/semver.d.ts
vendored
|
@ -1,125 +0,0 @@
|
|||
// Type definitions for semver v2.2.1
|
||||
// Project: https://github.com/isaacs/node-semver
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module SemVerModule {
|
||||
/**
|
||||
* Return the parsed version, or null if it's not valid.
|
||||
*/
|
||||
function valid(v: string, loose?: boolean): string;
|
||||
/**
|
||||
* Return the version incremented by the release type (major, minor, patch, or prerelease), or null if it's not valid.
|
||||
*/
|
||||
function inc(v: string, release: string, loose?: boolean): string;
|
||||
|
||||
// Comparison
|
||||
/**
|
||||
* v1 > v2
|
||||
*/
|
||||
function gt(v1: string, v2: string, loose?: boolean): boolean;
|
||||
/**
|
||||
* v1 >= v2
|
||||
*/
|
||||
function gte(v1: string, v2: string, loose?: boolean): boolean;
|
||||
/**
|
||||
* v1 < v2
|
||||
*/
|
||||
function lt(v1: string, v2: string, loose?: boolean): boolean;
|
||||
/**
|
||||
* v1 <= v2
|
||||
*/
|
||||
function lte(v1: string, v2: string, loose?: boolean): boolean;
|
||||
/**
|
||||
* v1 == v2 This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings.
|
||||
*/
|
||||
function eq(v1: string, v2: string, loose?: boolean): boolean;
|
||||
/**
|
||||
* v1 != v2 The opposite of eq.
|
||||
*/
|
||||
function neq(v1: string, v2: string, loose?: boolean): boolean;
|
||||
/**
|
||||
* Pass in a comparison string, and it'll call the corresponding semver comparison function. "===" and "!==" do simple string comparison, but are included for completeness. Throws if an invalid comparison string is provided.
|
||||
*/
|
||||
function cmp(v1: string, comparator: any, v2: string, loose?: boolean): boolean;
|
||||
/**
|
||||
* Return 0 if v1 == v2, or 1 if v1 is greater, or -1 if v2 is greater. Sorts in ascending order if passed to Array.sort().
|
||||
*/
|
||||
function compare(v1: string, v2: string, loose?: boolean): number;
|
||||
/**
|
||||
* The reverse of compare. Sorts an array of versions in descending order when passed to Array.sort().
|
||||
*/
|
||||
function rcompare(v1: string, v2: string, loose?: boolean): number;
|
||||
|
||||
// Ranges
|
||||
/**
|
||||
* Return the valid range or null if it's not valid
|
||||
*/
|
||||
function validRange(range: string, loose?: boolean): string;
|
||||
/**
|
||||
* Return true if the version satisfies the range.
|
||||
*/
|
||||
function satisfies(version: string, range: string, loose?: boolean): boolean;
|
||||
/**
|
||||
* Return the highest version in the list that satisfies the range, or null if none of them do.
|
||||
*/
|
||||
function maxSatisfying(versions: string[], range: string, loose?: boolean): string;
|
||||
/**
|
||||
* Return true if version is greater than all the versions possible in the range.
|
||||
*/
|
||||
function gtr(version: string, range: string, loose?: boolean): boolean;
|
||||
/**
|
||||
* Return true if version is less than all the versions possible in the range.
|
||||
*/
|
||||
function ltr(version: string, range: string, loose?: boolean): boolean;
|
||||
/**
|
||||
* Return true if the version is outside the bounds of the range in either the high or low direction. The hilo argument must be either the string '>' or '<'. (This is the function called by gtr and ltr.)
|
||||
*/
|
||||
function outside(version: string, range: string, hilo: string, loose?: boolean): boolean;
|
||||
|
||||
class SemVerBase {
|
||||
raw: string;
|
||||
loose: boolean;
|
||||
format(): string;
|
||||
inspect(): string;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
class SemVer extends SemVerBase {
|
||||
constructor(version: string, loose?: boolean);
|
||||
|
||||
major: number;
|
||||
minor: number;
|
||||
patch: number;
|
||||
version: string;
|
||||
build: string[];
|
||||
prerelease: string[];
|
||||
|
||||
compare(other: SemVer): number;
|
||||
compareMain(other: SemVer): number;
|
||||
comparePre(other: SemVer): number;
|
||||
inc(release: string): SemVer;
|
||||
}
|
||||
|
||||
class Comparator extends SemVerBase {
|
||||
constructor(comp: string, loose?: boolean);
|
||||
|
||||
semver: SemVer;
|
||||
operator: string;
|
||||
value: boolean;
|
||||
parse(comp: string): void;
|
||||
test(version: SemVer): boolean;
|
||||
}
|
||||
|
||||
class Range extends SemVerBase {
|
||||
constructor(range: string, loose?: boolean);
|
||||
|
||||
set: Comparator[][];
|
||||
parseRange(range: string): Comparator[];
|
||||
test(version: SemVer): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "semver" {
|
||||
export = SemVerModule;
|
||||
}
|
448
src/typings/sinon.d.ts
vendored
448
src/typings/sinon.d.ts
vendored
|
@ -1,448 +0,0 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
// Type definitions for Sinon 1.16.0
|
||||
// Project: http://sinonjs.org/
|
||||
// Definitions by: William Sears <https://github.com/mrbigdog2u>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module '~sinon/lib/sinon' {
|
||||
module Sinon {
|
||||
export interface SinonSpyCallApi {
|
||||
// Properties
|
||||
thisValue: any;
|
||||
args: any[];
|
||||
exception: any;
|
||||
returnValue: any;
|
||||
|
||||
// Methods
|
||||
calledOn(obj: any): boolean;
|
||||
calledWith(...args: any[]): boolean;
|
||||
calledWithExactly(...args: any[]): boolean;
|
||||
calledWithMatch(...args: any[]): boolean;
|
||||
notCalledWith(...args: any[]): boolean;
|
||||
notCalledWithMatch(...args: any[]): boolean;
|
||||
returned(value: any): boolean;
|
||||
threw(): boolean;
|
||||
threw(type: string): boolean;
|
||||
threw(obj: any): boolean;
|
||||
callArg(pos: number): void;
|
||||
callArgOn(pos: number, obj: any, ...args: any[]): void;
|
||||
callArgWith(pos: number, ...args: any[]): void;
|
||||
callArgOnWith(pos: number, obj: any, ...args: any[]): void;
|
||||
yield(...args: any[]): void;
|
||||
yieldOn(obj: any, ...args: any[]): void;
|
||||
yieldTo(property: string, ...args: any[]): void;
|
||||
yieldToOn(property: string, obj: any, ...args: any[]): void;
|
||||
}
|
||||
|
||||
export interface SinonSpyCall extends SinonSpyCallApi {
|
||||
calledBefore(call: SinonSpyCall): boolean;
|
||||
calledAfter(call: SinonSpyCall): boolean;
|
||||
calledWithNew(call: SinonSpyCall): boolean;
|
||||
}
|
||||
|
||||
export interface SinonSpy extends SinonSpyCallApi {
|
||||
// Properties
|
||||
callCount: number;
|
||||
called: boolean;
|
||||
notCalled: boolean;
|
||||
calledOnce: boolean;
|
||||
calledTwice: boolean;
|
||||
calledThrice: boolean;
|
||||
firstCall: SinonSpyCall;
|
||||
secondCall: SinonSpyCall;
|
||||
thirdCall: SinonSpyCall;
|
||||
lastCall: SinonSpyCall;
|
||||
thisValues: any[];
|
||||
args: any[][];
|
||||
exceptions: any[];
|
||||
returnValues: any[];
|
||||
|
||||
// Methods
|
||||
(...args: any[]): any;
|
||||
calledBefore(anotherSpy: SinonSpy): boolean;
|
||||
calledAfter(anotherSpy: SinonSpy): boolean;
|
||||
calledWithNew(spy: SinonSpy): boolean;
|
||||
withArgs(...args: any[]): SinonSpy;
|
||||
alwaysCalledOn(obj: any): boolean;
|
||||
alwaysCalledWith(...args: any[]): boolean;
|
||||
alwaysCalledWithExactly(...args: any[]): boolean;
|
||||
alwaysCalledWithMatch(...args: any[]): boolean;
|
||||
neverCalledWith(...args: any[]): boolean;
|
||||
neverCalledWithMatch(...args: any[]): boolean;
|
||||
alwaysThrew(): boolean;
|
||||
alwaysThrew(type: string): boolean;
|
||||
alwaysThrew(obj: any): boolean;
|
||||
alwaysReturned(): boolean;
|
||||
invokeCallback(...args: any[]): void;
|
||||
getCall(n: number): SinonSpyCall;
|
||||
getCalls(): SinonSpyCall[];
|
||||
reset(): void;
|
||||
printf(format: string, ...args: any[]): string;
|
||||
restore(): void;
|
||||
}
|
||||
|
||||
export interface SinonSpyStatic {
|
||||
(): SinonSpy;
|
||||
(func: any): SinonSpy;
|
||||
(obj: any, method: string): SinonSpy;
|
||||
}
|
||||
|
||||
export interface SinonStatic {
|
||||
spy: SinonSpyStatic;
|
||||
}
|
||||
|
||||
export interface SinonStub extends SinonSpy {
|
||||
resetBehavior(): void;
|
||||
returns(obj: any): SinonStub;
|
||||
returnsArg(index: number): SinonStub;
|
||||
returnsThis(): SinonStub;
|
||||
throws(type?: string): SinonStub;
|
||||
throws(obj: any): SinonStub;
|
||||
callsArg(index: number): SinonStub;
|
||||
callsArgOn(index: number, context: any): SinonStub;
|
||||
callsArgWith(index: number, ...args: any[]): SinonStub;
|
||||
callsArgOnWith(index: number, context: any, ...args: any[]): SinonStub;
|
||||
callsArgAsync(index: number): SinonStub;
|
||||
callsArgOnAsync(index: number, context: any): SinonStub;
|
||||
callsArgWithAsync(index: number, ...args: any[]): SinonStub;
|
||||
callsArgOnWithAsync(index: number, context: any, ...args: any[]): SinonStub;
|
||||
onCall(n: number): SinonStub;
|
||||
onFirstCall(): SinonStub;
|
||||
onSecondCall(): SinonStub;
|
||||
onThirdCall(): SinonStub;
|
||||
yields(...args: any[]): SinonStub;
|
||||
yieldsOn(context: any, ...args: any[]): SinonStub;
|
||||
yieldsTo(property: string, ...args: any[]): SinonStub;
|
||||
yieldsToOn(property: string, context: any, ...args: any[]): SinonStub;
|
||||
yieldsAsync(...args: any[]): SinonStub;
|
||||
yieldsOnAsync(context: any, ...args: any[]): SinonStub;
|
||||
yieldsToAsync(property: string, ...args: any[]): SinonStub;
|
||||
yieldsToOnAsync(property: string, context: any, ...args: any[]): SinonStub;
|
||||
withArgs(...args: any[]): SinonStub;
|
||||
}
|
||||
|
||||
export interface SinonStubStatic {
|
||||
(): SinonStub;
|
||||
(obj: any): SinonStub;
|
||||
(obj: any, method: string): SinonStub;
|
||||
(obj: any, method: string, func: any): SinonStub;
|
||||
}
|
||||
|
||||
export interface SinonStatic {
|
||||
stub: SinonStubStatic;
|
||||
}
|
||||
|
||||
export interface SinonExpectation extends SinonStub {
|
||||
atLeast(n: number): SinonExpectation;
|
||||
atMost(n: number): SinonExpectation;
|
||||
never(): SinonExpectation;
|
||||
once(): SinonExpectation;
|
||||
twice(): SinonExpectation;
|
||||
thrice(): SinonExpectation;
|
||||
exactly(n: number): SinonExpectation;
|
||||
withArgs(...args: any[]): SinonExpectation;
|
||||
withExactArgs(...args: any[]): SinonExpectation;
|
||||
on(obj: any): SinonExpectation;
|
||||
verify(): SinonExpectation;
|
||||
restore(): void;
|
||||
}
|
||||
|
||||
export interface SinonExpectationStatic {
|
||||
create(methodName?: string): SinonExpectation;
|
||||
}
|
||||
|
||||
export interface SinonMock {
|
||||
expects(method: string): SinonExpectation;
|
||||
restore(): void;
|
||||
verify(): void;
|
||||
}
|
||||
|
||||
export interface SinonMockStatic {
|
||||
(): SinonExpectation;
|
||||
(obj: any): SinonMock;
|
||||
}
|
||||
|
||||
export interface SinonStatic {
|
||||
expectation: SinonExpectationStatic;
|
||||
mock: SinonMockStatic;
|
||||
}
|
||||
|
||||
export interface SinonFakeTimers {
|
||||
now: number;
|
||||
create(now: number): SinonFakeTimers;
|
||||
setTimeout(callback: (...args: any[]) => void, timeout: number, ...args: any[]): number;
|
||||
clearTimeout(id: number): void;
|
||||
setInterval(callback: (...args: any[]) => void, timeout: number, ...args: any[]): number;
|
||||
clearInterval(id: number): void;
|
||||
tick(ms: number): number;
|
||||
reset(): void;
|
||||
Date(): Date;
|
||||
Date(year: number): Date;
|
||||
Date(year: number, month: number): Date;
|
||||
Date(year: number, month: number, day: number): Date;
|
||||
Date(year: number, month: number, day: number, hour: number): Date;
|
||||
Date(year: number, month: number, day: number, hour: number, minute: number): Date;
|
||||
Date(year: number, month: number, day: number, hour: number, minute: number, second: number): Date;
|
||||
Date(year: number, month: number, day: number, hour: number, minute: number, second: number, ms: number): Date;
|
||||
restore(): void;
|
||||
|
||||
/**
|
||||
* Simulate the user changing the system clock while your program is running. It changes the 'now' timestamp
|
||||
* without affecting timers, intervals or immediates.
|
||||
* @param now The new 'now' in unix milliseconds
|
||||
*/
|
||||
setSystemTime(now: number): void;
|
||||
/**
|
||||
* Simulate the user changing the system clock while your program is running. It changes the 'now' timestamp
|
||||
* without affecting timers, intervals or immediates.
|
||||
* @param now The new 'now' as a JavaScript Date
|
||||
*/
|
||||
setSystemTime(date: Date): void;
|
||||
}
|
||||
|
||||
export interface SinonFakeTimersStatic {
|
||||
(): SinonFakeTimers;
|
||||
(...timers: string[]): SinonFakeTimers;
|
||||
(now: number, ...timers: string[]): SinonFakeTimers;
|
||||
}
|
||||
|
||||
export interface SinonStatic {
|
||||
useFakeTimers: SinonFakeTimersStatic;
|
||||
clock: SinonFakeTimers;
|
||||
}
|
||||
|
||||
export interface SinonFakeUploadProgress {
|
||||
eventListeners: {
|
||||
progress: any[];
|
||||
load: any[];
|
||||
abort: any[];
|
||||
error: any[];
|
||||
};
|
||||
|
||||
addEventListener(event: string, listener: (e: Event) => any): void;
|
||||
removeEventListener(event: string, listener: (e: Event) => any): void;
|
||||
dispatchEvent(event: Event): void;
|
||||
}
|
||||
|
||||
export interface SinonFakeXMLHttpRequest {
|
||||
// Properties
|
||||
onCreate: (xhr: SinonFakeXMLHttpRequest) => void;
|
||||
url: string;
|
||||
method: string;
|
||||
requestHeaders: any;
|
||||
requestBody: string;
|
||||
status: number;
|
||||
statusText: string;
|
||||
async: boolean;
|
||||
username: string;
|
||||
password: string;
|
||||
withCredentials: boolean;
|
||||
upload: SinonFakeUploadProgress;
|
||||
responseXML: Document;
|
||||
getResponseHeader(header: string): string;
|
||||
getAllResponseHeaders(): any;
|
||||
|
||||
// Methods
|
||||
restore(): void;
|
||||
useFilters: boolean;
|
||||
addFilter(filter: (method: string, url: string, async: boolean, username: string, password: string) => boolean): void;
|
||||
setResponseHeaders(headers: any): void;
|
||||
setResponseBody(body: string): void;
|
||||
respond(status: number, headers: any, body: string): void;
|
||||
autoRespond(ms: number): void;
|
||||
}
|
||||
|
||||
export interface SinonFakeXMLHttpRequestStatic {
|
||||
(): SinonFakeXMLHttpRequest;
|
||||
}
|
||||
|
||||
export interface SinonStatic {
|
||||
useFakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic;
|
||||
FakeXMLHttpRequest: SinonFakeXMLHttpRequest;
|
||||
}
|
||||
|
||||
export interface SinonFakeServer {
|
||||
// Properties
|
||||
autoRespond: boolean;
|
||||
autoRespondAfter: number;
|
||||
fakeHTTPMethods: boolean;
|
||||
getHTTPMethod: (request: SinonFakeXMLHttpRequest) => string;
|
||||
requests: SinonFakeXMLHttpRequest[];
|
||||
respondImmediately: boolean;
|
||||
|
||||
// Methods
|
||||
respondWith(body: string): void;
|
||||
respondWith(response: any[]): void;
|
||||
respondWith(fn: (xhr: SinonFakeXMLHttpRequest) => void): void;
|
||||
respondWith(url: string, body: string): void;
|
||||
respondWith(url: string, response: any[]): void;
|
||||
respondWith(url: string, fn: (xhr: SinonFakeXMLHttpRequest) => void): void;
|
||||
respondWith(method: string, url: string, body: string): void;
|
||||
respondWith(method: string, url: string, response: any[]): void;
|
||||
respondWith(method: string, url: string, fn: (xhr: SinonFakeXMLHttpRequest) => void): void;
|
||||
respondWith(url: RegExp, body: string): void;
|
||||
respondWith(url: RegExp, response: any[]): void;
|
||||
respondWith(url: RegExp, fn: (xhr: SinonFakeXMLHttpRequest) => void): void;
|
||||
respondWith(method: string, url: RegExp, body: string): void;
|
||||
respondWith(method: string, url: RegExp, response: any[]): void;
|
||||
respondWith(method: string, url: RegExp, fn: (xhr: SinonFakeXMLHttpRequest) => void): void;
|
||||
respond(): void;
|
||||
restore(): void;
|
||||
}
|
||||
|
||||
export interface SinonFakeServerStatic {
|
||||
create(): SinonFakeServer;
|
||||
}
|
||||
|
||||
export interface SinonStatic {
|
||||
fakeServer: SinonFakeServerStatic;
|
||||
fakeServerWithClock: SinonFakeServerStatic;
|
||||
}
|
||||
|
||||
export interface SinonExposeOptions {
|
||||
prefix?: string;
|
||||
includeFail?: boolean;
|
||||
}
|
||||
|
||||
export interface SinonAssert {
|
||||
// Properties
|
||||
failException: string;
|
||||
fail: (message?: string) => void; // Overridable
|
||||
pass: (assertion: any) => void; // Overridable
|
||||
|
||||
// Methods
|
||||
notCalled(spy: SinonSpy): void;
|
||||
called(spy: SinonSpy): void;
|
||||
calledOnce(spy: SinonSpy): void;
|
||||
calledTwice(spy: SinonSpy): void;
|
||||
calledThrice(spy: SinonSpy): void;
|
||||
callCount(spy: SinonSpy, count: number): void;
|
||||
callOrder(...spies: SinonSpy[]): void;
|
||||
calledOn(spy: SinonSpy, obj: any): void;
|
||||
alwaysCalledOn(spy: SinonSpy, obj: any): void;
|
||||
calledWith(spy: SinonSpy, ...args: any[]): void;
|
||||
alwaysCalledWith(spy: SinonSpy, ...args: any[]): void;
|
||||
neverCalledWith(spy: SinonSpy, ...args: any[]): void;
|
||||
calledWithExactly(spy: SinonSpy, ...args: any[]): void;
|
||||
alwaysCalledWithExactly(spy: SinonSpy, ...args: any[]): void;
|
||||
calledWithMatch(spy: SinonSpy, ...args: any[]): void;
|
||||
alwaysCalledWithMatch(spy: SinonSpy, ...args: any[]): void;
|
||||
neverCalledWithMatch(spy: SinonSpy, ...args: any[]): void;
|
||||
threw(spy: SinonSpy): void;
|
||||
threw(spy: SinonSpy, exception: string): void;
|
||||
threw(spy: SinonSpy, exception: any): void;
|
||||
alwaysThrew(spy: SinonSpy): void;
|
||||
alwaysThrew(spy: SinonSpy, exception: string): void;
|
||||
alwaysThrew(spy: SinonSpy, exception: any): void;
|
||||
expose(obj: any, options?: SinonExposeOptions): void;
|
||||
}
|
||||
|
||||
export interface SinonStatic {
|
||||
assert: SinonAssert;
|
||||
}
|
||||
|
||||
export interface SinonMatcher {
|
||||
and(expr: SinonMatcher): SinonMatcher;
|
||||
or(expr: SinonMatcher): SinonMatcher;
|
||||
}
|
||||
|
||||
export interface SinonMatch {
|
||||
(value: number): SinonMatcher;
|
||||
(value: string): SinonMatcher;
|
||||
(expr: RegExp): SinonMatcher;
|
||||
(obj: any): SinonMatcher;
|
||||
(callback: (value: any) => boolean): SinonMatcher;
|
||||
any: SinonMatcher;
|
||||
defined: SinonMatcher;
|
||||
truthy: SinonMatcher;
|
||||
falsy: SinonMatcher;
|
||||
bool: SinonMatcher;
|
||||
number: SinonMatcher;
|
||||
string: SinonMatcher;
|
||||
object: SinonMatcher;
|
||||
func: SinonMatcher;
|
||||
array: SinonMatcher;
|
||||
regexp: SinonMatcher;
|
||||
date: SinonMatcher;
|
||||
same(obj: any): SinonMatcher;
|
||||
typeOf(type: string): SinonMatcher;
|
||||
instanceOf(type: any): SinonMatcher;
|
||||
has(property: string, expect?: any): SinonMatcher;
|
||||
hasOwn(property: string, expect?: any): SinonMatcher;
|
||||
}
|
||||
|
||||
export interface SinonStatic {
|
||||
match: SinonMatch;
|
||||
}
|
||||
|
||||
export interface SinonSandboxConfig {
|
||||
injectInto?: any;
|
||||
properties?: string[];
|
||||
useFakeTimers?: any;
|
||||
useFakeServer?: any;
|
||||
}
|
||||
|
||||
export interface SinonSandbox {
|
||||
clock: SinonFakeTimers;
|
||||
requests: SinonFakeXMLHttpRequest;
|
||||
server: SinonFakeServer;
|
||||
spy: SinonSpyStatic;
|
||||
stub: SinonStubStatic;
|
||||
mock: SinonMockStatic;
|
||||
useFakeTimers: SinonFakeTimersStatic;
|
||||
useFakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic;
|
||||
useFakeServer(): SinonFakeServer;
|
||||
restore(): void;
|
||||
}
|
||||
|
||||
export interface SinonSandboxStatic {
|
||||
create(): SinonSandbox;
|
||||
create(config: SinonSandboxConfig): SinonSandbox;
|
||||
}
|
||||
|
||||
export interface SinonStatic {
|
||||
sandbox: SinonSandboxStatic;
|
||||
}
|
||||
|
||||
export interface SinonTestConfig {
|
||||
injectIntoThis?: boolean;
|
||||
injectInto?: any;
|
||||
properties?: string[];
|
||||
useFakeTimers?: boolean;
|
||||
useFakeServer?: boolean;
|
||||
}
|
||||
|
||||
export interface SinonTestWrapper extends SinonSandbox {
|
||||
(...args: any[]): any;
|
||||
}
|
||||
|
||||
export interface SinonStatic {
|
||||
config: SinonTestConfig;
|
||||
test(fn: (...args: any[]) => any): SinonTestWrapper;
|
||||
testCase(tests: any): any;
|
||||
}
|
||||
|
||||
// Utility overridables
|
||||
export interface SinonStatic {
|
||||
createStubInstance(constructor: any): SinonStub;
|
||||
format(obj: any): string;
|
||||
log(message: string): void;
|
||||
restore(object: any): void;
|
||||
}
|
||||
}
|
||||
|
||||
var Sinon: Sinon.SinonStatic;
|
||||
|
||||
export = Sinon;
|
||||
}
|
||||
declare module 'sinon/lib/sinon' {
|
||||
import main = require('~sinon/lib/sinon');
|
||||
export = main;
|
||||
}
|
||||
declare module 'sinon' {
|
||||
import main = require('~sinon/lib/sinon');
|
||||
export = main;
|
||||
}
|
Loading…
Reference in a new issue