now ready for npmts
This commit is contained in:
parent
33f77ee5f2
commit
a1845b697d
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,3 +1,6 @@
|
||||
node_modules/
|
||||
.settings/
|
||||
docs/
|
||||
coverage/
|
||||
ts/**/*.js
|
||||
ts/**/*.js.map
|
||||
.idea/
|
@ -5,12 +5,12 @@ before_install:
|
||||
- npm install -g tsd
|
||||
deploy:
|
||||
provider: npm
|
||||
email: npm@smart-coordination.com
|
||||
email: npm@lossless.digital
|
||||
api_key:
|
||||
secure: uNjLbNelm8nj9R/tRlwRvcXWLS1QtA0QEbDKPDTWHNo68wAHgdwXIdzkVkNcihZYVasR/LqGuSLfzoD4H8mKmCXD+v85h048VmmtWniZQRp/OVWl0uzRwDDryhiYlhY5U9oOFEQsMO96C8qPqcGchq+DA7Gi3ZnAl7pmeb54xp9H+7jmLyZTyO8Hq00anV5PopBOW23mZEnWHznzYeg83BlWmLdbyfyZKT4W5Urg1BAMgxt9PdtrQoiPy4LP6AHXG88kvY3Iz8OBG+h/06bura8MPfeupGoktodN9krb+sRE/COybATWImMh9Z5gI5TWqUR7tp7XivpgolYY41gaN93oUQ9EOTdJ5kFku1dnPrNFqXO/97slVTMR6fMMgRXwzTz6BiKI1NsAZeW7oLUONw06APZ6VBhVY6Po3Rioun8OE9Q0wXm/BvnRqVHt3sew4MIgmEBwQSQE14gLJGGgNojzmcPstc0czQp+kzV5DpGiW3IWIWZ7MsBJOOJ13RHeb6koFdBR7JZj0QzzBcWD7juJVOS45MlP7hU/sKRDO/fN3nu8TNwHvJab6XYP5/gqlbh/3h2vb7bxyDXiKGi2Ds8hZOHoyWoCrU3sbH3eKKkKo+LFI3J7PbY11T6TkSAdszLsQzcvC2QlsGQRWVywYMm32R6BVfxF3AlLX5a8JsI=
|
||||
secure: IDaGgZVFlJW5wq93XhwPK/2YnampoLWIbd7/czCpZ55m+Ybn30FT6P+smnOIuC9acmTcH3qmQUxFhUZ7m23gYhaUQPmKjnbo8+i4y/HinXPpGNzI9U6d1ZQEX31GmHVi1/FEAwjidQJ7srQzshVbaAl5KAGuASGLLIfCOJYekKHI6HQ7s7qL9RHCHIB7Ju7D/wjUMguBeNnJSn6PtXcR4dGSz+l3sMpeNCRWuzn4h9amJoNHR3XV/bpDp79NFyukfmUFKiR/YUJ6IjHIeH/rvSeSXvpVmUyrjl4r9IoYOQPoO8BMA2Lp999f8iZ1YUKsK1006qNXYPmYCd/IV+dNeWggJ+SB3tSWlnlWE8kM7cX5Xu1tUnbVWLkXiVfz5BrY+Z1KA6V1a5QIncB+JE+JhtHWAA0PvwicWULCzxIoXT9Iye/Pw/fNyAky6goNVRk4O67tLMYmLmbo+7NcqlHaG9D4z6x1DlAM+ED7XWDrjlio/ZB2/9dotc8eSprpZWmsZYSJkeXuF4tH272BEugKtBBu/NdhxkYbFWVeJ4L2DA1aRJlFDCVd8p0Oq7QkgT7HlEvCuH+AHM3dEqGNpQsyA+uI5H1O4WwEnCuyUNsX59uC6Ll2o+U8+9av0oksZUQ+7LXSRxaBGsX70siWITlPGIRqUiLNBJFBjlz+xN7JirA=
|
||||
on:
|
||||
tags: true
|
||||
repo: pushrocks/smartenv
|
||||
repo: pushrocks/smartci
|
||||
notifications:
|
||||
slack:
|
||||
secure: f5Uss0z9RPl/QcA/DroB8loyE93aOYI6bqCkrsiUscmZtlv/TVQtT4dxqGA6uvcG6iTQDBi3Ul88dQxWkRm4IqbhY35/iMaV2dHW4FVYMAh8GQMbsfL2sALCcufxD9blw47awv3iFcwhV1EeyesscjgL0JIjduk96v/7G/6QIO2838M1lzlgtj+kRUkim8qkaEs1je3gRrhMUIjLuAdscMXyUKYFMjWo9ACSjVUl30R/ZNemb18itIja6i92GotreBgcfEMczvy58ovDC7xdJUsY8LjMI01DwY+WPRnI0tAhsuI8moBwwcdM4e3bAjKjucQRjO33O5bMWRZ6QCiYd0DnCEFyCPQLJ4GSy/tkD00n8ijLHAOSV3AH1zNbdK1EAdSPQXDvlI36KJn/2hyQLoitGHVUPr76ujJWP82ypO2tgIp3XQU0dJVCxDuHnwJO2+hjdI+gCPqxNTpjeujHx3UdkTGNRjuuf9dlZ/D08fApjYxy2fxItTqo3QjP/nrqvBXUOPP8yPHpjIT4H2t5Pr4SJjBGI6X4qhKyFj6s9rA/Xu1rL+45zu1C3uC3z+u3T9UwrbzJ/cZM6r6UQvQmUvIfBNaMlg4I/diQCDIPL+Rhop2nylY3IcHmJnk2itn7kOqj1tohCpFEml5pRuSZy4udWywkdtyBAsHWFLF7oiQ=
|
||||
|
22
README.md
22
README.md
@ -1,28 +1,22 @@
|
||||
# smartenv
|
||||
store things about your environment and let them travel across modules
|
||||
# smartci
|
||||
store things about your environment and let them travel across modules.
|
||||
|
||||
## Status
|
||||
[![Build Status](https://travis-ci.org/pushrocks/smartenv.svg?branch=release)](https://travis-ci.org/pushrocks/smartenv)
|
||||
[![Dependency Status](https://david-dm.org/pushrocks/smartenv.svg)](https://david-dm.org/pushrocks/smartenv)
|
||||
[![devDependency Status](https://david-dm.org/pushrocks/smartenv/dev-status.svg)](https://david-dm.org/pushrocks/smartenv#info=devDependencies)
|
||||
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartenv/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartenv/master/dependencies/npm)
|
||||
[![bitHound Overalll Score](https://www.bithound.io/github/pushrocks/smartenv/badges/score.svg)](https://www.bithound.io/github/pushrocks/smartenv)
|
||||
[![Build Status](https://travis-ci.org/pushrocks/smartci.svg?branch=release)](https://travis-ci.org/pushrocks/smartci)
|
||||
[![Dependency Status](https://david-dm.org/pushrocks/smartci.svg)](https://david-dm.org/pushrocks/smartci)
|
||||
[![devDependency Status](https://david-dm.org/pushrocks/smartci/dev-status.svg)](https://david-dm.org/pushrocks/smartci#info=devDependencies)
|
||||
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartci/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartci/master/dependencies/npm)
|
||||
[![bitHound Overalll Score](https://www.bithound.io/github/pushrocks/smartci/badges/score.svg)](https://www.bithound.io/github/pushrocks/smartci)
|
||||
|
||||
## Install
|
||||
Install the package through npm
|
||||
|
||||
```
|
||||
npm install smartenv
|
||||
npm install smartci
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var smartenv = require("smartenv");
|
||||
|
||||
smartenv.info(); //prints an output about your current environment and registered objects
|
||||
smartenv.register({akey:"a text"},"somevalue"); // register a new object
|
||||
smartenv.makeGlobal() // make smartenv available from gobal.smartenv
|
||||
smartenv.get("somevalue").akey; // returns "a text"
|
||||
smartenv.items.somevalue.akey; // also returns "a text"
|
||||
```
|
10
dist/index.js
vendored
Normal file
10
dist/index.js
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
var SmartCiCheck = require("./smartci.check");
|
||||
var SmartCiGet = require("./smartci.get");
|
||||
var smartci = {
|
||||
check: SmartCiCheck,
|
||||
get: SmartCiGet
|
||||
};
|
||||
module.exports = smartci;
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFQSxJQUFPLFlBQVksV0FBVyxpQkFBaUIsQ0FBQyxDQUFDO0FBQ2pELElBQU8sVUFBVSxXQUFXLGVBQWUsQ0FBQyxDQUFDO0FBQzdDLElBQUksT0FBTyxHQUFHO0lBQ1YsS0FBSyxFQUFFLFlBQVk7SUFDbkIsR0FBRyxFQUFFLFVBQVU7Q0FDbEIsQ0FBQztBQUVGLGlCQUFTLE9BQU8sQ0FBQyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vLyA8cmVmZXJlbmNlIHBhdGg9XCJ0eXBpbmdzL21haW4uZC50c1wiIC8+XG5pbXBvcnQgcGx1Z2lucyA9IHJlcXVpcmUoXCIuL3NtYXJ0Y2kucGx1Z2luc1wiKTtcbmltcG9ydCBTbWFydENpQ2hlY2sgPSByZXF1aXJlKFwiLi9zbWFydGNpLmNoZWNrXCIpO1xuaW1wb3J0IFNtYXJ0Q2lHZXQgPSByZXF1aXJlKFwiLi9zbWFydGNpLmdldFwiKTtcbmxldCBzbWFydGNpID0ge1xuICAgIGNoZWNrOiBTbWFydENpQ2hlY2ssXG4gICAgZ2V0OiBTbWFydENpR2V0XG59O1xuXG5leHBvcnQgPSBzbWFydGNpO1xuIl0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9
|
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
|
5
dist/smartci.plugins.js
vendored
Normal file
5
dist/smartci.plugins.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
/// <reference path="typings/main.d.ts" />
|
||||
exports.path = require("path");
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2kucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMENBQTBDO0FBQy9CLFlBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUMiLCJmaWxlIjoic21hcnRjaS5wbHVnaW5zLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cInR5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbmV4cG9ydCBsZXQgcGF0aCA9IHJlcXVpcmUoXCJwYXRoXCIpOyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
|
35
index.js
35
index.js
@ -1,35 +0,0 @@
|
||||
/// <reference path="typings/tsd.d.ts" />
|
||||
var beautylog = require("beautylog")("os");
|
||||
var addToGlobal = function (objectArg, paramName) {
|
||||
global[paramName] = objectArg;
|
||||
};
|
||||
var smartenv = {}; //create smartenv object
|
||||
smartenv.items = {}; // create the items object to store items to.
|
||||
smartenv.makeGlobal = function () {
|
||||
addToGlobal(smartenv, "smartenv"); //add object smartenv as global["smartenv"]
|
||||
};
|
||||
smartenv.info = {};
|
||||
smartenv.info.node = {};
|
||||
smartenv.info.node.version = process.version;
|
||||
smartenv.info.print = function () {
|
||||
var pck = require("./package.json");
|
||||
beautylog.log("node version is " + smartenv.info.node.version + " and smartenv version is " + pck.version);
|
||||
beautylog.log("the smartenv module currently holds the following properties:");
|
||||
console.log(Object.getOwnPropertyNames(smartenv.items).sort());
|
||||
};
|
||||
smartenv.register = function (objectArg, paramName) {
|
||||
if (paramName === void 0) { paramName = "undefined"; }
|
||||
if (paramName == "undefined") {
|
||||
beautylog.error("paramName is undefined");
|
||||
return;
|
||||
}
|
||||
smartenv.items[paramName] = objectArg;
|
||||
};
|
||||
smartenv.get = function (keyName) {
|
||||
return smartenv.items[keyName];
|
||||
};
|
||||
smartenv.exportEnv = function () {
|
||||
};
|
||||
smartenv.importEnv = function () {
|
||||
};
|
||||
module.exports = smartenv;
|
10
package.json
10
package.json
@ -2,12 +2,9 @@
|
||||
"name": "smartci",
|
||||
"version": "0.0.0",
|
||||
"description": "makes it easy to automate tasks with Continuous Integration",
|
||||
"main": "index.js",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"test": "(cd ts/compile && node compile.js) && (node test.js)",
|
||||
"reinstall": "(rm -r node_modules && npm install)",
|
||||
"release": "(git pull origin master && npm version patch && git push origin master && git checkout release && git merge master && git push origin release && git checkout master)",
|
||||
"startdev": "(git checkout master && git pull origin master && npm install)"
|
||||
"test": "(npmts)"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -26,6 +23,7 @@
|
||||
"beautylog": "^1.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"npmts": "^3.5.0"
|
||||
"npmts": "^3.5.0",
|
||||
"should": "^8.2.2"
|
||||
}
|
||||
}
|
||||
|
15
test.js
15
test.js
@ -1,15 +0,0 @@
|
||||
/// <reference path="typings/tsd.d.ts" />
|
||||
var smartenv = require("./index.js");
|
||||
var beautylog = require("beautylog")("os");
|
||||
beautylog.info("Now testing the smartenv module");
|
||||
smartenv.info.print();
|
||||
beautylog.info("Now testing the smartenv module");
|
||||
smartenv.register({ key1: "Peter" }, "docit");
|
||||
smartenv.info.print();
|
||||
beautylog.log(smartenv.get("docit").key1);
|
||||
smartenv.makeGlobal();
|
||||
beautylog.log(global.smartenv.get("docit").key1);
|
||||
var key2 = "hello";
|
||||
smartenv.get("docit").key2 = key2;
|
||||
beautylog.log(global.smartenv.get("docit").key2);
|
||||
beautylog.success("Success!");
|
43
test/test.js
Normal file
43
test/test.js
Normal file
@ -0,0 +1,43 @@
|
||||
/// <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=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksT0FBTyxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzFDLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUUvQixPQUFPLENBQUMsR0FBRyxDQUFDLGlCQUFpQixHQUFHLE9BQU8sQ0FBQztBQUN4QyxPQUFPLENBQUMsR0FBRyxDQUFDLFVBQVUsR0FBRyxFQUFFLENBQUM7QUFDNUIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxFQUFFLEdBQUcsTUFBTSxDQUFDO0FBRXhCLFFBQVEsQ0FBQyxTQUFTLEVBQUM7SUFDZixRQUFRLENBQUMsT0FBTyxFQUFDO1FBQ2IsUUFBUSxDQUFDLE9BQU8sRUFBQztZQUNiLEVBQUUsQ0FBQyw0Q0FBNEMsRUFBQztnQkFDNUMsT0FBTyxDQUFDLEtBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxNQUFNLENBQUMsRUFBRSxDQUFDLElBQUksRUFBRSxDQUFDO2dCQUN0QyxPQUFPLENBQUMsR0FBRyxDQUFDLEVBQUUsR0FBRyxPQUFPLENBQUM7Z0JBQ3pCLE9BQU8sQ0FBQyxLQUFLLENBQUMsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxLQUFLLEVBQUUsQ0FBQztZQUMzQyxDQUFDLENBQUMsQ0FBQztRQUNQLENBQUMsQ0FBQyxDQUFDO1FBQ0gsUUFBUSxDQUFDLGlCQUFpQixFQUFDO1lBQ3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1YiBqb2IgbnVtYmVyXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgICAgICBzbWFydGNpLmdldC5zdWJKb2JOdW1iZXIoKS5zaG91bGQuZXF1YWwoMyk7XG4gICAgICAgICAgICB9KVxuICAgICAgICB9KTtcbiAgICB9KTtcblxufSk7Il0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9
|
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"}
|
44
test/test.ts
Normal file
44
test/test.ts
Normal file
@ -0,0 +1,44 @@
|
||||
/// <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);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
});
|
@ -1,7 +0,0 @@
|
||||
/// <reference path="index.ts" />
|
||||
class Environment {
|
||||
runtimeEnv:string;
|
||||
isBrowser:boolean;
|
||||
isNode:boolean;
|
||||
|
||||
}
|
62
ts/index.ts
62
ts/index.ts
@ -1,56 +1,10 @@
|
||||
/// <reference path="typings/tsd.d.ts" />
|
||||
/// <reference path="classes.ts" />
|
||||
var beautylog = require("beautylog")("os");
|
||||
var addToGlobal = function(objectArg,paramName) {
|
||||
global[paramName] = objectArg;
|
||||
};
|
||||
var smartenv:any = {}; //create smartenv object
|
||||
smartenv.items = {}; // create the items object to store items to.
|
||||
smartenv.makeGlobal = function() {
|
||||
addToGlobal(smartenv,"smartenv");//add object smartenv as global["smartenv"]
|
||||
/// <reference path="typings/main.d.ts" />
|
||||
import plugins = require("./smartci.plugins");
|
||||
import SmartCiCheck = require("./smartci.check");
|
||||
import SmartCiGet = require("./smartci.get");
|
||||
let smartci = {
|
||||
check: SmartCiCheck,
|
||||
get: SmartCiGet
|
||||
};
|
||||
|
||||
|
||||
smartenv.info = {};
|
||||
smartenv.info.jsenv = function() {
|
||||
var app = {
|
||||
env: '',
|
||||
agent: ''
|
||||
};
|
||||
|
||||
if (window) {
|
||||
app.env = 'browser';
|
||||
app.agent = navigator.userAgent;
|
||||
} else if (process) {
|
||||
app.env = 'node';
|
||||
}
|
||||
};
|
||||
smartenv.info.node = {};
|
||||
smartenv.info.node.version = process.version;
|
||||
smartenv.info.print = function() {
|
||||
var pck = require("./package.json");
|
||||
beautylog.log("node version is " + smartenv.info.node.version + " and smartenv version is " + pck.version);
|
||||
beautylog.log("the smartenv module currently holds the following properties:");
|
||||
console.log(Object.getOwnPropertyNames(smartenv.items).sort());
|
||||
};
|
||||
|
||||
smartenv.register = function(objectArg,paramName = "undefined") {
|
||||
if (paramName == "undefined"){
|
||||
beautylog.error("paramName is undefined");
|
||||
return;
|
||||
}
|
||||
smartenv.items[paramName] = objectArg;
|
||||
};
|
||||
smartenv.get = function(keyName) {
|
||||
return smartenv.items[keyName];
|
||||
};
|
||||
|
||||
smartenv.exportEnv = function() {
|
||||
|
||||
};
|
||||
|
||||
smartenv.importEnv = function() {
|
||||
|
||||
};
|
||||
|
||||
module.exports = smartenv;
|
||||
export = smartci;
|
||||
|
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]);
|
||||
};
|
||||
|
2
ts/smartci.plugins.ts
Normal file
2
ts/smartci.plugins.ts
Normal file
@ -0,0 +1,2 @@
|
||||
/// <reference path="typings/main.d.ts" />
|
||||
export let path = require("path");
|
16
ts/test.js
16
ts/test.js
@ -1,16 +0,0 @@
|
||||
/// <reference path="typings/tsd.d.ts" />
|
||||
var smartenv = require("./index.js");
|
||||
var beautylog = require("beautylog")("os");
|
||||
beautylog.info("Now testing the smartenv module");
|
||||
smartenv.info.print();
|
||||
beautylog.info("Now testing the smartenv module");
|
||||
smartenv.register({ key1: "Peter" }, "docit");
|
||||
smartenv.info.print();
|
||||
beautylog.log(smartenv.get("docit").key1);
|
||||
smartenv.makeGlobal();
|
||||
beautylog.log(global.smartenv.get("docit").key1);
|
||||
var key2 = "hello";
|
||||
smartenv.get("docit").key2 = key2;
|
||||
beautylog.log(global.smartenv.get("docit").key2);
|
||||
beautylog.success("Success!");
|
||||
//# sourceMappingURL=test.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,IAAI,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACrC,IAAI,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3C,SAAS,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;AAClD,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;AACtB,SAAS,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;AAClD,QAAQ,CAAC,QAAQ,CAAC,EAAC,IAAI,EAAC,OAAO,EAAC,EAAC,OAAO,CAAC,CAAC;AAC1C,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;AACtB,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAC1C,QAAQ,CAAC,UAAU,EAAE,CAAC;AACtB,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAEjD,IAAI,IAAI,GAAG,OAAO,CAAC;AACnB,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC;AAClC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAEjD,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC"}
|
17
ts/test.ts
17
ts/test.ts
@ -1,17 +0,0 @@
|
||||
/// <reference path="typings/tsd.d.ts" />
|
||||
var smartenv = require("./index.js");
|
||||
var beautylog = require("beautylog")("os");
|
||||
beautylog.info("Now testing the smartenv module");
|
||||
smartenv.info.print();
|
||||
beautylog.info("Now testing the smartenv module");
|
||||
smartenv.register({key1:"Peter"},"docit");
|
||||
smartenv.info.print();
|
||||
beautylog.log(smartenv.get("docit").key1);
|
||||
smartenv.makeGlobal();
|
||||
beautylog.log(global.smartenv.get("docit").key1);
|
||||
|
||||
var key2 = "hello";
|
||||
smartenv.get("docit").key2 = key2;
|
||||
beautylog.log(global.smartenv.get("docit").key2);
|
||||
|
||||
beautylog.success("Success!");
|
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;
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
// Generated by typings
|
||||
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/efa0c1196d7280640e624ac1e7fa604502e7bd63/node/node.d.ts
|
||||
// Type definitions for Node.js v0.12.0
|
||||
// Project: http://nodejs.org/
|
||||
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>, DefinitelyTyped <https://github.com/borisyankov/DefinitelyTyped>
|
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
1
ts/typings/tsd.d.ts
vendored
1
ts/typings/tsd.d.ts
vendored
@ -1 +0,0 @@
|
||||
/// <reference path="node/node.d.ts" />
|
Loading…
Reference in New Issue
Block a user