Merge pull request #3 from Microsoft/users/subraman/vmware-checkpoint
Users/subraman/vmware checkpoint
This commit is contained in:
Коммит
c48a44cd4b
18
gulpfile.js
18
gulpfile.js
|
@ -12,16 +12,17 @@ var testFiles = [buildDirectory + "/**/*Tests*.js"];
|
||||||
var compilation = tsb.create({
|
var compilation = tsb.create({
|
||||||
target: 'es5',
|
target: 'es5',
|
||||||
module: 'commonjs',
|
module: 'commonjs',
|
||||||
declaration: false
|
declaration: false,
|
||||||
|
verbose: false
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("build", ["clean", "lint"], function() {
|
gulp.task("build", ["lint"], function() {
|
||||||
return gulp.src(sourceFiles, { base: "." })
|
return gulp.src(sourceFiles, { base: "." })
|
||||||
.pipe(compilation())
|
.pipe(compilation())
|
||||||
.pipe(gulp.dest(buildDirectory));
|
.pipe(gulp.dest(buildDirectory));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("lint", ["clean"], function() {
|
gulp.task("lint", function() {
|
||||||
return gulp.src(sourceFiles)
|
return gulp.src(sourceFiles)
|
||||||
.pipe(tslint())
|
.pipe(tslint())
|
||||||
.pipe(tslint.report("verbose"))
|
.pipe(tslint.report("verbose"))
|
||||||
|
@ -36,7 +37,16 @@ gulp.task("clean", function(done) {
|
||||||
|
|
||||||
gulp.task("test", ["build"], function() {
|
gulp.task("test", ["build"], function() {
|
||||||
return gulp.src(testFiles, { read: false })
|
return gulp.src(testFiles, { read: false })
|
||||||
.pipe(mocha( { reporter: 'xunit', reporterOptions: { output: '_build/testTaskMochTestResult.xml'} } ));
|
.pipe(mocha());
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task("testci", ["build"], function() {
|
||||||
|
return gulp.src(testFiles, { read: false })
|
||||||
|
.pipe(mocha({ reporter: 'xunit', reporterOptions: { output: '_build/testTaskMochaTestResult.xml'} }));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task("watch", function() {
|
||||||
|
gulp.watch(sourceFiles, ["test"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("default", ["build"]);
|
gulp.task("default", ["build"]);
|
||||||
|
|
23
package.json
23
package.json
|
@ -1,22 +1,29 @@
|
||||||
{
|
{
|
||||||
"name": "sample-typescript",
|
"name": "vso-vmware",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Sample typescript project",
|
"description": "VMWare extension with tasks for Visual Studio Team Services.",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"author": "Microsoft",
|
"author": "Microsoft",
|
||||||
"license": "Microsoft",
|
"license": "MIT",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Microsoft/vso-vmware.git"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"chai": "^3.4.1",
|
||||||
"gulp": "^3.9.0",
|
"gulp": "^3.9.0",
|
||||||
"gulp-mocha": "^2.1.3",
|
"gulp-mocha": "^2.1.3",
|
||||||
"gulp-tsb": "^1.7.4",
|
"gulp-tsb": "^1.7.4",
|
||||||
"gulp-tslint": "^3.5.0",
|
"gulp-tslint": "^3.5.0",
|
||||||
"mocha": "^2.3.3",
|
"mocha": "^2.3.3",
|
||||||
"rimraf": "^2.4.3",
|
"rimraf": "^2.4.3",
|
||||||
|
"sinon": "^1.17.2",
|
||||||
|
"sinon-chai": "^2.8.0",
|
||||||
"tsd": "^0.6.5",
|
"tsd": "^0.6.5",
|
||||||
"tslint": "^2.5.1"
|
"tslint": "^2.5.1",
|
||||||
|
"vso-task-lib": "^0.5.4"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"vso-task-lib": "^0.5.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
/// <reference path="../../../typings/tsd.d.ts" />
|
||||||
|
|
||||||
// Writes hello world!
|
// Writes hello world!
|
||||||
export class HelloWorldWriter {
|
export class HelloWorldWriter {
|
||||||
public Write(): void {
|
public Write(): void {
|
||||||
throw new Error("Not implemented");
|
// throw new TypeError("Not implemented");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
|
/// <reference path="../../typings/tsd.d.ts"/>
|
||||||
|
|
||||||
import * as assert from "assert";
|
import * as assert from "assert";
|
||||||
import * as testTask from "../../src/Tasks/TestTask/testTask";
|
import * as testTask from "../../src/Tasks/TestTask/testTask";
|
||||||
|
|
||||||
describe("HelloWorldWriter.Write", () : void => {
|
describe("HelloWorldWriter.Write", () : void => {
|
||||||
it("should throw not implemented error", () : void => {
|
it("should throw not implemented error", () : void => {
|
||||||
assert.throws(() : void => {
|
assert.doesNotThrow(() : void => {
|
||||||
// dummy code
|
// dummy code
|
||||||
var helloWorldWriter = new testTask.HelloWorldWriter();
|
var helloWorldWriter = new testTask.HelloWorldWriter();
|
||||||
helloWorldWriter.Write();
|
helloWorldWriter.Write();
|
||||||
|
|
43
tsd.json
43
tsd.json
|
@ -1,16 +1,27 @@
|
||||||
{
|
{
|
||||||
"version": "v4",
|
"version": "v4",
|
||||||
"repo": "borisyankov/DefinitelyTyped",
|
"repo": "borisyankov/DefinitelyTyped",
|
||||||
"ref": "master",
|
"ref": "master",
|
||||||
"path": "typings",
|
"path": "typings",
|
||||||
"bundle": "typings/tsd.d.ts",
|
"bundle": "typings/tsd.d.ts",
|
||||||
"installed": {
|
"installed": {
|
||||||
"mocha/mocha.d.ts": {
|
"mocha/mocha.d.ts": {
|
||||||
"commit": "eb59a40d3c2f3257e34ec2ede181046230814a41"
|
"commit": "eb59a40d3c2f3257e34ec2ede181046230814a41"
|
||||||
},
|
},
|
||||||
"node/node.d.ts": {
|
"node/node.d.ts": {
|
||||||
"commit": "eb59a40d3c2f3257e34ec2ede181046230814a41"
|
"commit": "eb59a40d3c2f3257e34ec2ede181046230814a41"
|
||||||
}
|
},
|
||||||
}
|
"chai/chai.d.ts": {
|
||||||
}
|
"commit": "220716d99a77df1654fb4f6cd760dc134ffa8e89"
|
||||||
|
},
|
||||||
|
"assertion-error/assertion-error.d.ts": {
|
||||||
|
"commit": "220716d99a77df1654fb4f6cd760dc134ffa8e89"
|
||||||
|
},
|
||||||
|
"sinon/sinon.d.ts": {
|
||||||
|
"commit": "220716d99a77df1654fb4f6cd760dc134ffa8e89"
|
||||||
|
},
|
||||||
|
"sinon-chai/sinon-chai.d.ts": {
|
||||||
|
"commit": "220716d99a77df1654fb4f6cd760dc134ffa8e89"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
// Type definitions for assertion-error 1.0.0
|
||||||
|
// Project: https://github.com/chaijs/assertion-error
|
||||||
|
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||||
|
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||||
|
|
||||||
|
declare module 'assertion-error' {
|
||||||
|
class AssertionError implements Error {
|
||||||
|
constructor(message: string, props?: any, ssf?: Function);
|
||||||
|
name: string;
|
||||||
|
message: string;
|
||||||
|
showDiff: boolean;
|
||||||
|
stack: string;
|
||||||
|
}
|
||||||
|
export = AssertionError;
|
||||||
|
}
|
|
@ -0,0 +1,388 @@
|
||||||
|
// Type definitions for chai 3.2.0
|
||||||
|
// Project: http://chaijs.com/
|
||||||
|
// Definitions by: Jed Mao <https://github.com/jedmao/>,
|
||||||
|
// Bart van der Schoor <https://github.com/Bartvds>,
|
||||||
|
// Andrew Brown <https://github.com/AGBrown>,
|
||||||
|
// Olivier Chevet <https://github.com/olivr70>
|
||||||
|
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||||
|
|
||||||
|
// <reference path="../assertion-error/assertion-error.d.ts"/>
|
||||||
|
|
||||||
|
declare module Chai {
|
||||||
|
|
||||||
|
interface ChaiStatic {
|
||||||
|
expect: ExpectStatic;
|
||||||
|
should(): Should;
|
||||||
|
/**
|
||||||
|
* Provides a way to extend the internals of Chai
|
||||||
|
*/
|
||||||
|
use(fn: (chai: any, utils: any) => void): any;
|
||||||
|
assert: AssertStatic;
|
||||||
|
config: Config;
|
||||||
|
AssertionError: typeof AssertionError;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExpectStatic extends AssertionStatic {
|
||||||
|
fail(actual?: any, expected?: any, message?: string, operator?: string): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AssertStatic extends Assert {
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AssertionStatic {
|
||||||
|
(target: any, message?: string): Assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ShouldAssertion {
|
||||||
|
equal(value1: any, value2: any, message?: string): void;
|
||||||
|
Throw: ShouldThrow;
|
||||||
|
throw: ShouldThrow;
|
||||||
|
exist(value: any, message?: string): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Should extends ShouldAssertion {
|
||||||
|
not: ShouldAssertion;
|
||||||
|
fail(actual: any, expected: any, message?: string, operator?: string): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ShouldThrow {
|
||||||
|
(actual: Function): void;
|
||||||
|
(actual: Function, expected: string|RegExp, message?: string): void;
|
||||||
|
(actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
|
||||||
|
not: Assertion;
|
||||||
|
deep: Deep;
|
||||||
|
any: KeyFilter;
|
||||||
|
all: KeyFilter;
|
||||||
|
a: TypeComparison;
|
||||||
|
an: TypeComparison;
|
||||||
|
include: Include;
|
||||||
|
includes: Include;
|
||||||
|
contain: Include;
|
||||||
|
contains: Include;
|
||||||
|
ok: Assertion;
|
||||||
|
true: Assertion;
|
||||||
|
false: Assertion;
|
||||||
|
null: Assertion;
|
||||||
|
undefined: Assertion;
|
||||||
|
NaN: Assertion;
|
||||||
|
exist: Assertion;
|
||||||
|
empty: Assertion;
|
||||||
|
arguments: Assertion;
|
||||||
|
Arguments: Assertion;
|
||||||
|
equal: Equal;
|
||||||
|
equals: Equal;
|
||||||
|
eq: Equal;
|
||||||
|
eql: Equal;
|
||||||
|
eqls: Equal;
|
||||||
|
property: Property;
|
||||||
|
ownProperty: OwnProperty;
|
||||||
|
haveOwnProperty: OwnProperty;
|
||||||
|
ownPropertyDescriptor: OwnPropertyDescriptor;
|
||||||
|
haveOwnPropertyDescriptor: OwnPropertyDescriptor;
|
||||||
|
length: Length;
|
||||||
|
lengthOf: Length;
|
||||||
|
match: Match;
|
||||||
|
matches: Match;
|
||||||
|
string(string: string, message?: string): Assertion;
|
||||||
|
keys: Keys;
|
||||||
|
key(string: string): Assertion;
|
||||||
|
throw: Throw;
|
||||||
|
throws: Throw;
|
||||||
|
Throw: Throw;
|
||||||
|
respondTo: RespondTo;
|
||||||
|
respondsTo: RespondTo;
|
||||||
|
itself: Assertion;
|
||||||
|
satisfy: Satisfy;
|
||||||
|
satisfies: Satisfy;
|
||||||
|
closeTo(expected: number, delta: number, message?: string): Assertion;
|
||||||
|
members: Members;
|
||||||
|
increase: PropertyChange;
|
||||||
|
increases: PropertyChange;
|
||||||
|
decrease: PropertyChange;
|
||||||
|
decreases: PropertyChange;
|
||||||
|
change: PropertyChange;
|
||||||
|
changes: PropertyChange;
|
||||||
|
extensible: Assertion;
|
||||||
|
sealed: Assertion;
|
||||||
|
frozen: Assertion;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
interface LanguageChains {
|
||||||
|
to: Assertion;
|
||||||
|
be: Assertion;
|
||||||
|
been: Assertion;
|
||||||
|
is: Assertion;
|
||||||
|
that: Assertion;
|
||||||
|
which: Assertion;
|
||||||
|
and: Assertion;
|
||||||
|
has: Assertion;
|
||||||
|
have: Assertion;
|
||||||
|
with: Assertion;
|
||||||
|
at: Assertion;
|
||||||
|
of: Assertion;
|
||||||
|
same: Assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface NumericComparison {
|
||||||
|
above: NumberComparer;
|
||||||
|
gt: NumberComparer;
|
||||||
|
greaterThan: NumberComparer;
|
||||||
|
least: NumberComparer;
|
||||||
|
gte: NumberComparer;
|
||||||
|
below: NumberComparer;
|
||||||
|
lt: NumberComparer;
|
||||||
|
lessThan: NumberComparer;
|
||||||
|
most: NumberComparer;
|
||||||
|
lte: NumberComparer;
|
||||||
|
within(start: number, finish: number, message?: string): Assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface NumberComparer {
|
||||||
|
(value: number, message?: string): Assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TypeComparison {
|
||||||
|
(type: string, message?: string): Assertion;
|
||||||
|
instanceof: InstanceOf;
|
||||||
|
instanceOf: InstanceOf;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface InstanceOf {
|
||||||
|
(constructor: Object, message?: string): Assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Deep {
|
||||||
|
equal: Equal;
|
||||||
|
include: Include;
|
||||||
|
property: Property;
|
||||||
|
members: Members;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface KeyFilter {
|
||||||
|
keys: Keys;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Equal {
|
||||||
|
(value: any, message?: string): Assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Property {
|
||||||
|
(name: string, value?: any, message?: string): Assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface OwnProperty {
|
||||||
|
(name: string, message?: string): Assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface OwnPropertyDescriptor {
|
||||||
|
(name: string, descriptor: PropertyDescriptor, message?: string): Assertion;
|
||||||
|
(name: string, message?: string): Assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Length extends LanguageChains, NumericComparison {
|
||||||
|
(length: number, message?: string): Assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Include {
|
||||||
|
(value: Object, message?: string): Assertion;
|
||||||
|
(value: string, message?: string): Assertion;
|
||||||
|
(value: number, message?: string): Assertion;
|
||||||
|
keys: Keys;
|
||||||
|
members: Members;
|
||||||
|
any: KeyFilter;
|
||||||
|
all: KeyFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Match {
|
||||||
|
(regexp: RegExp|string, message?: string): Assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Keys {
|
||||||
|
(...keys: string[]): Assertion;
|
||||||
|
(keys: any[]): Assertion;
|
||||||
|
(keys: 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RespondTo {
|
||||||
|
(method: string, message?: string): Assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Satisfy {
|
||||||
|
(matcher: Function, message?: string): Assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Members {
|
||||||
|
(set: any[], message?: string): Assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PropertyChange {
|
||||||
|
(object: Object, prop: string, msg?: string): Assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Assert {
|
||||||
|
/**
|
||||||
|
* @param expression Expression to test for truthiness.
|
||||||
|
* @param message Message to display on error.
|
||||||
|
*/
|
||||||
|
(expression: any, message?: string): void;
|
||||||
|
|
||||||
|
fail(actual?: any, expected?: any, msg?: string, operator?: string): void;
|
||||||
|
|
||||||
|
ok(val: any, msg?: string): void;
|
||||||
|
isOk(val: any, msg?: string): void;
|
||||||
|
notOk(val: any, msg?: string): void;
|
||||||
|
isNotOk(val: any, msg?: string): void;
|
||||||
|
|
||||||
|
equal(act: any, exp: any, msg?: string): void;
|
||||||
|
notEqual(act: any, exp: any, msg?: string): void;
|
||||||
|
|
||||||
|
strictEqual(act: any, exp: any, msg?: string): void;
|
||||||
|
notStrictEqual(act: any, exp: any, msg?: string): void;
|
||||||
|
|
||||||
|
deepEqual(act: any, exp: any, msg?: string): void;
|
||||||
|
notDeepEqual(act: any, exp: any, msg?: string): void;
|
||||||
|
|
||||||
|
isTrue(val: any, msg?: string): void;
|
||||||
|
isFalse(val: any, msg?: string): void;
|
||||||
|
|
||||||
|
isNull(val: any, msg?: string): void;
|
||||||
|
isNotNull(val: any, msg?: string): void;
|
||||||
|
|
||||||
|
isUndefined(val: any, msg?: string): void;
|
||||||
|
isDefined(val: any, msg?: string): void;
|
||||||
|
|
||||||
|
isNaN(val: any, msg?: string): void;
|
||||||
|
isNotNaN(val: any, msg?: string): void;
|
||||||
|
|
||||||
|
isAbove(val: number, abv: number, msg?: string): void;
|
||||||
|
isBelow(val: number, blw: number, msg?: string): void;
|
||||||
|
|
||||||
|
isFunction(val: any, msg?: string): void;
|
||||||
|
isNotFunction(val: any, msg?: string): void;
|
||||||
|
|
||||||
|
isObject(val: any, msg?: string): void;
|
||||||
|
isNotObject(val: any, msg?: string): void;
|
||||||
|
|
||||||
|
isArray(val: any, msg?: string): void;
|
||||||
|
isNotArray(val: any, msg?: string): void;
|
||||||
|
|
||||||
|
isString(val: any, msg?: string): void;
|
||||||
|
isNotString(val: any, msg?: string): void;
|
||||||
|
|
||||||
|
isNumber(val: any, msg?: string): void;
|
||||||
|
isNotNumber(val: any, msg?: string): void;
|
||||||
|
|
||||||
|
isBoolean(val: any, msg?: string): void;
|
||||||
|
isNotBoolean(val: any, msg?: string): void;
|
||||||
|
|
||||||
|
typeOf(val: any, type: string, msg?: string): void;
|
||||||
|
notTypeOf(val: any, type: string, msg?: string): void;
|
||||||
|
|
||||||
|
instanceOf(val: any, type: Function, msg?: string): void;
|
||||||
|
notInstanceOf(val: any, type: Function, msg?: string): void;
|
||||||
|
|
||||||
|
include(exp: string, inc: any, msg?: string): void;
|
||||||
|
include(exp: any[], inc: any, msg?: string): void;
|
||||||
|
|
||||||
|
notInclude(exp: string, inc: any, msg?: string): void;
|
||||||
|
notInclude(exp: any[], inc: any, msg?: string): void;
|
||||||
|
|
||||||
|
match(exp: any, re: RegExp, msg?: string): void;
|
||||||
|
notMatch(exp: any, re: RegExp, msg?: string): void;
|
||||||
|
|
||||||
|
property(obj: Object, prop: string, msg?: string): void;
|
||||||
|
notProperty(obj: Object, prop: string, msg?: string): void;
|
||||||
|
deepProperty(obj: Object, prop: string, msg?: string): void;
|
||||||
|
notDeepProperty(obj: Object, prop: string, msg?: string): void;
|
||||||
|
|
||||||
|
propertyVal(obj: Object, prop: string, val: any, msg?: string): void;
|
||||||
|
propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void;
|
||||||
|
|
||||||
|
deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void;
|
||||||
|
deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void;
|
||||||
|
|
||||||
|
lengthOf(exp: any, len: number, msg?: string): void;
|
||||||
|
//alias frenzy
|
||||||
|
throw(fn: Function, msg?: string): void;
|
||||||
|
throw(fn: Function, regExp: RegExp): void;
|
||||||
|
throw(fn: Function, errType: Function, msg?: string): void;
|
||||||
|
throw(fn: Function, errType: Function, regExp: RegExp): void;
|
||||||
|
|
||||||
|
throws(fn: Function, msg?: string): void;
|
||||||
|
throws(fn: Function, regExp: RegExp): void;
|
||||||
|
throws(fn: Function, errType: Function, msg?: string): void;
|
||||||
|
throws(fn: Function, errType: Function, regExp: RegExp): void;
|
||||||
|
|
||||||
|
Throw(fn: Function, msg?: string): void;
|
||||||
|
Throw(fn: Function, regExp: RegExp): void;
|
||||||
|
Throw(fn: Function, errType: Function, msg?: string): void;
|
||||||
|
Throw(fn: Function, errType: Function, regExp: RegExp): void;
|
||||||
|
|
||||||
|
doesNotThrow(fn: Function, msg?: string): void;
|
||||||
|
doesNotThrow(fn: Function, regExp: RegExp): void;
|
||||||
|
doesNotThrow(fn: Function, errType: Function, msg?: string): void;
|
||||||
|
doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void;
|
||||||
|
|
||||||
|
operator(val: any, operator: string, val2: any, msg?: string): void;
|
||||||
|
closeTo(act: number, exp: number, delta: number, msg?: string): void;
|
||||||
|
|
||||||
|
sameMembers(set1: any[], set2: any[], msg?: string): void;
|
||||||
|
sameDeepMembers(set1: any[], set2: any[], msg?: string): void;
|
||||||
|
includeMembers(superset: any[], subset: any[], msg?: string): void;
|
||||||
|
|
||||||
|
ifError(val: any, msg?: string): void;
|
||||||
|
|
||||||
|
isExtensible(obj: {}, msg?: string): void;
|
||||||
|
extensible(obj: {}, msg?: string): void;
|
||||||
|
isNotExtensible(obj: {}, msg?: string): void;
|
||||||
|
notExtensible(obj: {}, msg?: string): void;
|
||||||
|
|
||||||
|
isSealed(obj: {}, msg?: string): void;
|
||||||
|
sealed(obj: {}, msg?: string): void;
|
||||||
|
isNotSealed(obj: {}, msg?: string): void;
|
||||||
|
notSealed(obj: {}, msg?: string): void;
|
||||||
|
|
||||||
|
isFrozen(obj: Object, msg?: string): void;
|
||||||
|
frozen(obj: Object, msg?: string): void;
|
||||||
|
isNotFrozen(obj: Object, msg?: string): void;
|
||||||
|
notFrozen(obj: Object, msg?: string): void;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Config {
|
||||||
|
includeStack: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class AssertionError {
|
||||||
|
constructor(message: string, _props?: any, ssf?: Function);
|
||||||
|
name: string;
|
||||||
|
message: string;
|
||||||
|
showDiff: boolean;
|
||||||
|
stack: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare var chai: Chai.ChaiStatic;
|
||||||
|
|
||||||
|
declare module "chai" {
|
||||||
|
export = chai;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Object {
|
||||||
|
should: Chai.Assertion;
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
// Type definitions for sinon-chai 2.7.0
|
||||||
|
// Project: https://github.com/domenic/sinon-chai
|
||||||
|
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>, Jed Mao <https://github.com/jedmao/>
|
||||||
|
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||||
|
|
||||||
|
/// <reference path="../chai/chai.d.ts" />
|
||||||
|
/// <reference path="../sinon/sinon.d.ts" />
|
||||||
|
|
||||||
|
declare module Chai {
|
||||||
|
|
||||||
|
interface LanguageChains {
|
||||||
|
always: Assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Assertion {
|
||||||
|
/**
|
||||||
|
* true if the spy was called at least once.
|
||||||
|
*/
|
||||||
|
called: Assertion;
|
||||||
|
/**
|
||||||
|
* @param count The number of recorded calls.
|
||||||
|
*/
|
||||||
|
callCount(count: number): Assertion;
|
||||||
|
/**
|
||||||
|
* true if the spy was called exactly once.
|
||||||
|
*/
|
||||||
|
calledOnce: Assertion;
|
||||||
|
/**
|
||||||
|
* true if the spy was called exactly twice.
|
||||||
|
*/
|
||||||
|
calledTwice: Assertion;
|
||||||
|
/**
|
||||||
|
* true if the spy was called exactly thrice.
|
||||||
|
*/
|
||||||
|
calledThrice: Assertion;
|
||||||
|
/**
|
||||||
|
* Returns true if the spy was called before anotherSpy.
|
||||||
|
*/
|
||||||
|
calledBefore(anotherSpy: Sinon.SinonSpy): Assertion;
|
||||||
|
/**
|
||||||
|
* Returns true if the spy was called after anotherSpy.
|
||||||
|
*/
|
||||||
|
calledAfter(anotherSpy: Sinon.SinonSpy): Assertion;
|
||||||
|
/**
|
||||||
|
* Returns true if spy/stub was called with the new operator. Beware that
|
||||||
|
* this is inferred based on the value of the this object and the spy
|
||||||
|
* function's prototype, so it may give false positives if you actively
|
||||||
|
* return the right kind of object.
|
||||||
|
*/
|
||||||
|
calledWithNew: Assertion;
|
||||||
|
/**
|
||||||
|
* Returns true if context was this for this call.
|
||||||
|
*/
|
||||||
|
calledOn(context: any): Assertion;
|
||||||
|
/**
|
||||||
|
* Returns true if call received provided arguments (and possibly others).
|
||||||
|
*/
|
||||||
|
calledWith(...args: any[]): Assertion;
|
||||||
|
/**
|
||||||
|
* Returns true if call received provided arguments and no others.
|
||||||
|
*/
|
||||||
|
calledWithExactly(...args: any[]): Assertion;
|
||||||
|
/**
|
||||||
|
* Returns true if call received matching arguments (and possibly others).
|
||||||
|
* This behaves the same as spyCall.calledWith(sinon.match(arg1), sinon.match(arg2), ...).
|
||||||
|
*/
|
||||||
|
calledWithMatch(...args: any[]): Assertion;
|
||||||
|
/**
|
||||||
|
* Returns true if spy returned the provided value at least once. Uses
|
||||||
|
* deep comparison for objects and arrays. Use spy.returned(sinon.match.same(obj))
|
||||||
|
* for strict comparison (see matchers).
|
||||||
|
*/
|
||||||
|
returned(obj: any): Assertion;
|
||||||
|
/**
|
||||||
|
* Returns true if spy threw the provided exception object at least once.
|
||||||
|
*/
|
||||||
|
thrown(obj?: Error|typeof Error|string): Assertion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "sinon-chai" {
|
||||||
|
function sinonChai(chai: any, utils: any): void;
|
||||||
|
export = sinonChai;
|
||||||
|
}
|
|
@ -0,0 +1,435 @@
|
||||||
|
// 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 {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonSpyCall extends SinonSpyCallApi {
|
||||||
|
calledBefore(call: SinonSpyCall): boolean;
|
||||||
|
calledAfter(call: SinonSpyCall): boolean;
|
||||||
|
calledWithNew(call: SinonSpyCall): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
reset(): void;
|
||||||
|
printf(format: string, ...args: any[]): string;
|
||||||
|
restore(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonSpyStatic {
|
||||||
|
(): SinonSpy;
|
||||||
|
(func: any): SinonSpy;
|
||||||
|
(obj: any, method: string): SinonSpy;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonStatic {
|
||||||
|
spy: SinonSpyStatic;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonStubStatic {
|
||||||
|
(): SinonStub;
|
||||||
|
(obj: any): SinonStub;
|
||||||
|
(obj: any, method: string): SinonStub;
|
||||||
|
(obj: any, method: string, func: any): SinonStub;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonStatic {
|
||||||
|
stub: SinonStubStatic;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonExpectationStatic {
|
||||||
|
create(methodName?: string): SinonExpectation;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonMock {
|
||||||
|
expects(method: string): SinonExpectation;
|
||||||
|
restore(): void;
|
||||||
|
verify(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonMockStatic {
|
||||||
|
(): SinonExpectation;
|
||||||
|
(obj: any): SinonMock;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonStatic {
|
||||||
|
expectation: SinonExpectationStatic;
|
||||||
|
mock: SinonMockStatic;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonFakeTimersStatic {
|
||||||
|
(): SinonFakeTimers;
|
||||||
|
(...timers: string[]): SinonFakeTimers;
|
||||||
|
(now: number, ...timers: string[]): SinonFakeTimers;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonStatic {
|
||||||
|
useFakeTimers: SinonFakeTimersStatic;
|
||||||
|
clock: SinonFakeTimers;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonFakeXMLHttpRequestStatic {
|
||||||
|
(): SinonFakeXMLHttpRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonStatic {
|
||||||
|
useFakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic;
|
||||||
|
FakeXMLHttpRequest: SinonFakeXMLHttpRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonFakeServerStatic {
|
||||||
|
create(): SinonFakeServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonStatic {
|
||||||
|
fakeServer: SinonFakeServerStatic;
|
||||||
|
fakeServerWithClock: SinonFakeServerStatic;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonExposeOptions {
|
||||||
|
prefix?: string;
|
||||||
|
includeFail?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonStatic {
|
||||||
|
assert: SinonAssert;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonMatcher {
|
||||||
|
and(expr: SinonMatcher): SinonMatcher;
|
||||||
|
or(expr: SinonMatcher): SinonMatcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonStatic {
|
||||||
|
match: SinonMatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonSandboxConfig {
|
||||||
|
injectInto?: any;
|
||||||
|
properties?: string[];
|
||||||
|
useFakeTimers?: any;
|
||||||
|
useFakeServer?: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonSandbox {
|
||||||
|
clock: SinonFakeTimers;
|
||||||
|
requests: SinonFakeXMLHttpRequest;
|
||||||
|
server: SinonFakeServer;
|
||||||
|
spy: SinonSpyStatic;
|
||||||
|
stub: SinonStubStatic;
|
||||||
|
mock: SinonMockStatic;
|
||||||
|
useFakeTimers: SinonFakeTimersStatic;
|
||||||
|
useFakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic;
|
||||||
|
useFakeServer(): SinonFakeServer;
|
||||||
|
restore(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonSandboxStatic {
|
||||||
|
create(): SinonSandbox;
|
||||||
|
create(config: SinonSandboxConfig): SinonSandbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonStatic {
|
||||||
|
sandbox: SinonSandboxStatic;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonTestConfig {
|
||||||
|
injectIntoThis?: boolean;
|
||||||
|
injectInto?: any;
|
||||||
|
properties?: string[];
|
||||||
|
useFakeTimers?: boolean;
|
||||||
|
useFakeServer?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonTestWrapper extends SinonSandbox {
|
||||||
|
(...args: any[]): any;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SinonStatic {
|
||||||
|
config: SinonTestConfig;
|
||||||
|
test(fn: (...args: any[]) => any): SinonTestWrapper;
|
||||||
|
testCase(tests: any): any;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Utility overridables
|
||||||
|
interface SinonStatic {
|
||||||
|
createStubInstance(constructor: any): SinonStub;
|
||||||
|
format(obj: any): string;
|
||||||
|
log(message: string): void;
|
||||||
|
restore(object: any): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare var sinon: Sinon.SinonStatic;
|
||||||
|
|
||||||
|
declare module "sinon" {
|
||||||
|
export = sinon;
|
||||||
|
}
|
|
@ -1,3 +1,6 @@
|
||||||
/// <reference path="mocha/mocha.d.ts" />
|
/// <reference path="mocha/mocha.d.ts" />
|
||||||
/// <reference path="node/node.d.ts" />
|
/// <reference path="node/node.d.ts" />
|
||||||
|
/// <reference path="assertion-error/assertion-error.d.ts" />
|
||||||
|
/// <reference path="chai/chai.d.ts" />
|
||||||
|
/// <reference path="sinon/sinon.d.ts" />
|
||||||
|
/// <reference path="sinon-chai/sinon-chai.d.ts" />
|
|
@ -0,0 +1,52 @@
|
||||||
|
declare module VsoTaskLib {
|
||||||
|
interface VsoTaskCommon {
|
||||||
|
|
||||||
|
// String convenience
|
||||||
|
setStdStream(stdStream: NodeJS.WritableStream): void;
|
||||||
|
setErrStream(errStream: NodeJS.WritableStream): void;
|
||||||
|
exit(code: number): void;
|
||||||
|
|
||||||
|
getVariable(name: string): string;
|
||||||
|
getInput(name: string, required?: boolean): string;
|
||||||
|
getDelimitedInput(name: string, delim: string, required?: boolean): string[];
|
||||||
|
getPathInput(name: string, required?: boolean, check?: boolean): string;
|
||||||
|
|
||||||
|
warning(message: string): void;
|
||||||
|
error(message: string): void;
|
||||||
|
debug(message: string): void;
|
||||||
|
command(command: string, properties?: any, message?: any): void;
|
||||||
|
|
||||||
|
cd(path: string): void;
|
||||||
|
pushd(path: string): void;
|
||||||
|
popd(): void;
|
||||||
|
|
||||||
|
checkPath(path: string, name: string): void;
|
||||||
|
mkdirP(path: string): void;
|
||||||
|
which(tool: string, check?: boolean): string;
|
||||||
|
cp(options: any, source: string, dest: string): void;
|
||||||
|
|
||||||
|
match(list: string[], pattern: string, options?: any): string[];
|
||||||
|
matchFile(file: string, pattern: string, options?: any): boolean;
|
||||||
|
filter(pattern: string, options?: any): (file: string) => boolean;
|
||||||
|
|
||||||
|
getEndpointUrl(id: string, optional: boolean): string;
|
||||||
|
getEndpointAuthorization(id: string, optional: boolean): EndpointAuthorization;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EndpointAuthorization {
|
||||||
|
parameters: {
|
||||||
|
[key: string]: string;
|
||||||
|
};
|
||||||
|
scheme: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// var TaskCommand: any;
|
||||||
|
// var commandFromString: any;
|
||||||
|
// var ToolRunner: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare var vsotasklib: VsoTaskLib.VsoTaskCommon;
|
||||||
|
|
||||||
|
declare module "vso-task-lib" {
|
||||||
|
export = vsotasklib;
|
||||||
|
}
|
Загрузка…
Ссылка в новой задаче