mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Simplified definition for Istanbul (https://github.com/gotwarlost/istanbul)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/// <reference path="istanbul.d.ts" />
|
||||
|
||||
import * as istanbul from 'istanbul';
|
||||
|
||||
// Instrument code
|
||||
var instrumenter = new istanbul.Instrumenter();
|
||||
|
||||
var generatedCode = instrumenter.instrumentSync('function meaningOfLife() { return 42; }',
|
||||
'filename.js');
|
||||
|
||||
|
||||
// Generate reports given a bunch of coverage JSON objects
|
||||
var collector = new istanbul.Collector(),
|
||||
reporter = new istanbul.Reporter(),
|
||||
sync = false;
|
||||
|
||||
var obj1 = {},
|
||||
obj2 = {};
|
||||
|
||||
collector.add(obj1);
|
||||
collector.add(obj2); //etc.
|
||||
|
||||
reporter.add('text');
|
||||
reporter.addAll([ 'lcov', 'clover' ]);
|
||||
reporter.write(collector, sync, function () {
|
||||
console.log('All reports generated');
|
||||
});
|
||||
Vendored
+73
@@ -0,0 +1,73 @@
|
||||
// Type definitions for Istanbul v0.4.0
|
||||
// Project: https://github.com/gotwarlost/istanbul
|
||||
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'istanbul' {
|
||||
namespace istanbul {
|
||||
interface Istanbul {
|
||||
new (options?: any): Istanbul;
|
||||
Collector: Collector;
|
||||
config: Config;
|
||||
ContentWriter: ContentWriter;
|
||||
FileWriter: FileWriter;
|
||||
hook: Hook;
|
||||
Instrumenter: Instrumenter;
|
||||
Report: Report;
|
||||
Reporter: Reporter;
|
||||
Store: Store;
|
||||
utils: ObjectUtils;
|
||||
VERSION: string;
|
||||
Writer: Writer;
|
||||
}
|
||||
|
||||
interface Collector {
|
||||
new (options?: any): Collector;
|
||||
add(coverage: any, testName?: string): void;
|
||||
}
|
||||
|
||||
interface Config {
|
||||
}
|
||||
|
||||
interface ContentWriter {
|
||||
}
|
||||
|
||||
interface FileWriter {
|
||||
}
|
||||
|
||||
interface Hook {
|
||||
}
|
||||
|
||||
interface Instrumenter {
|
||||
new (options?: any): Instrumenter;
|
||||
instrumentSync(code: string, filename: string): string;
|
||||
}
|
||||
|
||||
interface Report {
|
||||
}
|
||||
|
||||
interface Configuration {
|
||||
new (obj: any, overrides: any): Configuration;
|
||||
}
|
||||
|
||||
interface Reporter {
|
||||
new (cfg?: Configuration, dir?: string): Reporter;
|
||||
add(fmt: string): void;
|
||||
addAll(fmts: Array<string>): void;
|
||||
write(collector: Collector, sync: boolean, callback: Function): void;
|
||||
}
|
||||
|
||||
interface Store {
|
||||
}
|
||||
|
||||
interface ObjectUtils {
|
||||
}
|
||||
|
||||
interface Writer {
|
||||
}
|
||||
}
|
||||
|
||||
var istanbul: istanbul.Istanbul;
|
||||
|
||||
export = istanbul;
|
||||
}
|
||||
Reference in New Issue
Block a user