initial commit
This commit is contained in:
Родитель
12efc819f8
Коммит
32115e0079
|
@ -31,3 +31,6 @@ node_modules
|
|||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Application Specific
|
||||
_build
|
|
@ -0,0 +1,36 @@
|
|||
# vsts-docker
|
||||
This is the source code repository of Docker extension for Visual Studio Team Services. This extension contains VSTS build tasks to work with Docker.
|
||||
|
||||
## Working with this repo
|
||||
|
||||
### Implementation details
|
||||
* Task and corresponding tests are in TypeScript.
|
||||
* Lint is the static analysis tool.
|
||||
* Istanbul is the code coverage tool.
|
||||
* Mocha is the testing framework.
|
||||
* Chai, Sinon and Sinon-Chai are used for assertions.
|
||||
|
||||
### Commands
|
||||
(assuming node is installed)
|
||||
|
||||
Once:
|
||||
```bash
|
||||
$ npm install
|
||||
$ npm install gulp -g
|
||||
$ npm install tfx-cli -g
|
||||
```
|
||||
|
||||
Build:
|
||||
```bash
|
||||
$ gulp build
|
||||
```
|
||||
|
||||
Test:
|
||||
```bash
|
||||
$ gulp test
|
||||
```
|
||||
|
||||
Package (vsix will be generated at _build/package):
|
||||
```bash
|
||||
$ gulp package
|
||||
```
|
|
@ -0,0 +1,109 @@
|
|||
var del = require("del");
|
||||
var fs = require('fs');
|
||||
var gulp = require("gulp");
|
||||
var istanbul = require("gulp-istanbul");
|
||||
var mocha = require("gulp-mocha");
|
||||
var path = require("path");
|
||||
var shell = require("shelljs");
|
||||
var tsb = require("gulp-tsb");
|
||||
var tslint = require("gulp-tslint");
|
||||
|
||||
var buildDirectory = "_build";
|
||||
var srcBuildDirectory = "_build/src";
|
||||
var codeCoverageDirectory = buildDirectory + "/codeCoverage";
|
||||
var packageDirectory = buildDirectory + "/package";
|
||||
var sourcePaths = {
|
||||
typescriptFiles: "src/**/*.ts",
|
||||
copyFiles: ["src/**/*.png", "src/**/*.json", "src/**/*.md", "src/tasks/**/invoke*.js"],
|
||||
tasksPath: "src/tasks"
|
||||
};
|
||||
var testPaths = {
|
||||
typescriptFiles: "tests/**/*.ts",
|
||||
compiledTestFiles: buildDirectory + "/tests/**/*Tests.js"
|
||||
};
|
||||
var packageManifestFile = "vss-extension.json";
|
||||
var nodeModulesDirectory = "node_modules";
|
||||
|
||||
var compilation = tsb.create({
|
||||
target: 'es5',
|
||||
module: 'commonjs',
|
||||
declaration: false,
|
||||
verbose: false
|
||||
});
|
||||
|
||||
gulp.task("clean", function() {
|
||||
return del([buildDirectory]);
|
||||
});
|
||||
|
||||
gulp.task("lint", ["clean"], function() {
|
||||
return gulp.src([sourcePaths.typescriptFiles, testPaths.typescriptFiles])
|
||||
.pipe(tslint())
|
||||
.pipe(tslint.report("verbose"));
|
||||
});
|
||||
|
||||
gulp.task("compile", ["lint"], function () {
|
||||
return gulp.src([sourcePaths.typescriptFiles, testPaths.typescriptFiles], { base: "." })
|
||||
.pipe(compilation())
|
||||
.pipe(gulp.dest(buildDirectory))
|
||||
.pipe(istanbul({includeUntested: true}))
|
||||
.pipe(istanbul.hookRequire());
|
||||
});
|
||||
|
||||
gulp.task("build", ["compile"], function() {
|
||||
return gulp.src(sourcePaths.copyFiles, { base: "." })
|
||||
.pipe(gulp.dest(buildDirectory));
|
||||
});
|
||||
|
||||
gulp.task("test", ["build"], function() {
|
||||
return gulp.src(testPaths.compiledTestFiles, {read: false})
|
||||
.pipe(mocha())
|
||||
.pipe(istanbul.writeReports({dir: codeCoverageDirectory}))
|
||||
.pipe(istanbul.enforceThresholds({thresholds: {global: 100}}));
|
||||
});
|
||||
|
||||
gulp.task("default", ["test"]);
|
||||
|
||||
gulp.task("package", ["test"], function() {
|
||||
getNodeDependencies(function() {
|
||||
copyNodeModulesToTasks();
|
||||
createVsixPackage();
|
||||
});
|
||||
});
|
||||
|
||||
var getNodeDependencies = function(callback) {
|
||||
del(packageDirectory);
|
||||
shell.mkdir("-p", path.join(packageDirectory, nodeModulesDirectory));
|
||||
shell.cp("-f", "package.json", packageDirectory);
|
||||
shell.pushd(packageDirectory);
|
||||
|
||||
var npmPath = shell.which("npm");
|
||||
var npmInstallCommand = '"' + npmPath + '" install --production';
|
||||
executeCommand(npmInstallCommand, function() {
|
||||
shell.popd();
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
var copyNodeModulesToTasks = function() {
|
||||
fs.readdirSync(sourcePaths.tasksPath).forEach(function(taskName) {
|
||||
var taskpath = path.join(buildDirectory, sourcePaths.tasksPath, taskName);
|
||||
del(path.join(taskpath, nodeModulesDirectory));
|
||||
shell.cp("-rf", path.join(packageDirectory, nodeModulesDirectory), taskpath);
|
||||
});
|
||||
}
|
||||
|
||||
var createVsixPackage = function() {
|
||||
var packagingCmd = "tfx extension create --manifeset-globs " + packageManifestFile + " --root " + srcBuildDirectory + " --output-path " + packageDirectory;
|
||||
executeCommand(packagingCmd, function() {});
|
||||
}
|
||||
|
||||
var executeCommand = function(cmd, callback) {
|
||||
shell.exec(cmd, {silent: true}, function(code, output) {
|
||||
if(code != 0) {
|
||||
console.error("command failed: " + cmd + "\nManually execute to debug");
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"chai": "^3.5.0",
|
||||
"del": "^2.2.0",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-istanbul": "^0.10.3",
|
||||
"gulp-mocha": "^2.2.0",
|
||||
"gulp-tsb": "^1.10.1",
|
||||
"gulp-tslint": "^4.3.1",
|
||||
"shelljs": "^0.6.0",
|
||||
"sinon": "^1.17.3",
|
||||
"sinon-chai": "^2.8.0",
|
||||
"tslint": "^3.3.0",
|
||||
"typescript": "^1.7.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"vsts-task-lib": "^0.5.10"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#Docker
|
||||
This extension install the following tasks
|
||||
* Docker Run
|
||||
|
||||
##Contact Information
|
||||
|
||||
##Trademarks
|
Двоичный файл не отображается.
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 1.4 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 8.9 KiB |
|
@ -0,0 +1,9 @@
|
|||
#Docker Run Task
|
||||
|
||||
###Overview
|
||||
|
||||
###Features
|
||||
|
||||
###Prerequisites
|
||||
|
||||
###Task Parameters
|
|
@ -0,0 +1,7 @@
|
|||
/// <reference path="../../../typings/vsts-task-lib/vsts-task-lib.d.ts" />
|
||||
|
||||
import tl = require("vsts-task-lib/task");
|
||||
|
||||
export function dockerRun(): void {
|
||||
console.log("coming soon...");
|
||||
}
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 389 B |
|
@ -0,0 +1,2 @@
|
|||
var dockerRun = require("./dockerRun");
|
||||
dockerRun.dockerRun();
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"id": "B93C4522-5BEA-4118-97AE-2B560628A157",
|
||||
"name": "DockerRun",
|
||||
"friendlyName": "Run Docker image",
|
||||
"description": "run a docker image.",
|
||||
"helpMarkDown": "[More Information](http://aka.ms/vsts-docker-run-task)",
|
||||
"category": "Deploy",
|
||||
"visibility": [
|
||||
"Build",
|
||||
"Release"
|
||||
],
|
||||
"author": "Microsoft Corporation",
|
||||
"version": {
|
||||
"Major": 0,
|
||||
"Minor": 1,
|
||||
"Patch": 0
|
||||
},
|
||||
"demands": [],
|
||||
"inputs": [
|
||||
{
|
||||
"name": "imageName",
|
||||
"type": "string",
|
||||
"label": "Image name",
|
||||
"defaultValue": "",
|
||||
"required": "true",
|
||||
"helpMarkDown": "name of the image to run"
|
||||
}
|
||||
],
|
||||
"instanceNameFormat": "run $(imageName)",
|
||||
"execution": {
|
||||
"Node": {
|
||||
"target": "invokeDockerRun.js",
|
||||
"argumentFormat": ""
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"manifestVersion": 1,
|
||||
"extensionId": "docker",
|
||||
"name": "Docker Deployment",
|
||||
"version": "0.1.0",
|
||||
"publisher": "ms-vscs-rm",
|
||||
"description": "Deploy to Docker",
|
||||
"public": "true",
|
||||
"galleryFlags": [
|
||||
"Preview"
|
||||
],
|
||||
"icons": {
|
||||
"default": "images/docker_logo.png",
|
||||
"large": "images/docker_logo_large.png"
|
||||
},
|
||||
"categories": [
|
||||
"Build and release"
|
||||
],
|
||||
"tags": [
|
||||
"docker"
|
||||
],
|
||||
"links": {
|
||||
"home": {
|
||||
"uri": "http://aka.ms/vsts-docker"
|
||||
}
|
||||
},
|
||||
"branding": {
|
||||
"color": "#f6f7fb",
|
||||
"theme": "light"
|
||||
},
|
||||
"content": {
|
||||
"details": {
|
||||
"path": "docker.md"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
{
|
||||
"path": "tasks/dockerRun"
|
||||
},
|
||||
{
|
||||
"path": "images",
|
||||
"addressable": true
|
||||
}
|
||||
],
|
||||
"targets": [
|
||||
{
|
||||
"id": "Microsoft.VisualStudio.Services"
|
||||
}
|
||||
],
|
||||
"contributions": [
|
||||
{
|
||||
"id": "dockerRun-task",
|
||||
"type": "ms.vss-distributed-task.task",
|
||||
"targets": [
|
||||
"ms.vss-distributed-task.tasks"
|
||||
],
|
||||
"properties": {
|
||||
"name": "tasks/dockerRun"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/// <reference path="../../../typings/tsd.d.ts" />
|
||||
/// <reference path="../../../typings/vsts-task-lib/vsts-task-lib.d.ts" />
|
||||
|
||||
import * as dockerRun from "../../../src/tasks/dockerRun/dockerRun";
|
||||
|
||||
import chai = require("chai");
|
||||
import sinon = require("sinon");
|
||||
import sinonChai = require("sinon-chai");
|
||||
import tl = require("vsts-task-lib/task");
|
||||
|
||||
chai.should();
|
||||
chai.use(sinonChai);
|
||||
|
||||
describe("dockerRun.dockerRun", (): void => {
|
||||
var sandbox;
|
||||
var getInputStub;
|
||||
|
||||
beforeEach((): void => {
|
||||
sandbox = sinon.sandbox.create();
|
||||
getInputStub = sandbox.stub(tl, "getInput");
|
||||
});
|
||||
|
||||
afterEach((): void => {
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
it("should pass", (): void => {
|
||||
dockerRun.dockerRun();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES5",
|
||||
"module": "commonjs"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"version": "v4",
|
||||
"repo": "borisyankov/DefinitelyTyped",
|
||||
"ref": "master",
|
||||
"path": "typings",
|
||||
"bundle": "typings/tsd.d.ts",
|
||||
"installed": {
|
||||
"mocha/mocha.d.ts": {
|
||||
"commit": "e69fe60f2d6377ea4fae539493997b098f52cad1"
|
||||
},
|
||||
"node/node.d.ts": {
|
||||
"commit": "3030a4be536b6530c06b80081f1333dc0de4d703"
|
||||
},
|
||||
"shelljs/shelljs.d.ts": {
|
||||
"commit": "3030a4be536b6530c06b80081f1333dc0de4d703"
|
||||
},
|
||||
"sinon/sinon.d.ts": {
|
||||
"commit": "95b7178e0ef33b4b88327676418b4cc3ad61df0f"
|
||||
},
|
||||
"assertion-error/assertion-error.d.ts": {
|
||||
"commit": "95b7178e0ef33b4b88327676418b4cc3ad61df0f"
|
||||
},
|
||||
"chai/chai.d.ts": {
|
||||
"commit": "95b7178e0ef33b4b88327676418b4cc3ad61df0f"
|
||||
},
|
||||
"sinon-chai/sinon-chai.d.ts": {
|
||||
"commit": "95b7178e0ef33b4b88327676418b4cc3ad61df0f"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"rules": {
|
||||
"class-name": true,
|
||||
"comment-format": [true,
|
||||
"check-space"
|
||||
],
|
||||
"indent": [true,
|
||||
"spaces"
|
||||
],
|
||||
"one-line": [true,
|
||||
"check-open-brace",
|
||||
"check-whitespace"
|
||||
],
|
||||
"no-var-requires": true,
|
||||
"no-var-keyword": false,
|
||||
"quotemark": [true,
|
||||
"double"
|
||||
],
|
||||
"semicolon": true,
|
||||
"whitespace": [true,
|
||||
"check-branch",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type",
|
||||
"check-module"
|
||||
],
|
||||
"typedef-whitespace": [true, {
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
}],
|
||||
"no-internal-module": true,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-inferrable-types": true
|
||||
}
|
||||
}
|
|
@ -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,401 @@
|
|||
// Type definitions for chai 3.4.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>,
|
||||
// Matt Wistrand <https://github.com/mwistrand>
|
||||
// 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): ChaiStatic;
|
||||
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: CloseTo;
|
||||
approximately: CloseTo;
|
||||
members: Members;
|
||||
increase: PropertyChange;
|
||||
increases: PropertyChange;
|
||||
decrease: PropertyChange;
|
||||
decreases: PropertyChange;
|
||||
change: PropertyChange;
|
||||
changes: PropertyChange;
|
||||
extensible: Assertion;
|
||||
sealed: Assertion;
|
||||
frozen: Assertion;
|
||||
oneOf(list: any[], message?: string): 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 CloseTo {
|
||||
(expected: number, delta: number, 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;
|
||||
|
||||
isNotTrue(val: any, msg?: string): void;
|
||||
isNotFalse(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;
|
||||
|
||||
isAtLeast(val: number, atlst: number, msg?: string): void;
|
||||
isAtMost(val: number, atmst: 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;
|
||||
approximately(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;
|
||||
|
||||
oneOf(inList: any, list: any[], 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,236 @@
|
|||
// Type definitions for mocha 2.2.5
|
||||
// Project: http://mochajs.org/
|
||||
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>, otiai10 <https://github.com/otiai10>, jt000 <https://github.com/jt000>, Vadim Macagon <https://github.com/enlight>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface MochaSetupOptions {
|
||||
//milliseconds to wait before considering a test slow
|
||||
slow?: number;
|
||||
|
||||
// timeout in milliseconds
|
||||
timeout?: number;
|
||||
|
||||
// ui name "bdd", "tdd", "exports" etc
|
||||
ui?: string;
|
||||
|
||||
//array of accepted globals
|
||||
globals?: any[];
|
||||
|
||||
// reporter instance (function or string), defaults to `mocha.reporters.Spec`
|
||||
reporter?: any;
|
||||
|
||||
// bail on the first test failure
|
||||
bail?: boolean;
|
||||
|
||||
// ignore global leaks
|
||||
ignoreLeaks?: boolean;
|
||||
|
||||
// grep string or regexp to filter tests with
|
||||
grep?: any;
|
||||
}
|
||||
|
||||
interface MochaDone {
|
||||
(error?: Error): void;
|
||||
}
|
||||
|
||||
declare var mocha: Mocha;
|
||||
declare var describe: Mocha.IContextDefinition;
|
||||
declare var xdescribe: Mocha.IContextDefinition;
|
||||
// alias for `describe`
|
||||
declare var context: Mocha.IContextDefinition;
|
||||
// alias for `describe`
|
||||
declare var suite: Mocha.IContextDefinition;
|
||||
declare var it: Mocha.ITestDefinition;
|
||||
declare var xit: Mocha.ITestDefinition;
|
||||
// alias for `it`
|
||||
declare var test: Mocha.ITestDefinition;
|
||||
|
||||
declare function before(action: () => void): void;
|
||||
|
||||
declare function before(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function before(description: string, action: () => void): void;
|
||||
|
||||
declare function before(description: string, action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function setup(action: () => void): void;
|
||||
|
||||
declare function setup(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function after(action: () => void): void;
|
||||
|
||||
declare function after(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function after(description: string, action: () => void): void;
|
||||
|
||||
declare function after(description: string, action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function teardown(action: () => void): void;
|
||||
|
||||
declare function teardown(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function beforeEach(action: () => void): void;
|
||||
|
||||
declare function beforeEach(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function beforeEach(description: string, action: () => void): void;
|
||||
|
||||
declare function beforeEach(description: string, action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function suiteSetup(action: () => void): void;
|
||||
|
||||
declare function suiteSetup(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function afterEach(action: () => void): void;
|
||||
|
||||
declare function afterEach(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function afterEach(description: string, action: () => void): void;
|
||||
|
||||
declare function afterEach(description: string, action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function suiteTeardown(action: () => void): void;
|
||||
|
||||
declare function suiteTeardown(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare class Mocha {
|
||||
constructor(options?: {
|
||||
grep?: RegExp;
|
||||
ui?: string;
|
||||
reporter?: string;
|
||||
timeout?: number;
|
||||
bail?: boolean;
|
||||
});
|
||||
|
||||
/** Setup mocha with the given options. */
|
||||
setup(options: MochaSetupOptions): Mocha;
|
||||
bail(value?: boolean): Mocha;
|
||||
addFile(file: string): Mocha;
|
||||
/** Sets reporter by name, defaults to "spec". */
|
||||
reporter(name: string): Mocha;
|
||||
/** Sets reporter constructor, defaults to mocha.reporters.Spec. */
|
||||
reporter(reporter: (runner: Mocha.IRunner, options: any) => any): Mocha;
|
||||
ui(value: string): Mocha;
|
||||
grep(value: string): Mocha;
|
||||
grep(value: RegExp): Mocha;
|
||||
invert(): Mocha;
|
||||
ignoreLeaks(value: boolean): Mocha;
|
||||
checkLeaks(): Mocha;
|
||||
/**
|
||||
* Function to allow assertion libraries to throw errors directly into mocha.
|
||||
* This is useful when running tests in a browser because window.onerror will
|
||||
* only receive the 'message' attribute of the Error.
|
||||
*/
|
||||
throwError(error: Error): void;
|
||||
/** Enables growl support. */
|
||||
growl(): Mocha;
|
||||
globals(value: string): Mocha;
|
||||
globals(values: string[]): Mocha;
|
||||
useColors(value: boolean): Mocha;
|
||||
useInlineDiffs(value: boolean): Mocha;
|
||||
timeout(value: number): Mocha;
|
||||
slow(value: number): Mocha;
|
||||
enableTimeouts(value: boolean): Mocha;
|
||||
asyncOnly(value: boolean): Mocha;
|
||||
noHighlighting(value: boolean): Mocha;
|
||||
/** Runs tests and invokes `onComplete()` when finished. */
|
||||
run(onComplete?: (failures: number) => void): Mocha.IRunner;
|
||||
}
|
||||
|
||||
// merge the Mocha class declaration with a module
|
||||
declare module Mocha {
|
||||
/** Partial interface for Mocha's `Runnable` class. */
|
||||
interface IRunnable {
|
||||
title: string;
|
||||
fn: Function;
|
||||
async: boolean;
|
||||
sync: boolean;
|
||||
timedOut: boolean;
|
||||
}
|
||||
|
||||
/** Partial interface for Mocha's `Suite` class. */
|
||||
interface ISuite {
|
||||
parent: ISuite;
|
||||
title: string;
|
||||
|
||||
fullTitle(): string;
|
||||
}
|
||||
|
||||
/** Partial interface for Mocha's `Test` class. */
|
||||
interface ITest extends IRunnable {
|
||||
parent: ISuite;
|
||||
pending: boolean;
|
||||
|
||||
fullTitle(): string;
|
||||
}
|
||||
|
||||
/** Partial interface for Mocha's `Runner` class. */
|
||||
interface IRunner {}
|
||||
|
||||
interface IContextDefinition {
|
||||
(description: string, spec: () => void): ISuite;
|
||||
only(description: string, spec: () => void): ISuite;
|
||||
skip(description: string, spec: () => void): void;
|
||||
timeout(ms: number): void;
|
||||
}
|
||||
|
||||
interface ITestDefinition {
|
||||
(expectation: string, assertion?: () => void): ITest;
|
||||
(expectation: string, assertion?: (done: MochaDone) => void): ITest;
|
||||
only(expectation: string, assertion?: () => void): ITest;
|
||||
only(expectation: string, assertion?: (done: MochaDone) => void): ITest;
|
||||
skip(expectation: string, assertion?: () => void): void;
|
||||
skip(expectation: string, assertion?: (done: MochaDone) => void): void;
|
||||
timeout(ms: number): void;
|
||||
}
|
||||
|
||||
export module reporters {
|
||||
export class Base {
|
||||
stats: {
|
||||
suites: number;
|
||||
tests: number;
|
||||
passes: number;
|
||||
pending: number;
|
||||
failures: number;
|
||||
};
|
||||
|
||||
constructor(runner: IRunner);
|
||||
}
|
||||
|
||||
export class Doc extends Base {}
|
||||
export class Dot extends Base {}
|
||||
export class HTML extends Base {}
|
||||
export class HTMLCov extends Base {}
|
||||
export class JSON extends Base {}
|
||||
export class JSONCov extends Base {}
|
||||
export class JSONStream extends Base {}
|
||||
export class Landing extends Base {}
|
||||
export class List extends Base {}
|
||||
export class Markdown extends Base {}
|
||||
export class Min extends Base {}
|
||||
export class Nyan extends Base {}
|
||||
export class Progress extends Base {
|
||||
/**
|
||||
* @param options.open String used to indicate the start of the progress bar.
|
||||
* @param options.complete String used to indicate a complete test on the progress bar.
|
||||
* @param options.incomplete String used to indicate an incomplete test on the progress bar.
|
||||
* @param options.close String used to indicate the end of the progress bar.
|
||||
*/
|
||||
constructor(runner: IRunner, options?: {
|
||||
open?: string;
|
||||
complete?: string;
|
||||
incomplete?: string;
|
||||
close?: string;
|
||||
});
|
||||
}
|
||||
export class Spec extends Base {}
|
||||
export class TAP extends Base {}
|
||||
export class XUnit extends Base {
|
||||
constructor(runner: IRunner, options?: any);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "mocha" {
|
||||
export = Mocha;
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,536 @@
|
|||
// Type definitions for ShellJS v0.3.0
|
||||
// Project: http://shelljs.org
|
||||
// Definitions by: Niklas Mollenhauer <https://github.com/nikeee>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
///<reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "shelljs"
|
||||
{
|
||||
import child = require("child_process");
|
||||
|
||||
/**
|
||||
* Changes to directory dir for the duration of the script
|
||||
* @param {string} dir Directory to change in.
|
||||
*/
|
||||
export function cd(dir: string): void;
|
||||
|
||||
/**
|
||||
* Returns the current directory.
|
||||
* @return {string} The current directory.
|
||||
*/
|
||||
export function pwd(): string;
|
||||
|
||||
/**
|
||||
* Returns array of files in the given path, or in current directory if no path provided.
|
||||
* @param {string[]} ...paths Paths to search.
|
||||
* @return {string[]} An array of files in the given path(s).
|
||||
*/
|
||||
export function ls(...paths: string[]): string[];
|
||||
|
||||
/**
|
||||
* Returns array of files in the given path, or in current directory if no path provided.
|
||||
* @param {string} options Available options: -R (recursive), -A (all files, include files beginning with ., except for . and ..)
|
||||
* @param {string[]} ...paths Paths to search.
|
||||
* @return {string[]} An array of files in the given path(s).
|
||||
*/
|
||||
export function ls(options: string, ...paths: string[]): string[];
|
||||
|
||||
/**
|
||||
* Returns array of files in the given path, or in current directory if no path provided.
|
||||
* @param {string[]} paths Paths to search.
|
||||
* @return {string[]} An array of files in the given path(s).
|
||||
*/
|
||||
export function ls(paths: string[]): string[];
|
||||
|
||||
/**
|
||||
* Returns array of files in the given path, or in current directory if no path provided.
|
||||
* @param {string} options Available options: -R (recursive), -A (all files, include files beginning with ., except for . and ..)
|
||||
* @param {string[]} paths Paths to search.
|
||||
* @return {string[]} An array of files in the given path(s).
|
||||
*/
|
||||
export function ls(options: string, paths: string[]): string[];
|
||||
|
||||
/**
|
||||
* Returns array of all files (however deep) in the given paths.
|
||||
* @param {string[]} ...path The path(s) to search.
|
||||
* @return {string[]} An array of all files (however deep) in the given path(s).
|
||||
*/
|
||||
export function find(...path: string[]): string[];
|
||||
|
||||
/**
|
||||
* Returns array of all files (however deep) in the given paths.
|
||||
* @param {string[]} path The path(s) to search.
|
||||
* @return {string[]} An array of all files (however deep) in the given path(s).
|
||||
*/
|
||||
export function find(path: string[]): string[];
|
||||
|
||||
/**
|
||||
* Copies files. The wildcard * is accepted.
|
||||
* @param {string} source The source.
|
||||
* @param {string} dest The destination.
|
||||
*/
|
||||
export function cp(source: string, dest: string): void;
|
||||
|
||||
/**
|
||||
* Copies files. The wildcard * is accepted.
|
||||
* @param {string[]} source The source.
|
||||
* @param {string} dest The destination.
|
||||
*/
|
||||
export function cp(source: string[], dest: string): void;
|
||||
|
||||
/**
|
||||
* Copies files. The wildcard * is accepted.
|
||||
* @param {string} options Available options: -f (force), -r, -R (recursive)
|
||||
* @param {strin]} source The source.
|
||||
* @param {string} dest The destination.
|
||||
*/
|
||||
export function cp(options: string, source: string, dest: string): void;
|
||||
|
||||
/**
|
||||
* Copies files. The wildcard * is accepted.
|
||||
* @param {string} options Available options: -f (force), -r, -R (recursive)
|
||||
* @param {string[]} source The source.
|
||||
* @param {string} dest The destination.
|
||||
*/
|
||||
export function cp(options: string, source: string[], dest: string): void;
|
||||
|
||||
/**
|
||||
* Removes files. The wildcard * is accepted.
|
||||
* @param {string[]} ...files Files to remove.
|
||||
*/
|
||||
export function rm(...files: string[]): void;
|
||||
|
||||
/**
|
||||
* Removes files. The wildcard * is accepted.
|
||||
* @param {string[]} files Files to remove.
|
||||
*/
|
||||
export function rm(files: string[]): void;
|
||||
|
||||
/**
|
||||
* Removes files. The wildcard * is accepted.
|
||||
* @param {string} options Available options: -f (force), -r, -R (recursive)
|
||||
* @param {string[]} ...files Files to remove.
|
||||
*/
|
||||
export function rm(options: string, ...files: string[]): void;
|
||||
|
||||
/**
|
||||
* Removes files. The wildcard * is accepted.
|
||||
* @param {string} options Available options: -f (force), -r, -R (recursive)
|
||||
* @param {string[]} ...files Files to remove.
|
||||
*/
|
||||
export function rm(options: string, files: string[]): void;
|
||||
|
||||
/**
|
||||
* Moves files. The wildcard * is accepted.
|
||||
* @param {string} source The source.
|
||||
* @param {string} dest The destination.
|
||||
*/
|
||||
export function mv(source: string, dest: string): void;
|
||||
|
||||
/**
|
||||
* Moves files. The wildcard * is accepted.
|
||||
* @param {string[]} source The source.
|
||||
* @param {string} dest The destination.
|
||||
*/
|
||||
export function mv(source: string[], dest: string): void;
|
||||
|
||||
/**
|
||||
* Creates directories.
|
||||
* @param {string[]} ...dir Directories to create.
|
||||
*/
|
||||
export function mkdir(...dir: string[]): void;
|
||||
|
||||
/**
|
||||
* Creates directories.
|
||||
* @param {string[]} dir Directories to create.
|
||||
*/
|
||||
export function mkdir(dir: string[]): void;
|
||||
|
||||
/**
|
||||
* Creates directories.
|
||||
* @param {string} options Available options: p (full paths, will create intermediate dirs if necessary)
|
||||
* @param {string[]} ...dir The directories to create.
|
||||
*/
|
||||
export function mkdir(options: string, ...dir: string[]): void;
|
||||
|
||||
/**
|
||||
* Creates directories.
|
||||
* @param {string} options Available options: p (full paths, will create intermediate dirs if necessary)
|
||||
* @param {string[]} dir The directories to create.
|
||||
*/
|
||||
export function mkdir(options: string, dir: string[]): void;
|
||||
|
||||
/**
|
||||
* Evaluates expression using the available primaries and returns corresponding value.
|
||||
* @param {string} option '-b': true if path is a block device; '-c': true if path is a character device; '-d': true if path is a directory; '-e': true if path exists; '-f': true if path is a regular file; '-L': true if path is a symboilc link; '-p': true if path is a pipe (FIFO); '-S': true if path is a socket
|
||||
* @param {string} path The path.
|
||||
* @return {boolean} See option parameter.
|
||||
*/
|
||||
export function test(option: string, path: string): boolean;
|
||||
|
||||
/**
|
||||
* Returns a string containing the given file, or a concatenated string containing the files if more than one file is given (a new line character is introduced between each file). Wildcard * accepted.
|
||||
* @param {string[]} ...files Files to use.
|
||||
* @return {string} A string containing the given file, or a concatenated string containing the files if more than one file is given (a new line character is introduced between each file).
|
||||
*/
|
||||
export function cat(...files: string[]): string;
|
||||
|
||||
/**
|
||||
* Returns a string containing the given file, or a concatenated string containing the files if more than one file is given (a new line character is introduced between each file). Wildcard * accepted.
|
||||
* @param {string[]} files Files to use.
|
||||
* @return {string} A string containing the given file, or a concatenated string containing the files if more than one file is given (a new line character is introduced between each file).
|
||||
*/
|
||||
export function cat(files: string[]): string;
|
||||
|
||||
|
||||
// Does not work yet.
|
||||
export interface String
|
||||
{
|
||||
/**
|
||||
* Analogous to the redirection operator > in Unix, but works with JavaScript strings (such as those returned by cat, grep, etc). Like Unix redirections, to() will overwrite any existing file!
|
||||
* @param {string} file The file to use.
|
||||
*/
|
||||
to(file: string): void;
|
||||
|
||||
/**
|
||||
* Analogous to the redirect-and-append operator >> in Unix, but works with JavaScript strings (such as those returned by cat, grep, etc).
|
||||
* @param {string} file The file to append to.
|
||||
*/
|
||||
toEnd(file: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads an input string from file and performs a JavaScript replace() on the input using the given search regex and replacement string or function. Returns the new string after replacement.
|
||||
* @param {RegExp} searchRegex The regular expression to use for search.
|
||||
* @param {string} replacement The replacement.
|
||||
* @param {string} file The file to process.
|
||||
* @return {string} The new string after replacement.
|
||||
*/
|
||||
export function sed(searchRegex: RegExp, replacement: string, file: string): string;
|
||||
|
||||
/**
|
||||
* Reads an input string from file and performs a JavaScript replace() on the input using the given search regex and replacement string or function. Returns the new string after replacement.
|
||||
* @param {string} searchRegex The regular expression to use for search.
|
||||
* @param {string} replacement The replacement.
|
||||
* @param {string} file The file to process.
|
||||
* @return {string} The new string after replacement.
|
||||
*/
|
||||
export function sed(searchRegex: string, replacement: string, file: string): string;
|
||||
|
||||
/**
|
||||
* Reads an input string from file and performs a JavaScript replace() on the input using the given search regex and replacement string or function. Returns the new string after replacement.
|
||||
* @param {string} options Available options: -i (Replace contents of 'file' in-place. Note that no backups will be created!)
|
||||
* @param {RegExp} searchRegex The regular expression to use for search.
|
||||
* @param {string} replacement The replacement.
|
||||
* @param {string} file The file to process.
|
||||
* @return {string} The new string after replacement.
|
||||
*/
|
||||
export function sed(options: string, searchRegex: RegExp, replacement: string, file: string): string;
|
||||
|
||||
/**
|
||||
* Reads an input string from file and performs a JavaScript replace() on the input using the given search regex and replacement string or function. Returns the new string after replacement.
|
||||
* @param {string} options Available options: -i (Replace contents of 'file' in-place. Note that no backups will be created!)
|
||||
* @param {string} searchRegex The regular expression to use for search.
|
||||
* @param {string} replacement The replacement.
|
||||
* @param {string} file The file to process.
|
||||
* @return {string} The new string after replacement.
|
||||
*/
|
||||
export function sed(options: string, searchRegex: string, replacement: string, file: string): string;
|
||||
|
||||
/**
|
||||
* Reads input string from given files and returns a string containing all lines of the file that match the given regex_filter. Wildcard * accepted.
|
||||
* @param {RegExp} regex_filter The regular expression to use.
|
||||
* @param {string[]} ...files The files to process.
|
||||
* @return {string} Returns a string containing all lines of the file that match the given regex_filter.
|
||||
*/
|
||||
export function grep(regex_filter: RegExp, ...files: string[]): string;
|
||||
|
||||
/**
|
||||
* Reads input string from given files and returns a string containing all lines of the file that match the given regex_filter. Wildcard * accepted.
|
||||
* @param {RegExp} regex_filter The regular expression to use.
|
||||
* @param {string[]} ...files The files to process.
|
||||
* @return {string} Returns a string containing all lines of the file that match the given regex_filter.
|
||||
*/
|
||||
export function grep(regex_filter: RegExp, files: string[]): string;
|
||||
|
||||
/**
|
||||
* Reads input string from given files and returns a string containing all lines of the file that match the given regex_filter. Wildcard * accepted.
|
||||
* @param {string} options Available options: -v (Inverse the sense of the regex and print the lines not matching the criteria.)
|
||||
* @param {string} regex_filter The regular expression to use.
|
||||
* @param {string[]} ...files The files to process.
|
||||
* @return {string} Returns a string containing all lines of the file that match the given regex_filter.
|
||||
*/
|
||||
export function grep(options: string, regex_filter: string, ...files: string[]): string;
|
||||
|
||||
/**
|
||||
* Reads input string from given files and returns a string containing all lines of the file that match the given regex_filter. Wildcard * accepted.
|
||||
* @param {string} options Available options: -v (Inverse the sense of the regex and print the lines not matching the criteria.)
|
||||
* @param {string} regex_filter The regular expression to use.
|
||||
* @param {string[]} files The files to process.
|
||||
* @return {string} Returns a string containing all lines of the file that match the given regex_filter.
|
||||
*/
|
||||
export function grep(options: string, regex_filter: string, files: string[]): string;
|
||||
|
||||
/**
|
||||
* Searches for command in the system's PATH. On Windows looks for .exe, .cmd, and .bat extensions.
|
||||
* @param {string} command The command to search for.
|
||||
* @return {string} Returns string containing the absolute path to the command.
|
||||
*/
|
||||
export function which(command: string): string;
|
||||
|
||||
/**
|
||||
* Prints string to stdout, and returns string with additional utility methods like .to().
|
||||
* @param {string[]} ...text The text to print.
|
||||
* @return {string} Returns the string that was passed as argument.
|
||||
*/
|
||||
export function echo(...text: string[]): string;
|
||||
|
||||
/**
|
||||
* Save the current directory on the top of the directory stack and then cd to dir. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.
|
||||
* @param {"+N"} dir Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
|
||||
* @return {string[]} Returns an array of paths in the stack.
|
||||
*/
|
||||
export function pushd(dir: "+N"): string[];
|
||||
|
||||
/**
|
||||
* Save the current directory on the top of the directory stack and then cd to dir. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.
|
||||
* @param {"-N"} dir Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
|
||||
* @return {string[]} Returns an array of paths in the stack.
|
||||
*/
|
||||
export function pushd(dir: "-N"): string[];
|
||||
|
||||
/**
|
||||
* Save the current directory on the top of the directory stack and then cd to dir. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.
|
||||
* @param {string} dir Makes the current working directory be the top of the stack, and then executes the equivalent of cd dir.
|
||||
* @return {string[]} Returns an array of paths in the stack.
|
||||
*/
|
||||
export function pushd(dir: string): string[];
|
||||
|
||||
/**
|
||||
* Save the current directory on the top of the directory stack and then cd to dir. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.
|
||||
* @param {string} options Available options: -n (Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated)
|
||||
* @param {"+N"} dir Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
|
||||
* @return {string[]} Returns an array of paths in the stack.
|
||||
*/
|
||||
export function pushd(options: string, dir: "+N"): string[];
|
||||
|
||||
/**
|
||||
* Save the current directory on the top of the directory stack and then cd to dir. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.
|
||||
* @param {string} options Available options: -n (Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated)
|
||||
* @param {"-N"} dir Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
|
||||
* @return {string[]} Returns an array of paths in the stack.
|
||||
*/
|
||||
export function pushd(options: string, dir: "-N"): string[];
|
||||
|
||||
/**
|
||||
* Save the current directory on the top of the directory stack and then cd to dir. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.
|
||||
* @param {string} options Available options: -n (Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated)
|
||||
* @param {string} dir Makes the current working directory be the top of the stack, and then executes the equivalent of cd dir.
|
||||
* @return {string[]} Returns an array of paths in the stack.
|
||||
*/
|
||||
export function pushd(options: string, dir: string): string[];
|
||||
|
||||
/**
|
||||
* When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.
|
||||
* @param {"+N"} dir Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.
|
||||
* @return {string[]} Returns an array of paths in the stack.
|
||||
*/
|
||||
export function popd(dir: "+N"): string[];
|
||||
|
||||
/**
|
||||
* When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.
|
||||
* @return {string[]} Returns an array of paths in the stack.
|
||||
*/
|
||||
export function popd(): string[];
|
||||
|
||||
/**
|
||||
* When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.
|
||||
* @param {"-N"} dir Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.
|
||||
* @return {string[]} Returns an array of paths in the stack.
|
||||
*/
|
||||
export function popd(dir: "-N"): string[];
|
||||
|
||||
/**
|
||||
* When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.
|
||||
* @param {string} dir You can only use -N and +N.
|
||||
* @return {string[]} Returns an array of paths in the stack.
|
||||
*/
|
||||
export function popd(dir: string): string[];
|
||||
|
||||
/**
|
||||
* When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.
|
||||
* @param {string} options Available options: -n (Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated)
|
||||
* @param {"+N"} dir Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.
|
||||
* @return {string[]} Returns an array of paths in the stack.
|
||||
*/
|
||||
export function popd(options: string, dir: "+N"): string[];
|
||||
|
||||
/**
|
||||
* When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.
|
||||
* @param {string} options Available options: -n (Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated)
|
||||
* @param {"-N"} dir Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.
|
||||
* @return {string[]} Returns an array of paths in the stack.
|
||||
*/
|
||||
export function popd(options: string, dir: "-N"): string[];
|
||||
|
||||
/**
|
||||
* When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.
|
||||
* @param {string} options Available options: -n (Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated)
|
||||
* @param {string} dir You can only use -N and +N.
|
||||
* @return {string[]} Returns an array of paths in the stack.
|
||||
*/
|
||||
export function popd(options: string, dir: string): string[];
|
||||
|
||||
/**
|
||||
* Clears the directory stack by deleting all of the elements.
|
||||
* @param {"-c"} options Clears the directory stack by deleting all of the elements.
|
||||
* @return {string[]} Returns an array of paths in the stack, or a single path if +N or -N was specified.
|
||||
*/
|
||||
export function dirs(options: "-c"): string[];
|
||||
|
||||
/**
|
||||
* Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.
|
||||
* @param {"+N"} options Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.
|
||||
* @return {string[]} Returns an array of paths in the stack, or a single path if +N or -N was specified.
|
||||
*/
|
||||
export function dirs(options: "+N"): string;
|
||||
|
||||
/**
|
||||
* Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.
|
||||
* @param {"-N"} options Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.
|
||||
* @return {string[]} Returns an array of paths in the stack, or a single path if +N or -N was specified.
|
||||
*/
|
||||
export function dirs(options: "-N"): string;
|
||||
|
||||
/**
|
||||
* Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.
|
||||
* @param {string} options Available options: -c, -N, +N. You can only use those.
|
||||
* @return {any} Returns an array of paths in the stack, or a single path if +N or -N was specified.
|
||||
*/
|
||||
export function dirs(options: string): any;
|
||||
|
||||
/**
|
||||
* Links source to dest. Use -f to force the link, should dest already exist.
|
||||
* @param {string} source The source.
|
||||
* @param {string} dest The destination.
|
||||
*/
|
||||
export function ln(source: string, dest: string): void;
|
||||
|
||||
/**
|
||||
* Links source to dest. Use -f to force the link, should dest already exist.
|
||||
* @param {string} options Available options: s (symlink), f (force)
|
||||
* @param {string} source The source.
|
||||
* @param {string} dest The destination.
|
||||
*/
|
||||
export function ln(options: string, source: string, dest: string): void;
|
||||
|
||||
/**
|
||||
* Exits the current process with the given exit code.
|
||||
* @param {number} code The exit code.
|
||||
*/
|
||||
export function exit(code: number): void;
|
||||
|
||||
/**
|
||||
* Object containing environment variables (both getter and setter). Shortcut to process.env.
|
||||
*/
|
||||
export var env: { [key: string]: string };
|
||||
|
||||
/**
|
||||
* Executes the given command synchronously.
|
||||
* @param {string} command The command to execute.
|
||||
* @return {ExecOutputReturnValue} Returns an object containing the return code and output as string.
|
||||
*/
|
||||
export function exec(command: string): ExecOutputReturnValue;
|
||||
/**
|
||||
* Executes the given command synchronously.
|
||||
* @param {string} command The command to execute.
|
||||
* @param {ExecOptions} options Silence and synchronous options.
|
||||
* @return {ExecOutputReturnValue | child.ChildProcess} Returns an object containing the return code and output as string, or if {async:true} was passed, a ChildProcess.
|
||||
*/
|
||||
export function exec(command: string, options: ExecOptions): ExecOutputReturnValue | child.ChildProcess;
|
||||
/**
|
||||
* Executes the given command synchronously.
|
||||
* @param {string} command The command to execute.
|
||||
* @param {ExecOptions} options Silence and synchronous options.
|
||||
* @param {ExecCallback} callback Receives code and output asynchronously.
|
||||
*/
|
||||
export function exec(command: string, options: ExecOptions, callback: ExecCallback): child.ChildProcess;
|
||||
/**
|
||||
* Executes the given command synchronously.
|
||||
* @param {string} command The command to execute.
|
||||
* @param {ExecCallback} callback Receives code and output asynchronously.
|
||||
*/
|
||||
export function exec(command: string, callback: ExecCallback): child.ChildProcess;
|
||||
|
||||
export interface ExecCallback {
|
||||
(code: number, output: string): any;
|
||||
}
|
||||
|
||||
export interface ExecOptions {
|
||||
silent?: boolean;
|
||||
async?: boolean;
|
||||
}
|
||||
|
||||
export interface ExecOutputReturnValue
|
||||
{
|
||||
code: number;
|
||||
output: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alters the permissions of a file or directory by either specifying the absolute permissions in octal form or expressing the changes in symbols. This command tries to mimic the POSIX behavior as much as possible. Notable exceptions:
|
||||
* - In symbolic modes, 'a-r' and '-r' are identical. No consideration is given to the umask.
|
||||
* - There is no "quiet" option since default behavior is to run silent.
|
||||
* @param {number} octalMode The access mode. Octal.
|
||||
* @param {string} file The file to use.
|
||||
*/
|
||||
export function chmod(octalMode: number, file: string): void;
|
||||
|
||||
/**
|
||||
* Alters the permissions of a file or directory by either specifying the absolute permissions in octal form or expressing the changes in symbols. This command tries to mimic the POSIX behavior as much as possible. Notable exceptions:
|
||||
* - In symbolic modes, 'a-r' and '-r' are identical. No consideration is given to the umask.
|
||||
* - There is no "quiet" option since default behavior is to run silent.
|
||||
* @param {string} mode The access mode. Can be an octal string or a symbolic mode string.
|
||||
* @param {string} file The file to use.
|
||||
*/
|
||||
export function chmod(mode: string, file: string): void;
|
||||
|
||||
// Non-Unix commands
|
||||
|
||||
/**
|
||||
* Searches and returns string containing a writeable, platform-dependent temporary directory. Follows Python's tempfile algorithm.
|
||||
* @return {string} The temp file path.
|
||||
*/
|
||||
export function tempdir(): string;
|
||||
|
||||
/**
|
||||
* Tests if error occurred in the last command.
|
||||
* @return {string} Returns null if no error occurred, otherwise returns string explaining the error
|
||||
*/
|
||||
export function error(): string;
|
||||
|
||||
// Configuration
|
||||
|
||||
interface ShellConfig
|
||||
{
|
||||
/**
|
||||
* Suppresses all command output if true, except for echo() calls. Default is false.
|
||||
* @type {boolean}
|
||||
*/
|
||||
silent: boolean;
|
||||
|
||||
/**
|
||||
* If true the script will die on errors. Default is false.
|
||||
* @type {boolean}
|
||||
*/
|
||||
fatal: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The shelljs configuration.
|
||||
* @type {ShellConfig}
|
||||
*/
|
||||
export var config: ShellConfig;
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
// 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;
|
||||
namespace sinonChai { }
|
||||
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;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
/// <reference path="mocha/mocha.d.ts" />
|
||||
/// <reference path="node/node.d.ts" />
|
||||
/// <reference path="shelljs/shelljs.d.ts" />
|
||||
/// <reference path="sinon/sinon.d.ts" />
|
||||
/// <reference path="assertion-error/assertion-error.d.ts" />
|
||||
/// <reference path="chai/chai.d.ts" />
|
||||
/// <reference path="sinon-chai/sinon-chai.d.ts" />
|
|
@ -0,0 +1,409 @@
|
|||
/// <reference path="../definitions/node.d.ts" />
|
||||
/// <reference path="../definitions/Q.d.ts" />
|
||||
declare module 'vsts-task-lib/taskcommand' {
|
||||
export class TaskCommand {
|
||||
constructor(command: any, properties: any, message: any);
|
||||
command: string;
|
||||
message: string;
|
||||
properties: {
|
||||
[key: string]: string;
|
||||
};
|
||||
toString(): string;
|
||||
}
|
||||
export function commandFromString(commandLine: any): TaskCommand;
|
||||
|
||||
}
|
||||
declare module 'vsts-task-lib/toolrunner' {
|
||||
/// <reference path="../definitions/node.d.ts" />
|
||||
/// <reference path="../definitions/Q.d.ts" />
|
||||
import Q = require('q');
|
||||
import events = require('events');
|
||||
/**
|
||||
* Interface for exec options
|
||||
*
|
||||
* @param cwd optional working directory. defaults to current
|
||||
* @param env optional envvar dictionary. defaults to current processes env
|
||||
* @param silent optional. defaults to false
|
||||
* @param failOnStdErr optional. whether to fail if output to stderr. defaults to false
|
||||
* @param ignoreReturnCode optional. defaults to failing on non zero. ignore will not fail leaving it up to the caller
|
||||
*/
|
||||
export interface IExecOptions {
|
||||
cwd: string;
|
||||
env: {
|
||||
[key: string]: string;
|
||||
};
|
||||
silent: boolean;
|
||||
failOnStdErr: boolean;
|
||||
ignoreReturnCode: boolean;
|
||||
outStream: NodeJS.WritableStream;
|
||||
errStream: NodeJS.WritableStream;
|
||||
}
|
||||
/**
|
||||
* Interface for exec results returned from synchronous exec functions
|
||||
*
|
||||
* @param stdout standard output
|
||||
* @param stderr error output
|
||||
* @param code return code
|
||||
* @param error Error on failure
|
||||
*/
|
||||
export interface IExecResult {
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
code: number;
|
||||
error: Error;
|
||||
}
|
||||
export function debug(message: any): void;
|
||||
export class ToolRunner extends events.EventEmitter {
|
||||
constructor(toolPath: any);
|
||||
toolPath: string;
|
||||
args: string[];
|
||||
silent: boolean;
|
||||
private _debug(message);
|
||||
private _argStringToArray(argString);
|
||||
/**
|
||||
* Add arguments
|
||||
* Accepts a full string command line and a string array as well
|
||||
* With literal=false, will handle double quoted args. E.g. val='"arg one" two -z', args[]=['arg one', 'two', '-z']
|
||||
* With literal=true, will put input direct into args. E.g. val='/bin/working folder', args[]=['/bin/working folder']
|
||||
*
|
||||
* @param val string cmdline or array of strings
|
||||
* @param literal optional literal flag, if val is a string, add the original val to arguments when literal is true
|
||||
* @returns void
|
||||
*/
|
||||
arg(val: any, literal?: boolean): void;
|
||||
/**
|
||||
* Add path argument
|
||||
* Add path string to argument, path string should not contain double quoted
|
||||
* This will call arg(val, literal?) with literal equal 'true'
|
||||
*
|
||||
* @param val path argument string
|
||||
* @returns void
|
||||
*/
|
||||
pathArg(val: string): void;
|
||||
/**
|
||||
* Add argument(s) if a condition is met
|
||||
* Wraps arg(). See arg for details
|
||||
*
|
||||
* @param condition boolean condition
|
||||
* @param val string cmdline or array of strings
|
||||
* @returns void
|
||||
*/
|
||||
argIf(condition: any, val: any): void;
|
||||
/**
|
||||
* Exec a tool.
|
||||
* Output will be streamed to the live console.
|
||||
* Returns promise with return code
|
||||
*
|
||||
* @param tool path to tool to exec
|
||||
* @param options optional exec options. See IExecOptions
|
||||
* @returns number
|
||||
*/
|
||||
exec(options?: IExecOptions): Q.Promise<number>;
|
||||
/**
|
||||
* Exec a tool synchronously.
|
||||
* Output will be *not* be streamed to the live console. It will be returned after execution is complete.
|
||||
* Appropriate for short running tools
|
||||
* Returns IExecResult with output and return code
|
||||
*
|
||||
* @param tool path to tool to exec
|
||||
* @param options optionalexec options. See IExecOptions
|
||||
* @returns IExecResult
|
||||
*/
|
||||
execSync(options?: IExecOptions): IExecResult;
|
||||
}
|
||||
|
||||
}
|
||||
declare module 'vsts-task-lib/task' {
|
||||
/// <reference path="../definitions/node.d.ts" />
|
||||
/// <reference path="../definitions/Q.d.ts" />
|
||||
/// <reference path="../definitions/shelljs.d.ts" />
|
||||
/// <reference path="../definitions/minimatch.d.ts" />
|
||||
/// <reference path="../definitions/glob.d.ts" />
|
||||
import Q = require('q');
|
||||
import fs = require('fs');
|
||||
import trm = require('vsts-task-lib/toolrunner');
|
||||
export enum TaskResult {
|
||||
Succeeded = 0,
|
||||
Failed = 1,
|
||||
}
|
||||
export var _outStream: NodeJS.WritableStream;
|
||||
export var _errStream: NodeJS.WritableStream;
|
||||
export function _writeError(str: string): void;
|
||||
export function _writeLine(str: string): void;
|
||||
export function setStdStream(stdStream: any): void;
|
||||
export function setErrStream(errStream: any): void;
|
||||
/**
|
||||
* Sets the result of the task.
|
||||
* If the result is Failed (1), then execution will halt.
|
||||
*
|
||||
* @param result TaskResult enum of Success or Failed. If the result is Failed (1), then execution will halt.
|
||||
* @param messages A message which will be logged and added as an issue if an failed
|
||||
* @returns void
|
||||
*/
|
||||
export function setResult(result: TaskResult, message: string): void;
|
||||
export function handlerError(errMsg: string, continueOnError: boolean): void;
|
||||
export function exitOnCodeIf(code: number, condition: boolean): void;
|
||||
export function exit(code: number): void;
|
||||
/**
|
||||
* Sets the location of the resources json. This is typically the task.json file.
|
||||
* Call once at the beginning of the script before any calls to loc.
|
||||
*
|
||||
* @param path Full path to the json.
|
||||
* @returns void
|
||||
*/
|
||||
export function setResourcePath(path: string): void;
|
||||
/**
|
||||
* Gets the localized string from the json resource file. Optionally formats with additional params.
|
||||
*
|
||||
* @param key key of the resources string in the resource file
|
||||
* @param param additional params for formatting the string
|
||||
* @returns string
|
||||
*/
|
||||
export function loc(key: string, ...param: any[]): string;
|
||||
/**
|
||||
* Gets a variables value which is defined on the build definition or set at runtime.
|
||||
*
|
||||
* @param name name of the variable to get
|
||||
* @returns string
|
||||
*/
|
||||
export function getVariable(name: string): string;
|
||||
/**
|
||||
* Sets a variables which will be available to subsequent tasks as well.
|
||||
*
|
||||
* @param name name of the variable to set
|
||||
* @param val value to set
|
||||
* @returns void
|
||||
*/
|
||||
export function setVariable(name: string, val: string): void;
|
||||
/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
* If required is true and the value is not set, the task will fail with an error. Execution halts.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param required whether input is required. optional, defaults to false
|
||||
* @returns string
|
||||
*/
|
||||
export function getInput(name: string, required?: boolean): string;
|
||||
/**
|
||||
* Gets the value of an input and converts to a bool. Convenience.
|
||||
* If required is true and the value is not set, the task will fail with an error. Execution halts.
|
||||
*
|
||||
* @param name name of the bool input to get
|
||||
* @param required whether input is required. optional, defaults to false
|
||||
* @returns string
|
||||
*/
|
||||
export function getBoolInput(name: string, required?: boolean): boolean;
|
||||
export function setEnvVar(name: string, val: string): void;
|
||||
/**
|
||||
* Gets the value of an input and splits the values by a delimiter (space, comma, etc...)
|
||||
* Useful for splitting an input with simple list of items like targets
|
||||
* IMPORTANT: Do not use for splitting additional args! Instead use arg() - it will split and handle
|
||||
* If required is true and the value is not set, the task will fail with an error. Execution halts.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param delim delimiter to split on
|
||||
* @param required whether input is required. optional, defaults to false
|
||||
* @returns string[]
|
||||
*/
|
||||
export function getDelimitedInput(name: string, delim: string, required?: boolean): string[];
|
||||
/**
|
||||
* Checks whether a path inputs value was supplied by the user
|
||||
* File paths are relative with a picker, so an empty path is the root of the repo.
|
||||
* Useful if you need to condition work (like append an arg) if a value was supplied
|
||||
*
|
||||
* @param name name of the path input to check
|
||||
* @returns boolean
|
||||
*/
|
||||
export function filePathSupplied(name: string): boolean;
|
||||
/**
|
||||
* Gets the value of a path input
|
||||
* It will be quoted for you if it isn't already and contains spaces
|
||||
* If required is true and the value is not set, the task will fail with an error. Execution halts.
|
||||
* If check is true and the path does not exist, the task will fail with an error. Execution halts.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param required whether input is required. optional, defaults to false
|
||||
* @param check whether path is checked. optional, defaults to false
|
||||
* @returns string
|
||||
*/
|
||||
export function getPathInput(name: string, required?: boolean, check?: boolean): string;
|
||||
/**
|
||||
* Gets the url for a service endpoint
|
||||
* If the url was not set and is not optional, the task will fail with an error message. Execution will halt.
|
||||
*
|
||||
* @param id name of the service endpoint
|
||||
* @param optional whether the url is optional
|
||||
* @returns string
|
||||
*/
|
||||
export function getEndpointUrl(id: string, optional: boolean): string;
|
||||
/**
|
||||
* Interface for EndpointAuthorization
|
||||
* Contains a schema and a string/string dictionary of auth data
|
||||
*
|
||||
* @param parameters string string dictionary of auth data
|
||||
* @param scheme auth scheme such as OAuth or username/password etc...
|
||||
*/
|
||||
export interface EndpointAuthorization {
|
||||
parameters: {
|
||||
[key: string]: string;
|
||||
};
|
||||
scheme: string;
|
||||
}
|
||||
/**
|
||||
* Gets the authorization details for a service endpoint
|
||||
* If the authorization was not set and is not optional, the task will fail with an error message. Execution will halt.
|
||||
*
|
||||
* @param id name of the service endpoint
|
||||
* @param optional whether the url is optional
|
||||
* @returns string
|
||||
*/
|
||||
export function getEndpointAuthorization(id: string, optional: boolean): EndpointAuthorization;
|
||||
export function command(command: string, properties: any, message: string): void;
|
||||
export function warning(message: string): void;
|
||||
export function error(message: string): void;
|
||||
export function debug(message: string): void;
|
||||
export interface FsStats extends fs.Stats {
|
||||
}
|
||||
/**
|
||||
* Get's stat on a path.
|
||||
* Useful for checking whether a file or directory. Also getting created, modified and accessed time.
|
||||
* see [fs.stat](https://nodejs.org/api/fs.html#fs_class_fs_stats)
|
||||
*
|
||||
* @param path path to check
|
||||
* @returns fsStat
|
||||
*/
|
||||
export function stats(path: string): FsStats;
|
||||
/**
|
||||
* Returns whether a path exists.
|
||||
*
|
||||
* @param path path to check
|
||||
* @returns boolean
|
||||
*/
|
||||
export function exist(path: string): boolean;
|
||||
/**
|
||||
* Checks whether a path exists.
|
||||
* If the path does not exist, the task will fail with an error message. Execution will halt.
|
||||
*
|
||||
* @param p path to check
|
||||
* @param name name only used in error message to identify the path
|
||||
* @returns void
|
||||
*/
|
||||
export function checkPath(p: string, name: string): void;
|
||||
/**
|
||||
* Change working directory.
|
||||
*
|
||||
* @param path new working directory path
|
||||
* @returns void
|
||||
*/
|
||||
export function cd(path: string): void;
|
||||
/**
|
||||
* Change working directory and push it on the stack
|
||||
*
|
||||
* @param path new working directory path
|
||||
* @returns void
|
||||
*/
|
||||
export function pushd(path: string): void;
|
||||
/**
|
||||
* Change working directory back to previously pushed directory
|
||||
*
|
||||
* @returns void
|
||||
*/
|
||||
export function popd(): void;
|
||||
/**
|
||||
* Make a directory. Creates the full path with folders in between
|
||||
* Returns whether it was successful or not
|
||||
*
|
||||
* @param p path to create
|
||||
* @returns boolean
|
||||
*/
|
||||
export function mkdirP(p: any): boolean;
|
||||
/**
|
||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
||||
* If you check and the tool does not exist, the task will fail with an error message and halt execution.
|
||||
*
|
||||
* @param tool name of the tool
|
||||
* @param check whether to check if tool exists
|
||||
* @returns string
|
||||
*/
|
||||
export function which(tool: string, check?: boolean): string;
|
||||
/**
|
||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
||||
* If you check and the tool does not exist, the task will fail with an error message and halt execution.
|
||||
* Returns whether the copy was successful
|
||||
*
|
||||
* @param options string -r, -f or -rf for recursive and force
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param continueOnError optional. whether to continue on error
|
||||
* @returns boolean
|
||||
*/
|
||||
export function cp(options: any, source: string, dest: string, continueOnError?: boolean): boolean;
|
||||
/**
|
||||
* Moves a path.
|
||||
* Returns whether the copy was successful
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param force whether to force and overwrite
|
||||
* @param continueOnError optional. whether to continue on error
|
||||
* @returns boolean
|
||||
*/
|
||||
export function mv(source: string, dest: string, force: boolean, continueOnError?: boolean): boolean;
|
||||
/**
|
||||
* Find all files under a give path
|
||||
* Returns an array of full paths
|
||||
*
|
||||
* @param findPath path to find files under
|
||||
* @returns string[]
|
||||
*/
|
||||
export function find(findPath: string): string[];
|
||||
/**
|
||||
* Remove a path recursively with force
|
||||
* Returns whether it succeeds
|
||||
*
|
||||
* @param path path to remove
|
||||
* @param continueOnError optional. whether to continue on error
|
||||
* @returns string[]
|
||||
*/
|
||||
export function rmRF(path: string, continueOnError?: boolean): boolean;
|
||||
export function glob(pattern: string): string[];
|
||||
export function globFirst(pattern: string): string;
|
||||
/**
|
||||
* Exec a tool. Convenience wrapper over ToolRunner to exec with args in one call.
|
||||
* Output will be streamed to the live console.
|
||||
* Returns promise with return code
|
||||
*
|
||||
* @param tool path to tool to exec
|
||||
* @param args an arg string or array of args
|
||||
* @param options optional exec options. See IExecOptions
|
||||
* @returns number
|
||||
*/
|
||||
export function exec(tool: string, args: any, options?: trm.IExecOptions): Q.Promise<number>;
|
||||
/**
|
||||
* Exec a tool synchronously. Convenience wrapper over ToolRunner to execSync with args in one call.
|
||||
* Output will be *not* be streamed to the live console. It will be returned after execution is complete.
|
||||
* Appropriate for short running tools
|
||||
* Returns IExecResult with output and return code
|
||||
*
|
||||
* @param tool path to tool to exec
|
||||
* @param args an arg string or array of args
|
||||
* @param options optionalexec options. See IExecOptions
|
||||
* @returns IExecResult
|
||||
*/
|
||||
export function execSync(tool: string, args: any, options?: trm.IExecOptions): trm.IExecResult;
|
||||
/**
|
||||
* Convenience factory to create a ToolRunner.
|
||||
*
|
||||
* @param tool path to tool to exec
|
||||
* @returns ToolRunner
|
||||
*/
|
||||
export function createToolRunner(tool: string): trm.ToolRunner;
|
||||
export function match(list: any, pattern: any, options: any): string[];
|
||||
export function filter(pattern: any, options: any): (element: string, indexed: number, array: string[]) => boolean;
|
||||
export class TestPublisher {
|
||||
constructor(testRunner: any);
|
||||
testRunner: string;
|
||||
publish(resultFiles: any, mergeResults: any, platform: any, config: any, runTitle: any, publishRunAttachments: any): void;
|
||||
}
|
||||
|
||||
}
|
Загрузка…
Ссылка в новой задаче