mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-29 22:38:33 +08:00
Add definitions for Karma public API (https://github.com/karma-runner/karma)
This commit is contained in:
26
karma/karma-tests.ts
Normal file
26
karma/karma-tests.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/// <reference path="karma.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require('gulp');
|
||||
import karma = require('karma');
|
||||
|
||||
function runKarma(singleRun: boolean): void {
|
||||
karma.server.start({
|
||||
configFile: __dirname + '/karma.conf.js',
|
||||
singleRun: singleRun
|
||||
});
|
||||
}
|
||||
|
||||
gulp.task('test:unit:karma', ['build:test:unit'], () => runKarma(true));
|
||||
|
||||
|
||||
karma.server.start({port: 9876}, (exitCode) => {
|
||||
console.log('Karma has exited with ' + exitCode);
|
||||
process.exit(exitCode);
|
||||
});
|
||||
|
||||
|
||||
karma.runner.run({port: 9876}, (exitCode) => {
|
||||
console.log('Karma has exited with ' + exitCode);
|
||||
process.exit(exitCode);
|
||||
});
|
||||
24
karma/karma.d.ts
vendored
Normal file
24
karma/karma.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// Type definitions for karma v0.12.37
|
||||
// Project: https://github.com/karma-runner/karma
|
||||
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'karma' {
|
||||
// See Karma public API https://karma-runner.github.io/0.12/dev/public-api.html
|
||||
|
||||
interface IKarmaServer {
|
||||
start(options?: any, callback?: (exitCode: number) => void): void;
|
||||
}
|
||||
|
||||
interface IKarmaRunner {
|
||||
run(options?: any, callback?: (exitCode: number) => void): void;
|
||||
}
|
||||
|
||||
interface IKarma {
|
||||
server: IKarmaServer;
|
||||
runner: IKarmaRunner;
|
||||
}
|
||||
|
||||
var karma: IKarma;
|
||||
export = karma;
|
||||
}
|
||||
Reference in New Issue
Block a user