mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-26 11:12:19 +08:00
Merge pull request #4463 from sgkim126/gulp-istanbul
gulp-istanbul 0.9.0 adds enforceThresholds function.
This commit is contained in:
+51
@@ -0,0 +1,51 @@
|
||||
// Type definitions for gulp-istanbul v0.8.1
|
||||
// Project: https://github.com/SBoudrias/gulp-istanbul
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gulp-istanbul" {
|
||||
function GulpIstanbul(opts?: GulpIstanbul.Options): NodeJS.ReadWriteStream;
|
||||
|
||||
module GulpIstanbul {
|
||||
export function hookRequire(): NodeJS.ReadWriteStream;
|
||||
export function summarizeCoverage(opts?: {coverageVariable?: string}): Coverage;
|
||||
export function writeReports(opts?: ReportOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
interface Options {
|
||||
coverageVariable?: string;
|
||||
includeUntested?: boolean;
|
||||
embedSource?: boolean;
|
||||
preserveComments?: boolean;
|
||||
noCompact?: boolean;
|
||||
noAutoWrap?: boolean;
|
||||
codeGenerationOptions?: Object;
|
||||
debug?: boolean;
|
||||
walkDebug?: boolean;
|
||||
}
|
||||
|
||||
interface Coverage {
|
||||
lines: CoverageStats;
|
||||
statements: CoverageStats;
|
||||
functions: CoverageStats;
|
||||
branches: CoverageStats;
|
||||
}
|
||||
|
||||
interface CoverageStats {
|
||||
total: number;
|
||||
covered: number;
|
||||
skipped: number;
|
||||
pct: number;
|
||||
}
|
||||
|
||||
interface ReportOptions {
|
||||
dir?: string;
|
||||
reporters?: string[];
|
||||
reportOpts?: {dir?: string};
|
||||
coverageVariable?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = GulpIstanbul;
|
||||
}
|
||||
@@ -29,4 +29,17 @@ gulp.task('test', function (cb) {
|
||||
.pipe(istanbul.writeReports({reporters: ['text']})) // Creating the reports after tests runned
|
||||
.on('end', cb);
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('test', function (cb) {
|
||||
gulp.src(['lib/**/*.js', 'main.js'])
|
||||
.pipe(istanbul({includeUntested: true})) // Covering files
|
||||
.pipe(istanbul.hookRequire())
|
||||
.on('finish', function () {
|
||||
gulp.src(['test/*.html'])
|
||||
.pipe(testFramework())
|
||||
.pipe(istanbul.writeReports({reporters: ['text']})) // Creating the reports after tests runned
|
||||
.pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) //
|
||||
.on('end', cb);
|
||||
});
|
||||
});
|
||||
Vendored
+15
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for gulp-istanbul
|
||||
// Type definitions for gulp-istanbul v0.9.0
|
||||
// Project: https://github.com/SBoudrias/gulp-istanbul
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -12,6 +12,7 @@ declare module "gulp-istanbul" {
|
||||
export function hookRequire(): NodeJS.ReadWriteStream;
|
||||
export function summarizeCoverage(opts?: {coverageVariable?: string}): Coverage;
|
||||
export function writeReports(opts?: ReportOptions): NodeJS.ReadWriteStream;
|
||||
export function enforceThresholds(opts?: ThresholdOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
interface Options {
|
||||
coverageVariable?: string;
|
||||
@@ -45,7 +46,19 @@ declare module "gulp-istanbul" {
|
||||
reportOpts?: {dir?: string};
|
||||
coverageVariable?: string;
|
||||
}
|
||||
|
||||
interface ThresholdOptions {
|
||||
coverageVariable?: string;
|
||||
thresholds?: { global?: Coverage|number; each?: Coverage|number };
|
||||
}
|
||||
|
||||
interface CoverageOptions {
|
||||
lines?: number;
|
||||
statements?: number;
|
||||
functions?: number;
|
||||
branches?: number;
|
||||
}
|
||||
}
|
||||
|
||||
export = GulpIstanbul;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user