diff --git a/types/karma-spec-reporter/index.d.ts b/types/karma-spec-reporter/index.d.ts new file mode 100644 index 0000000000..a4b59ce3a4 --- /dev/null +++ b/types/karma-spec-reporter/index.d.ts @@ -0,0 +1,33 @@ +// Type definitions for karma-spec-reporter 0.0 +// Project: https://github.com/mlex/karma-spec-reporter#readme +// Definitions by: Piotr Błażejewicz (Peter Blazejewicz) +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.2 + +import 'karma'; + +declare module 'karma' { + interface ConfigOptions { + /** + * {@link https://github.com/mlex/karma-spec-reporter#configuration} + */ + specReporter?: SpecReporterOptions; + } + + interface SpecReporterOptions { + /** limit number of lines logged per test */ + maxLogLines?: number; + /** do not print error summary */ + suppressErrorSummary?: boolean; + /** do not print information about failed tests */ + suppressFailed?: boolean; + /** do not print information about passed tests */ + suppressPassed?: boolean; + /** do not print information about skipped tests */ + suppressSkipped?: boolean; + /** print the time elapsed for each spec */ + showSpecTiming?: boolean; + /** test would finish with error when a first fail occurs */ + failFast?: boolean; + } +} diff --git a/types/karma-spec-reporter/karma-spec-reporter-tests.ts b/types/karma-spec-reporter/karma-spec-reporter-tests.ts new file mode 100644 index 0000000000..24e61a67ff --- /dev/null +++ b/types/karma-spec-reporter/karma-spec-reporter-tests.ts @@ -0,0 +1,17 @@ +import karma = require('karma'); + +const test = (config: karma.Config) => { + config.set({ + reporters: ['spec'], + specReporter: { + maxLogLines: 5, + suppressErrorSummary: true, + suppressFailed: false, + suppressPassed: false, + suppressSkipped: true, + showSpecTiming: false, + failFast: true, + }, + plugins: ['karma-spec-reporter'], + }); +}; diff --git a/types/karma-spec-reporter/tsconfig.json b/types/karma-spec-reporter/tsconfig.json new file mode 100644 index 0000000000..49d441cc55 --- /dev/null +++ b/types/karma-spec-reporter/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "karma-spec-reporter-tests.ts" + ] +} diff --git a/types/karma-spec-reporter/tslint.json b/types/karma-spec-reporter/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/karma-spec-reporter/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }