1 | // Type definitions for karma-coverage-istanbul-reporter 2.1
|
2 | // Project: https://github.com/mattlewis92/karma-coverage-istanbul-reporter#readme
|
3 | // Definitions by: Dmitry Demensky <https://github.com/demensky>
|
4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
5 | // TypeScript Version: 3.2
|
6 |
|
7 | export interface Threshold {
|
8 | /** @default 0 */
|
9 | readonly statements?: number | undefined;
|
10 |
|
11 | /** @default 0 */
|
12 | readonly lines?: number | undefined;
|
13 |
|
14 | /** @default 0 */
|
15 | readonly branches?: number | undefined;
|
16 |
|
17 | /** @default 0 */
|
18 | readonly functions?: number | undefined;
|
19 | }
|
20 |
|
21 | export interface ThresholdsEach extends Threshold {
|
22 | /** @default {} */
|
23 | readonly overrides?: { [key: string]: Threshold } | undefined;
|
24 | }
|
25 |
|
26 | export interface ThresholdConfig {
|
27 | /**
|
28 | * Set to `true` to not fail the test command when thresholds are not met.
|
29 | * @default false
|
30 | */
|
31 | readonly emitWarning?: boolean | undefined;
|
32 |
|
33 | /** Thresholds for all files. */
|
34 | readonly global?: Threshold | undefined;
|
35 |
|
36 | /** Thresholds per file. */
|
37 | readonly each?: ThresholdsEach | undefined;
|
38 | }
|
39 |
|
40 | /** @see {@link https://github.com/mattlewis92/karma-coverage-istanbul-reporter#configuration} */
|
41 | export interface CoverageIstanbulReporter {
|
42 | /** Reports can be any that are listed {@link https://github.com/istanbuljs/istanbuljs/tree/aae256fb8b9a3d19414dcf069c592e88712c32c6/packages/istanbul-reports/lib here}. */
|
43 | readonly reports?: string[] | undefined;
|
44 |
|
45 | /**
|
46 | * Base output directory.
|
47 | * If you include `%browser%` in the path it will be replaced with the karma browser name.
|
48 | */
|
49 | readonly dir?: string | undefined;
|
50 |
|
51 | /** Combines coverage information from multiple browsers into one report rather than outputting a report for each browser */
|
52 | readonly combineBrowserReports?: boolean | undefined;
|
53 |
|
54 | /** if using webpack and pre-loaders, work around webpack breaking the source path. */
|
55 | readonly fixWebpackSourcePaths?: boolean | undefined;
|
56 |
|
57 | /** Omit files with no statements, no functions and no branches from the report. */
|
58 | readonly skipFilesWithNoCoverage?: boolean | undefined;
|
59 |
|
60 | // TODO: Add istanbul-api
|
61 | /** Most reporters accept additional config options. You can pass these through the `report-config` option. */
|
62 | readonly 'report-config'?: any;
|
63 |
|
64 | /**
|
65 | * Enforce percentage thresholds.
|
66 | * Anything under these percentages will cause karma to fail with an exit code of 1 if not running in watch mode.
|
67 | */
|
68 | readonly thresholds?: ThresholdConfig | undefined;
|
69 |
|
70 | /** Output config used by istanbul for debugging. */
|
71 | readonly verbose?: boolean | undefined;
|
72 |
|
73 | // TODO: Add istanbul-api
|
74 | /** `instrumentation` is used to configure Istanbul API package. */
|
75 | readonly instrumentation?: any;
|
76 | }
|
77 |
|
78 | declare module 'karma' {
|
79 | interface ConfigOptions {
|
80 | /** {@link https://github.com/istanbuljs/istanbuljs/blob/aae256fb8b9a3d19414dcf069c592e88712c32c6/packages/istanbul-api/lib/config.js#L33-L39 Any of these options are valid}. */
|
81 | readonly coverageIstanbulReporter?: CoverageIstanbulReporter | undefined;
|
82 | }
|
83 | }
|