Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
77a06a0fc4 | |||
c9792b1955 | |||
b87de178c0 | |||
0580f29d30 | |||
2c17273671 | |||
669ed2e6ab | |||
8bc73b2bf4 | |||
78e5defd7c | |||
7e540bda87 | |||
b293dfe92d | |||
a753a5db2c | |||
27f79b4425 | |||
1ada5dd5a9 | |||
a41bfd442c | |||
2917b10ffb | |||
bfc5bbbbb7 | |||
cf507a4a17 | |||
73a57ed264 | |||
39b79b679c | |||
cc053ee396 | |||
df5371187b | |||
cbda76c380 | |||
e20bcec133 | |||
3e673e04b2 | |||
2090dad540 |
35
README.md
35
README.md
@ -1,6 +1,13 @@
|
|||||||
# npmts
|
# npmts
|
||||||
Write npm modules with TypeScript without hassle.
|
Write npm modules with TypeScript without hassle.
|
||||||
|
|
||||||
|
## Status
|
||||||
|
[](https://travis-ci.org/pushrocks/npmts)
|
||||||
|
[](https://david-dm.org/pushrocks/npmts)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/npmts/master/dependencies/npm)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/npmts)
|
||||||
|
[](https://coveralls.io/github/pushrocks/npmts?branch=master)
|
||||||
|
|
||||||
## How to use npmts
|
## How to use npmts
|
||||||
|
|
||||||
### Install
|
### Install
|
||||||
@ -19,6 +26,23 @@ Then use it in package.json's script section to trigger a build:
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Default behaviour
|
### Default behaviour
|
||||||
|
|
||||||
|
**Execution order of tasks**
|
||||||
|
|
||||||
|
1. Install typings
|
||||||
|
2. Compile TypeScript
|
||||||
|
3. Create Declaration Files
|
||||||
|
4. Instrumentalize created JavaScript files with istanbul
|
||||||
|
5. Run Tests
|
||||||
|
6. Create Coverage report
|
||||||
|
7. Upload Coverage reports to travis (must be activated, only triggers on travis)
|
||||||
|
|
||||||
|
|
||||||
|
#### Typings
|
||||||
|
**npmts** looks for `./ts/typings.json` by default and installs any defined typings to `.ts/typings/`.
|
||||||
|
You can then reference the ./ts/typings/main.d.ts file in your TypeScript code.
|
||||||
|
|
||||||
|
#### TypeScript
|
||||||
by default npmts looks for `./ts/index.ts` and `./ts/test.ts` that will compile to
|
by default npmts looks for `./ts/index.ts` and `./ts/test.ts` that will compile to
|
||||||
`./index.js` and `./test.js`
|
`./index.js` and `./test.js`
|
||||||
|
|
||||||
@ -31,13 +55,21 @@ You can reference it in your package.json like this:
|
|||||||
"typings": "./index.d.ts",
|
"typings": "./index.d.ts",
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Instrumentalize Code
|
||||||
|
npmts instrumentalizes the created JavaScript code to create a coverage report.
|
||||||
|
|
||||||
|
#### Tests
|
||||||
|
When Typings have been installed, TypeScript + Declaration files have been transpiled and the resulting JS has been instrumentalized,
|
||||||
|
npmts runs `.test/test.js` with mocha.
|
||||||
|
|
||||||
When requiring the module from other TypeScript files,
|
When requiring the module from other TypeScript files,
|
||||||
the TypeScript Compiler will use the declaration file to resolve typings.
|
the TypeScript Compiler will use the declaration file to resolve typings.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Custom behaviour
|
### Custom behaviour
|
||||||
NPMTS looks for an npmts.json at the root of your package.
|
Custom behaviour can be achieved through a config file at the root of your package.
|
||||||
|
The file must be named **npmts.json**
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -55,6 +87,7 @@ NPMTS looks for an npmts.json at the root of your package.
|
|||||||
* **ts** You can list as many TypeScript files as you like. The key represents the source TypeScript file, the value the output file.
|
* **ts** You can list as many TypeScript files as you like. The key represents the source TypeScript file, the value the output file.
|
||||||
* **typings** is an array of all direcories that have a typings.json present. Uses the new typings tool from npm.
|
* **typings** is an array of all direcories that have a typings.json present. Uses the new typings tool from npm.
|
||||||
|
|
||||||
|
|
||||||
## Readme for Devs
|
## Readme for Devs
|
||||||
There is a [README-dev.md](README-dev.md) in the repo.
|
There is a [README-dev.md](README-dev.md) in the repo.
|
||||||
This is only of interest for you when looking to contribute to, improve or build upon this package.
|
This is only of interest for you when looking to contribute to, improve or build upon this package.
|
4
index.d.ts
vendored
4
index.d.ts
vendored
@ -6,11 +6,9 @@ declare module NpmtsPlugins {
|
|||||||
gulp: any;
|
gulp: any;
|
||||||
g: {
|
g: {
|
||||||
coveralls: any;
|
coveralls: any;
|
||||||
if: any;
|
|
||||||
insert: any;
|
insert: any;
|
||||||
istanbul: any;
|
istanbul: any;
|
||||||
mocha: any;
|
mocha: any;
|
||||||
sequence: any;
|
|
||||||
typescript: any;
|
typescript: any;
|
||||||
};
|
};
|
||||||
mergeStream: any;
|
mergeStream: any;
|
||||||
@ -45,11 +43,9 @@ declare var plugins: {
|
|||||||
gulp: any;
|
gulp: any;
|
||||||
g: {
|
g: {
|
||||||
coveralls: any;
|
coveralls: any;
|
||||||
if: any;
|
|
||||||
insert: any;
|
insert: any;
|
||||||
istanbul: any;
|
istanbul: any;
|
||||||
mocha: any;
|
mocha: any;
|
||||||
sequence: any;
|
|
||||||
typescript: any;
|
typescript: any;
|
||||||
};
|
};
|
||||||
mergeStream: any;
|
mergeStream: any;
|
||||||
|
50
index.js
50
index.js
@ -10,11 +10,9 @@ var NpmtsPlugins;
|
|||||||
gulp: require("gulp"),
|
gulp: require("gulp"),
|
||||||
g: {
|
g: {
|
||||||
coveralls: require("gulp-coveralls"),
|
coveralls: require("gulp-coveralls"),
|
||||||
if: require("gulp-if"),
|
|
||||||
insert: require("gulp-insert"),
|
insert: require("gulp-insert"),
|
||||||
istanbul: require("gulp-istanbul"),
|
istanbul: require("gulp-istanbul"),
|
||||||
mocha: require("gulp-mocha"),
|
mocha: require("gulp-mocha"),
|
||||||
sequence: require("gulp-sequence"),
|
|
||||||
typescript: require("gulp-typescript")
|
typescript: require("gulp-typescript")
|
||||||
},
|
},
|
||||||
mergeStream: require("merge2"),
|
mergeStream: require("merge2"),
|
||||||
@ -78,7 +76,7 @@ var NpmtsOptions;
|
|||||||
var done = plugins.q.defer();
|
var done = plugins.q.defer();
|
||||||
var config = configArg;
|
var config = configArg;
|
||||||
if (typeof config.coveralls === "undefined") {
|
if (typeof config.coveralls === "undefined") {
|
||||||
config.coveralls = true;
|
config.coveralls = false;
|
||||||
}
|
}
|
||||||
if (config.mode == "default") {
|
if (config.mode == "default") {
|
||||||
config.typings = [
|
config.typings = [
|
||||||
@ -86,6 +84,7 @@ var NpmtsOptions;
|
|||||||
];
|
];
|
||||||
config.ts = (_a = {},
|
config.ts = (_a = {},
|
||||||
_a["./ts/index.ts"] = "./index.js",
|
_a["./ts/index.ts"] = "./index.js",
|
||||||
|
_a["./ts/test.ts"] = "./test/test.js",
|
||||||
_a
|
_a
|
||||||
);
|
);
|
||||||
config.test = ["./index.js"];
|
config.test = ["./index.js"];
|
||||||
@ -169,7 +168,8 @@ var NpmtsCompile;
|
|||||||
var tsStream = plugins.gulp.src(plugins.path.join(paths.cwd, key))
|
var tsStream = plugins.gulp.src(plugins.path.join(paths.cwd, key))
|
||||||
.pipe(plugins.g.typescript({
|
.pipe(plugins.g.typescript({
|
||||||
out: outputName,
|
out: outputName,
|
||||||
declaration: true
|
declaration: true,
|
||||||
|
target: "ES5"
|
||||||
}));
|
}));
|
||||||
var stream = plugins.mergeStream([
|
var stream = plugins.mergeStream([
|
||||||
tsStream.dts.pipe(plugins.gulp.dest(outputDir)),
|
tsStream.dts.pipe(plugins.gulp.dest(outputDir)),
|
||||||
@ -182,7 +182,7 @@ var NpmtsCompile;
|
|||||||
moduleStream.on("queueDrain", function () {
|
moduleStream.on("queueDrain", function () {
|
||||||
plugins.beautylog.success("custom TypeScript installed successfully");
|
plugins.beautylog.success("custom TypeScript installed successfully");
|
||||||
moduleStream.on("finish", function () {
|
moduleStream.on("finish", function () {
|
||||||
done.resolve();
|
done.resolve(config);
|
||||||
});
|
});
|
||||||
moduleStream.end();
|
moduleStream.end();
|
||||||
});
|
});
|
||||||
@ -196,27 +196,36 @@ var NpmtsTests;
|
|||||||
NpmtsTests.run = function (configArg) {
|
NpmtsTests.run = function (configArg) {
|
||||||
var done = plugins.q.defer();
|
var done = plugins.q.defer();
|
||||||
var config = configArg;
|
var config = configArg;
|
||||||
plugins.gulp.task('istanbul', function () {
|
var istanbul = function () {
|
||||||
return plugins.gulp.src([plugins.path.join(paths.cwd, "index.js")])
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "index.js")])
|
||||||
.pipe(plugins.g.istanbul())
|
.pipe(plugins.g.istanbul())
|
||||||
.pipe(plugins.g.istanbul.hookRequire());
|
.pipe(plugins.g.istanbul.hookRequire());
|
||||||
});
|
return stream;
|
||||||
plugins.gulp.task('mocha', function () {
|
};
|
||||||
return plugins.gulp.src(['test/test.js'])
|
var mocha = function () {
|
||||||
|
var stream = plugins.gulp.src(["./test/test.js"])
|
||||||
.pipe(plugins.g.mocha())
|
.pipe(plugins.g.mocha())
|
||||||
.pipe(plugins.g.istanbul.writeReports())
|
.pipe(plugins.g.istanbul.writeReports())
|
||||||
.pipe(plugins.g.istanbul.enforceThresholds({ thresholds: { global: 90 } }));
|
.pipe(plugins.g.istanbul.enforceThresholds({ thresholds: { global: 30 } }));
|
||||||
});
|
return stream;
|
||||||
plugins.gulp.task("coveralls", function () {
|
};
|
||||||
return plugins.gulp.src('coverage/**/lcov.info')
|
var coveralls = function () {
|
||||||
.pipe(plugins.g.if((process.env.TRAVIS && config.coveralls), plugins.g.coveralls()));
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "./coverage/lcov.info")])
|
||||||
});
|
.pipe(plugins.g.coveralls());
|
||||||
plugins.gulp.task("test", function () {
|
return stream;
|
||||||
plugins.g.sequence("istanbul", "mocha", "coveralls", function () {
|
};
|
||||||
done.resolve();
|
istanbul().on("finish", function () {
|
||||||
|
mocha().on("finish", function () {
|
||||||
|
if (process.env.TRAVIS && config.coveralls) {
|
||||||
|
coveralls().on("finish", function () {
|
||||||
|
done.resolve(config);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
done.resolve(config);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
plugins.gulp.start.apply(plugins.gulp, ['test']);
|
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
})(NpmtsTests || (NpmtsTests = {}));
|
})(NpmtsTests || (NpmtsTests = {}));
|
||||||
@ -243,5 +252,6 @@ var NpmtsPromisechain;
|
|||||||
/// <reference path="./npmts.promisechain.ts" />
|
/// <reference path="./npmts.promisechain.ts" />
|
||||||
console.log("**** starting NPMTS ****");
|
console.log("**** starting NPMTS ****");
|
||||||
var plugins = NpmtsPlugins.init();
|
var plugins = NpmtsPlugins.init();
|
||||||
|
plugins.beautylog.figletSync("NPMTS");
|
||||||
var paths = NpmtsPaths.init();
|
var paths = NpmtsPaths.init();
|
||||||
var promisechain = NpmtsPromisechain.init();
|
var promisechain = NpmtsPromisechain.init();
|
||||||
|
12
package.json
12
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "npmts",
|
"name": "npmts",
|
||||||
"version": "2.1.6",
|
"version": "2.3.0",
|
||||||
"description": "write npm modules with TypeScript",
|
"description": "write npm modules with TypeScript",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"typings": "./index.d.ts",
|
"typings": "./index.d.ts",
|
||||||
@ -26,21 +26,19 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/pushrocks/npmts#readme",
|
"homepage": "https://github.com/pushrocks/npmts#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"beautylog": "2.0.7",
|
"beautylog": "2.1.1",
|
||||||
"fs-extra": "^0.26.5",
|
"fs-extra": "^0.26.5",
|
||||||
"gulp": "3.9.0",
|
"gulp": "3.9.1",
|
||||||
"gulp-coveralls": "^0.1.4",
|
"gulp-coveralls": "^0.1.4",
|
||||||
"gulp-if": "^2.0.0",
|
|
||||||
"gulp-insert": "0.5.0",
|
"gulp-insert": "0.5.0",
|
||||||
"gulp-istanbul": "^0.10.3",
|
"gulp-istanbul": "^0.10.3",
|
||||||
"gulp-mocha": "^2.2.0",
|
"gulp-mocha": "^2.2.0",
|
||||||
"gulp-sequence": "^0.4.4",
|
"gulp-typescript": "2.11.0",
|
||||||
"gulp-typescript": "2.10.0",
|
|
||||||
"gulp-typings": "0.0.0",
|
"gulp-typings": "0.0.0",
|
||||||
"merge2": "1.0.1",
|
"merge2": "1.0.1",
|
||||||
"q": "^1.4.1",
|
"q": "^1.4.1",
|
||||||
"smartcli": "0.0.11",
|
"smartcli": "0.0.11",
|
||||||
"smartfile": "0.0.11",
|
"smartfile": "0.0.11",
|
||||||
"typings": "^0.6.6"
|
"typings": "^0.6.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
</div><!-- /wrapper -->
|
</div><!-- /wrapper -->
|
||||||
<div class='footer quiet pad2 space-top1 center small'>
|
<div class='footer quiet pad2 space-top1 center small'>
|
||||||
Code coverage
|
Code coverage
|
||||||
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 09 2016 05:46:38 GMT+0100 (CET)
|
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 16 2016 10:28:50 GMT+0100 (CET)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="../prettify.js"></script>
|
<script src="../prettify.js"></script>
|
||||||
|
@ -76,7 +76,7 @@ module.exports = testplugin;
|
|||||||
</div><!-- /wrapper -->
|
</div><!-- /wrapper -->
|
||||||
<div class='footer quiet pad2 space-top1 center small'>
|
<div class='footer quiet pad2 space-top1 center small'>
|
||||||
Code coverage
|
Code coverage
|
||||||
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 09 2016 05:46:38 GMT+0100 (CET)
|
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 16 2016 10:28:50 GMT+0100 (CET)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="../prettify.js"></script>
|
<script src="../prettify.js"></script>
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
</div><!-- /wrapper -->
|
</div><!-- /wrapper -->
|
||||||
<div class='footer quiet pad2 space-top1 center small'>
|
<div class='footer quiet pad2 space-top1 center small'>
|
||||||
Code coverage
|
Code coverage
|
||||||
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 09 2016 05:46:38 GMT+0100 (CET)
|
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 16 2016 10:28:50 GMT+0100 (CET)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="prettify.js"></script>
|
<script src="prettify.js"></script>
|
||||||
|
@ -9,5 +9,5 @@
|
|||||||
"./subts2/",
|
"./subts2/",
|
||||||
"./customdir"
|
"./customdir"
|
||||||
],
|
],
|
||||||
"coveralls":"false"
|
"coveralls":true
|
||||||
}
|
}
|
2
test/assets/test/test.d.ts
vendored
Normal file
2
test/assets/test/test.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/// <reference path="ts/typings/main.d.ts" />
|
||||||
|
declare var testplugin: any;
|
@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
console.log("**** starting test ****");
|
console.log("**** starting test ****");
|
||||||
var testplugin = require("../index.js");
|
var testplugin = require("../index.js");
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
/// <reference path="./npmts.compile.ts" />
|
/// <reference path="./npmts.compile.ts" />
|
||||||
/// <reference path="./npmts.tests.ts" />
|
/// <reference path="./npmts.tests.ts" />
|
||||||
/// <reference path="./npmts.promisechain.ts" />
|
/// <reference path="./npmts.promisechain.ts" />
|
||||||
console.log("**** starting NPMTS ****")
|
console.log("**** starting NPMTS ****");
|
||||||
var plugins = NpmtsPlugins.init();
|
var plugins = NpmtsPlugins.init();
|
||||||
|
plugins.beautylog.figletSync("NPMTS");
|
||||||
var paths = NpmtsPaths.init();
|
var paths = NpmtsPaths.init();
|
||||||
var promisechain = NpmtsPromisechain.init();
|
var promisechain = NpmtsPromisechain.init();
|
||||||
|
@ -70,7 +70,8 @@ module NpmtsCompile {
|
|||||||
var tsStream = plugins.gulp.src(plugins.path.join(paths.cwd,key))
|
var tsStream = plugins.gulp.src(plugins.path.join(paths.cwd,key))
|
||||||
.pipe(plugins.g.typescript({
|
.pipe(plugins.g.typescript({
|
||||||
out: outputName,
|
out: outputName,
|
||||||
declaration: true
|
declaration: true,
|
||||||
|
target: "ES5"
|
||||||
}));
|
}));
|
||||||
var stream = plugins.mergeStream([
|
var stream = plugins.mergeStream([
|
||||||
tsStream.dts.pipe(plugins.gulp.dest(outputDir)),
|
tsStream.dts.pipe(plugins.gulp.dest(outputDir)),
|
||||||
@ -83,7 +84,7 @@ module NpmtsCompile {
|
|||||||
moduleStream.on("queueDrain",function(){
|
moduleStream.on("queueDrain",function(){
|
||||||
plugins.beautylog.success("custom TypeScript installed successfully");
|
plugins.beautylog.success("custom TypeScript installed successfully");
|
||||||
moduleStream.on("finish",function(){
|
moduleStream.on("finish",function(){
|
||||||
done.resolve();
|
done.resolve(config);
|
||||||
});
|
});
|
||||||
moduleStream.end();
|
moduleStream.end();
|
||||||
});
|
});
|
||||||
|
@ -4,14 +4,15 @@ module NpmtsOptions {
|
|||||||
var done = plugins.q.defer();
|
var done = plugins.q.defer();
|
||||||
var config = configArg;
|
var config = configArg;
|
||||||
if (typeof config.coveralls === "undefined"){
|
if (typeof config.coveralls === "undefined"){
|
||||||
config.coveralls = true;
|
config.coveralls = false;
|
||||||
}
|
}
|
||||||
if (config.mode == "default"){
|
if (config.mode == "default"){
|
||||||
config.typings = [
|
config.typings = [
|
||||||
"./ts/"
|
"./ts/"
|
||||||
];
|
];
|
||||||
config.ts = {
|
config.ts = {
|
||||||
["./ts/index.ts"]: "./index.js"
|
["./ts/index.ts"]: "./index.js",
|
||||||
|
["./ts/test.ts"]: "./test/test.js"
|
||||||
};
|
};
|
||||||
config.test = ["./index.js"];
|
config.test = ["./index.js"];
|
||||||
done.resolve(config);
|
done.resolve(config);
|
||||||
|
@ -7,11 +7,9 @@ module NpmtsPlugins {
|
|||||||
gulp: require("gulp"),
|
gulp: require("gulp"),
|
||||||
g: {
|
g: {
|
||||||
coveralls: require("gulp-coveralls"),
|
coveralls: require("gulp-coveralls"),
|
||||||
if: require("gulp-if"),
|
|
||||||
insert: require("gulp-insert"),
|
insert: require("gulp-insert"),
|
||||||
istanbul: require("gulp-istanbul"),
|
istanbul: require("gulp-istanbul"),
|
||||||
mocha: require("gulp-mocha"),
|
mocha: require("gulp-mocha"),
|
||||||
sequence: require("gulp-sequence"),
|
|
||||||
typescript: require("gulp-typescript")
|
typescript: require("gulp-typescript")
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -3,37 +3,42 @@ module NpmtsTests {
|
|||||||
export var run = function(configArg) {
|
export var run = function(configArg) {
|
||||||
var done = plugins.q.defer();
|
var done = plugins.q.defer();
|
||||||
var config = configArg;
|
var config = configArg;
|
||||||
plugins.gulp.task('istanbul', function () {
|
var istanbul = function () {
|
||||||
return plugins.gulp.src([plugins.path.join(paths.cwd,"index.js")])
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"index.js")])
|
||||||
// Covering files
|
// Covering files
|
||||||
.pipe(plugins.g.istanbul())
|
.pipe(plugins.g.istanbul())
|
||||||
// Force `require` to return covered files
|
// Force `require` to return covered files
|
||||||
.pipe(plugins.g.istanbul.hookRequire());
|
.pipe(plugins.g.istanbul.hookRequire());
|
||||||
});
|
return stream;
|
||||||
|
};
|
||||||
|
|
||||||
plugins.gulp.task('mocha', function () {
|
var mocha = function () {
|
||||||
return plugins.gulp.src(['test/test.js'])
|
var stream = plugins.gulp.src(["./test/test.js"])
|
||||||
.pipe(plugins.g.mocha())
|
.pipe(plugins.g.mocha())
|
||||||
// Creating the reports after tests ran
|
// Creating the reports after tests ran
|
||||||
.pipe(plugins.g.istanbul.writeReports())
|
.pipe(plugins.g.istanbul.writeReports())
|
||||||
// Enforce a coverage of at least 90%
|
// Enforce a coverage of at least 90%
|
||||||
.pipe(plugins.g.istanbul.enforceThresholds({ thresholds: { global: 90 } }));
|
.pipe(plugins.g.istanbul.enforceThresholds({ thresholds: { global: 30 } }));
|
||||||
});
|
return stream;
|
||||||
|
};
|
||||||
|
|
||||||
plugins.gulp.task("coveralls",function(){
|
var coveralls = function(){
|
||||||
return plugins.gulp.src('coverage/**/lcov.info')
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"./coverage/lcov.info")])
|
||||||
.pipe(plugins.g.if(
|
.pipe(plugins.g.coveralls());
|
||||||
(process.env.TRAVIS && config.coveralls),
|
return stream;
|
||||||
plugins.g.coveralls()
|
};
|
||||||
));
|
|
||||||
});
|
|
||||||
|
|
||||||
plugins.gulp.task("test",function(){
|
istanbul().on("finish",function(){
|
||||||
plugins.g.sequence("istanbul","mocha","coveralls",function(){
|
mocha().on("finish",function(){
|
||||||
done.resolve();
|
if(process.env.TRAVIS && config.coveralls){
|
||||||
|
coveralls().on("finish",function(){
|
||||||
|
done.resolve(config);
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
done.resolve(config);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
plugins.gulp.start.apply(plugins.gulp, ['test']);
|
|
||||||
return done.promise;
|
return done.promise;
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user