Compare commits
No commits in common. "master" and "v0.0.1" have entirely different histories.
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
docs/
|
docs/
|
||||||
coverage/
|
coverage/
|
||||||
|
ts/**/*.js
|
||||||
|
ts/**/*.js.map
|
||||||
|
.idea/
|
@ -1,96 +0,0 @@
|
|||||||
# gitzone standard
|
|
||||||
image: hosttoday/ht-docker-node:npmci
|
|
||||||
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- .yarn/
|
|
||||||
key: "$CI_BUILD_STAGE"
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- mirror
|
|
||||||
- security
|
|
||||||
- test
|
|
||||||
- release
|
|
||||||
- trigger
|
|
||||||
- pages
|
|
||||||
|
|
||||||
mirror:
|
|
||||||
stage: mirror
|
|
||||||
script:
|
|
||||||
- npmci git mirror
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
security:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci command yarn global add snyk
|
|
||||||
- npmci command yarn install --ignore-scripts
|
|
||||||
- npmci command snyk test
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
testLEGACY:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci node install legacy
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
testLTS:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci node install lts
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
testSTABLE:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm publish
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
stage: trigger
|
|
||||||
script:
|
|
||||||
- npmci trigger
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
pages:
|
|
||||||
image: hosttoday/ht-docker-node:npmci
|
|
||||||
stage: pages
|
|
||||||
script:
|
|
||||||
- npmci command yarn global add npmpage
|
|
||||||
- npmci command npmpage
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
paths:
|
|
||||||
- public
|
|
@ -1,16 +1,14 @@
|
|||||||
# smartci
|
# smartci
|
||||||
|
|
||||||
store things about your environment and let them travel across modules.
|
store things about your environment and let them travel across modules.
|
||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
[](https://travis-ci.org/pushrocks/smartci)
|
[](https://travis-ci.org/pushrocks/smartci)
|
||||||
[](https://david-dm.org/pushrocks/smartci)
|
[](https://david-dm.org/pushrocks/smartci)
|
||||||
|
[](https://david-dm.org/pushrocks/smartci#info=devDependencies)
|
||||||
[](https://www.bithound.io/github/pushrocks/smartci/master/dependencies/npm)
|
[](https://www.bithound.io/github/pushrocks/smartci/master/dependencies/npm)
|
||||||
[](https://www.bithound.io/github/pushrocks/smartci)
|
[](https://www.bithound.io/github/pushrocks/smartci)
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
Install the package through npm
|
Install the package through npm
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -20,4 +18,5 @@ npm install smartci
|
|||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
|
||||||
```
|
```
|
2
dist/index.d.ts
vendored
2
dist/index.d.ts
vendored
@ -1,2 +0,0 @@
|
|||||||
export declare let isCi: () => boolean;
|
|
||||||
export declare let isTaggedCommit: () => boolean;
|
|
20
dist/index.js
vendored
20
dist/index.js
vendored
@ -1,14 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
var SmartCiCheck = require("./smartci.check");
|
||||||
exports.isCi = function () {
|
var SmartCiGet = require("./smartci.get");
|
||||||
if (process.env.CI == 'true') {
|
var smartci = {
|
||||||
return true;
|
check: SmartCiCheck,
|
||||||
}
|
get: SmartCiGet
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
exports.isTaggedCommit = () => {
|
module.exports = smartci;
|
||||||
return typeof process.env.CI_BUILD_TAG != 'undefined';
|
|
||||||
};
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFQSxJQUFPLFlBQVksV0FBVyxpQkFBaUIsQ0FBQyxDQUFDO0FBQ2pELElBQU8sVUFBVSxXQUFXLGVBQWUsQ0FBQyxDQUFDO0FBQzdDLElBQUksT0FBTyxHQUFHO0lBQ1YsS0FBSyxFQUFFLFlBQVk7SUFDbkIsR0FBRyxFQUFFLFVBQVU7Q0FDbEIsQ0FBQztBQUVGLGlCQUFTLE9BQU8sQ0FBQyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vLyA8cmVmZXJlbmNlIHBhdGg9XCJ0eXBpbmdzL21haW4uZC50c1wiIC8+XG5pbXBvcnQgcGx1Z2lucyA9IHJlcXVpcmUoXCIuL3NtYXJ0Y2kucGx1Z2luc1wiKTtcbmltcG9ydCBTbWFydENpQ2hlY2sgPSByZXF1aXJlKFwiLi9zbWFydGNpLmNoZWNrXCIpO1xuaW1wb3J0IFNtYXJ0Q2lHZXQgPSByZXF1aXJlKFwiLi9zbWFydGNpLmdldFwiKTtcbmxldCBzbWFydGNpID0ge1xuICAgIGNoZWNrOiBTbWFydENpQ2hlY2ssXG4gICAgZ2V0OiBTbWFydENpR2V0XG59O1xuXG5leHBvcnQgPSBzbWFydGNpO1xuIl0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVXLFFBQUEsSUFBSSxHQUFHO0lBQ2hCLEVBQUUsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsRUFBRSxJQUFJLE1BQU0sQ0FBQyxDQUFDLENBQUM7UUFDN0IsTUFBTSxDQUFDLElBQUksQ0FBQztJQUNkLENBQUM7SUFBQyxJQUFJLENBQUMsQ0FBQztRQUNOLE1BQU0sQ0FBQyxLQUFLLENBQUM7SUFDZixDQUFDO0FBQ0gsQ0FBQyxDQUFDO0FBRVMsUUFBQSxjQUFjLEdBQUcsR0FBRyxFQUFFO0lBQy9CLE1BQU0sQ0FBQyxPQUFPLE9BQU8sQ0FBQyxHQUFHLENBQUMsWUFBWSxJQUFJLFdBQVcsQ0FBQztBQUN4RCxDQUFDLENBQUMifQ==
|
|
||||||
|
20
dist/smartci.check.js
vendored
Normal file
20
dist/smartci.check.js
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/// <reference path="typings/main.d.ts" />
|
||||||
|
"use strict";
|
||||||
|
exports.isCi = function () {
|
||||||
|
if (process.env.CI == "true") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
exports.isTaggedCommit = function () {
|
||||||
|
if (process.env.TRAVIS_TAG != "") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2kuY2hlY2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsMENBQTBDOztBQUkvQixZQUFJLEdBQUc7SUFDZCxFQUFFLENBQUEsQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFDLEVBQUUsSUFBSSxNQUFNLENBQUMsQ0FBQSxDQUFDO1FBQ3pCLE1BQU0sQ0FBQyxJQUFJLENBQUM7SUFDaEIsQ0FBQztJQUFDLElBQUksQ0FBQyxDQUFDO1FBQ0osTUFBTSxDQUFDLEtBQUssQ0FBQztJQUNqQixDQUFDO0FBQ0wsQ0FBQyxDQUFDO0FBRVMsc0JBQWMsR0FBRztJQUN4QixFQUFFLENBQUEsQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFDLFVBQVUsSUFBSSxFQUFFLENBQUMsQ0FBQSxDQUFDO1FBQzdCLE1BQU0sQ0FBQyxJQUFJLENBQUM7SUFDaEIsQ0FBQztJQUFDLElBQUksQ0FBQyxDQUFDO1FBQ0osTUFBTSxDQUFDLEtBQUssQ0FBQztJQUNqQixDQUFDO0FBQ0wsQ0FBQyxDQUFDIiwiZmlsZSI6InNtYXJ0Y2kuY2hlY2suanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLy8gPHJlZmVyZW5jZSBwYXRoPVwidHlwaW5ncy9tYWluLmQudHNcIiAvPlxuXG5pbXBvcnQgcGx1Z2lucyA9IHJlcXVpcmUoXCIuL3NtYXJ0Y2kucGx1Z2luc1wiKTtcblxuZXhwb3J0IGxldCBpc0NpID0gZnVuY3Rpb24oKTpib29sZWFuIHtcbiAgICBpZihwcm9jZXNzLmVudi5DSSA9PSBcInRydWVcIil7XG4gICAgICAgIHJldHVybiB0cnVlO1xuICAgIH0gZWxzZSB7XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9XG59O1xuXG5leHBvcnQgbGV0IGlzVGFnZ2VkQ29tbWl0ID0gZnVuY3Rpb24oKXtcbiAgICBpZihwcm9jZXNzLmVudi5UUkFWSVNfVEFHICE9IFwiXCIpe1xuICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICB9IGVsc2Uge1xuICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgfVxufTtcblxuIl0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9
|
17
dist/smartci.get.js
vendored
Normal file
17
dist/smartci.get.js
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/// <reference path="typings/main.d.ts" />
|
||||||
|
"use strict";
|
||||||
|
exports.ciName = function () {
|
||||||
|
};
|
||||||
|
exports.jobNumberString = function () {
|
||||||
|
return process.env.TRAVIS_JOB_NUMBER;
|
||||||
|
};
|
||||||
|
exports.mainJobNumber = function () {
|
||||||
|
return parseInt(exports.jobNumberString());
|
||||||
|
};
|
||||||
|
exports.subJobNumber = function () {
|
||||||
|
var subJobRegex = /[0-9]*\.(.*)/;
|
||||||
|
var regexArray = subJobRegex.exec(exports.jobNumberString());
|
||||||
|
return parseInt(regexArray[1]);
|
||||||
|
};
|
||||||
|
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2kuZ2V0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDBDQUEwQzs7QUFJL0IsY0FBTSxHQUFHO0FBRXBCLENBQUMsQ0FBQztBQUVTLHVCQUFlLEdBQUc7SUFDekIsTUFBTSxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsaUJBQWlCLENBQUM7QUFDekMsQ0FBQyxDQUFDO0FBRVMscUJBQWEsR0FBRztJQUN2QixNQUFNLENBQUMsUUFBUSxDQUFDLHVCQUFlLEVBQUUsQ0FBQyxDQUFDO0FBQ3ZDLENBQUMsQ0FBQztBQUVTLG9CQUFZLEdBQUc7SUFDdEIsSUFBSSxXQUFXLEdBQUcsY0FBYyxDQUFDO0lBQ2pDLElBQUksVUFBVSxHQUFHLFdBQVcsQ0FBQyxJQUFJLENBQUMsdUJBQWUsRUFBRSxDQUFDLENBQUM7SUFDckQsTUFBTSxDQUFDLFFBQVEsQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUNuQyxDQUFDLENBQUMiLCJmaWxlIjoic21hcnRjaS5nZXQuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLy8gPHJlZmVyZW5jZSBwYXRoPVwidHlwaW5ncy9tYWluLmQudHNcIiAvPlxuXG5pbXBvcnQgcGx1Z2lucyA9IHJlcXVpcmUoXCIuL3NtYXJ0Y2kucGx1Z2luc1wiKTtcblxuZXhwb3J0IGxldCBjaU5hbWUgPSBmdW5jdGlvbigpe1xuXG59O1xuXG5leHBvcnQgbGV0IGpvYk51bWJlclN0cmluZyA9IGZ1bmN0aW9uKCk6c3RyaW5nIHtcbiAgICByZXR1cm4gcHJvY2Vzcy5lbnYuVFJBVklTX0pPQl9OVU1CRVI7XG59O1xuXG5leHBvcnQgbGV0IG1haW5Kb2JOdW1iZXIgPSBmdW5jdGlvbigpOm51bWJlcntcbiAgICByZXR1cm4gcGFyc2VJbnQoam9iTnVtYmVyU3RyaW5nKCkpO1xufTtcblxuZXhwb3J0IGxldCBzdWJKb2JOdW1iZXIgPSBmdW5jdGlvbigpOm51bWJlciB7XG4gICAgbGV0IHN1YkpvYlJlZ2V4ID0gL1swLTldKlxcLiguKikvO1xuICAgIGxldCByZWdleEFycmF5ID0gc3ViSm9iUmVnZXguZXhlYyhqb2JOdW1iZXJTdHJpbmcoKSk7XG4gICAgcmV0dXJuIHBhcnNlSW50KHJlZ2V4QXJyYXlbMV0pO1xufTtcblxuIl0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9
|
2
dist/smartci.plugins.d.ts
vendored
2
dist/smartci.plugins.d.ts
vendored
@ -1,2 +0,0 @@
|
|||||||
import * as path from 'path';
|
|
||||||
export { path };
|
|
8
dist/smartci.plugins.js
vendored
8
dist/smartci.plugins.js
vendored
@ -1,5 +1,5 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
/// <reference path="typings/main.d.ts" />
|
||||||
const path = require("path");
|
exports.path = require("path");
|
||||||
exports.path = path;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjaS5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRjaS5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBRXBCLG9CQUFJIn0=
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2kucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMENBQTBDO0FBQy9CLFlBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUMiLCJmaWxlIjoic21hcnRjaS5wbHVnaW5zLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cInR5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbmV4cG9ydCBsZXQgcGF0aCA9IHJlcXVpcmUoXCJwYXRoXCIpOyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"npmci": {
|
|
||||||
"npmGlobalTools": [
|
|
||||||
"npmts"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "smartci",
|
"name": "smartci",
|
||||||
"version": "1.0.4",
|
"version": "0.0.1",
|
||||||
"description": "makes it easy to automate tasks with Continuous Integration",
|
"description": "makes it easy to automate tasks with Continuous Integration",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts)"
|
"test": "(npmts)"
|
||||||
},
|
},
|
||||||
@ -21,10 +20,10 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/pushrocks/smartci",
|
"homepage": "https://github.com/pushrocks/smartci",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"beautylog": "^6.1.10"
|
"beautylog": "^1.0.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^9.4.6",
|
"npmts": "^3.5.0",
|
||||||
"tapbundle": "^1.1.8"
|
"should": "^8.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
42
test/test.js
Normal file
42
test/test.js
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/// <reference path="../ts/typings/main.d.ts" />
|
||||||
|
var smartci = require("../dist/index.js");
|
||||||
|
var should = require("should");
|
||||||
|
process.env.TRAVIS_JOB_NUMBER = "180.3";
|
||||||
|
process.env.TRAVIS_TAG = "";
|
||||||
|
process.env.CI = "true";
|
||||||
|
describe("smartci", function () {
|
||||||
|
describe("check", function () {
|
||||||
|
describe(".isCi", function () {
|
||||||
|
it("should state if we are in a CI environment", function () {
|
||||||
|
smartci.check.isCi().should.be.true();
|
||||||
|
process.env.CI = "false";
|
||||||
|
smartci.check.isCi().should.be.false();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe(".isTaggedCommit", function () {
|
||||||
|
it("should state if we are dealing with a tagged commit", function () {
|
||||||
|
smartci.check.isTaggedCommit().should.be.false();
|
||||||
|
process.env.TRAVIS_TAG = "v0.3.1";
|
||||||
|
smartci.check.isTaggedCommit().should.be.true();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe("get", function () {
|
||||||
|
describe(".jobNumberString", function () {
|
||||||
|
it("should get the correct job number", function () {
|
||||||
|
smartci.get.jobNumberString().should.equal("180.3");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe(".mainJobNumber", function () {
|
||||||
|
it("should get the correct main job number", function () {
|
||||||
|
smartci.get.mainJobNumber().should.equal(180);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe(".subJobNumber", function () {
|
||||||
|
it("should get the correct sub job number", function () {
|
||||||
|
smartci.get.subJobNumber().should.equal(3);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=test.js.map
|
1
test/test.js.map
Normal file
1
test/test.js.map
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,IAAI,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC1C,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,OAAO,CAAC;AACxC,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,EAAE,CAAC;AAC5B,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC;AAExB,QAAQ,CAAC,SAAS,EAAC;IACf,QAAQ,CAAC,OAAO,EAAC;QACb,QAAQ,CAAC,OAAO,EAAC;YACb,EAAE,CAAC,4CAA4C,EAAC;gBAC5C,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;gBACtC,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC;gBACzB,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;YAC3C,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QACH,QAAQ,CAAC,iBAAiB,EAAC;YACvB,EAAE,CAAC,qDAAqD,EAAC;gBACrD,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;gBACjD,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,QAAQ,CAAC;gBAClC,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;YACpD,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,KAAK,EAAC;QACX,QAAQ,CAAC,kBAAkB,EAAC;YACxB,EAAE,CAAC,mCAAmC,EAAC;gBACnC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACxD,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QACH,QAAQ,CAAC,gBAAgB,EAAC;YACtB,EAAE,CAAC,wCAAwC,EAAC;gBACxC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAClD,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAC;QACH,QAAQ,CAAC,eAAe,EAAC;YACrB,EAAE,CAAC,uCAAuC,EAAC;gBACvC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC/C,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AAEP,CAAC,CAAC,CAAC"}
|
54
test/test.ts
54
test/test.ts
@ -1,22 +1,44 @@
|
|||||||
import { tap, expect } from 'tapbundle';
|
/// <reference path="../ts/typings/main.d.ts" />
|
||||||
|
var smartci = require("../dist/index.js");
|
||||||
import * as smartci from "../ts/index";
|
var should = require("should");
|
||||||
|
|
||||||
process.env.TRAVIS_JOB_NUMBER = "180.3";
|
process.env.TRAVIS_JOB_NUMBER = "180.3";
|
||||||
|
process.env.TRAVIS_TAG = "";
|
||||||
process.env.CI = "true";
|
process.env.CI = "true";
|
||||||
|
|
||||||
|
describe("smartci",function(){
|
||||||
tap.test("should state if we are in a CI environment", async () => {
|
describe("check",function(){
|
||||||
expect(smartci.isCi()).to.be.true();
|
describe(".isCi",function(){
|
||||||
|
it("should state if we are in a CI environment",function(){
|
||||||
|
smartci.check.isCi().should.be.true();
|
||||||
process.env.CI = "false";
|
process.env.CI = "false";
|
||||||
expect(smartci.isCi()).to.be.false();
|
smartci.check.isCi().should.be.false();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe(".isTaggedCommit",function(){
|
||||||
|
it("should state if we are dealing with a tagged commit",function(){
|
||||||
|
smartci.check.isTaggedCommit().should.be.false();
|
||||||
|
process.env.TRAVIS_TAG = "v0.3.1";
|
||||||
|
smartci.check.isTaggedCommit().should.be.true();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe("get",function(){
|
||||||
|
describe(".jobNumberString",function(){
|
||||||
|
it("should get the correct job number",function(){
|
||||||
|
smartci.get.jobNumberString().should.equal("180.3");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe(".mainJobNumber",function(){
|
||||||
|
it("should get the correct main job number",function(){
|
||||||
|
smartci.get.mainJobNumber().should.equal(180);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
describe(".subJobNumber",function(){
|
||||||
|
it("should get the correct sub job number",function(){
|
||||||
|
smartci.get.subJobNumber().should.equal(3);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test("should state if we are dealing with a tagged commit", async () => {
|
|
||||||
delete process.env[ "CI_BUILD_TAG" ];
|
|
||||||
expect(smartci.isTaggedCommit()).to.be.false();
|
|
||||||
process.env.CI_BUILD_TAG = "3.1.2";
|
|
||||||
expect(smartci.isTaggedCommit()).to.be.true();
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.start()
|
|
||||||
|
19
ts/index.ts
19
ts/index.ts
@ -1,13 +1,10 @@
|
|||||||
import plugins = require('./smartci.plugins');
|
/// <reference path="typings/main.d.ts" />
|
||||||
|
import plugins = require("./smartci.plugins");
|
||||||
export let isCi = function(): boolean {
|
import SmartCiCheck = require("./smartci.check");
|
||||||
if (process.env.CI == 'true') {
|
import SmartCiGet = require("./smartci.get");
|
||||||
return true;
|
let smartci = {
|
||||||
} else {
|
check: SmartCiCheck,
|
||||||
return false;
|
get: SmartCiGet
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export let isTaggedCommit = () => {
|
export = smartci;
|
||||||
return typeof process.env.CI_BUILD_TAG != 'undefined';
|
|
||||||
};
|
|
||||||
|
20
ts/smartci.check.ts
Normal file
20
ts/smartci.check.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/// <reference path="typings/main.d.ts" />
|
||||||
|
|
||||||
|
import plugins = require("./smartci.plugins");
|
||||||
|
|
||||||
|
export let isCi = function():boolean {
|
||||||
|
if(process.env.CI == "true"){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export let isTaggedCommit = function(){
|
||||||
|
if(process.env.TRAVIS_TAG != ""){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
22
ts/smartci.get.ts
Normal file
22
ts/smartci.get.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/// <reference path="typings/main.d.ts" />
|
||||||
|
|
||||||
|
import plugins = require("./smartci.plugins");
|
||||||
|
|
||||||
|
export let ciName = function(){
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
export let jobNumberString = function():string {
|
||||||
|
return process.env.TRAVIS_JOB_NUMBER;
|
||||||
|
};
|
||||||
|
|
||||||
|
export let mainJobNumber = function():number{
|
||||||
|
return parseInt(jobNumberString());
|
||||||
|
};
|
||||||
|
|
||||||
|
export let subJobNumber = function():number {
|
||||||
|
let subJobRegex = /[0-9]*\.(.*)/;
|
||||||
|
let regexArray = subJobRegex.exec(jobNumberString());
|
||||||
|
return parseInt(regexArray[1]);
|
||||||
|
};
|
||||||
|
|
@ -1,3 +1,2 @@
|
|||||||
import * as path from 'path';
|
/// <reference path="typings/main.d.ts" />
|
||||||
|
export let path = require("path");
|
||||||
export { path };
|
|
12
ts/tsd.json
Normal file
12
ts/tsd.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"version": "v4",
|
||||||
|
"repo": "borisyankov/DefinitelyTyped",
|
||||||
|
"ref": "master",
|
||||||
|
"path": "typings",
|
||||||
|
"bundle": "typings/tsd.d.ts",
|
||||||
|
"installed": {
|
||||||
|
"node/node.d.ts": {
|
||||||
|
"commit": "efa0c1196d7280640e624ac1e7fa604502e7bd63"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
ts/typings.json
Normal file
7
ts/typings.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"version": false,
|
||||||
|
"ambientDependencies": {
|
||||||
|
"mocha": "registry:dt/mocha#2.2.5+20160317120654",
|
||||||
|
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#efa0c1196d7280640e624ac1e7fa604502e7bd63"
|
||||||
|
}
|
||||||
|
}
|
2
ts/typings/browser.d.ts
vendored
Normal file
2
ts/typings/browser.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/// <reference path="browser/ambient/mocha/index.d.ts" />
|
||||||
|
/// <reference path="browser/ambient/node/index.d.ts" />
|
238
ts/typings/browser/ambient/mocha/index.d.ts
vendored
Normal file
238
ts/typings/browser/ambient/mocha/index.d.ts
vendored
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
// Generated by typings
|
||||||
|
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/mocha/mocha.d.ts
|
||||||
|
// 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/DefinitelyTyped/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 namespace 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;
|
||||||
|
}
|
2081
ts/typings/browser/ambient/node/index.d.ts
vendored
Normal file
2081
ts/typings/browser/ambient/node/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
ts/typings/main.d.ts
vendored
Normal file
2
ts/typings/main.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/// <reference path="main/ambient/mocha/index.d.ts" />
|
||||||
|
/// <reference path="main/ambient/node/index.d.ts" />
|
238
ts/typings/main/ambient/mocha/index.d.ts
vendored
Normal file
238
ts/typings/main/ambient/mocha/index.d.ts
vendored
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
// Generated by typings
|
||||||
|
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/mocha/mocha.d.ts
|
||||||
|
// 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/DefinitelyTyped/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 namespace 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;
|
||||||
|
}
|
2081
ts/typings/main/ambient/node/index.d.ts
vendored
Normal file
2081
ts/typings/main/ambient/node/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user