@serenity-js/console-reporter 3.41.2 → 3.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/esm/index.d.ts +6 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +6 -0
- package/esm/index.js.map +1 -0
- package/esm/stage/crew/console-reporter/ConsoleReporter.d.ts +187 -0
- package/esm/stage/crew/console-reporter/ConsoleReporter.d.ts.map +1 -0
- package/esm/stage/crew/console-reporter/ConsoleReporter.js +423 -0
- package/esm/stage/crew/console-reporter/ConsoleReporter.js.map +1 -0
- package/esm/stage/crew/console-reporter/ConsoleReporterConfig.d.ts +13 -0
- package/esm/stage/crew/console-reporter/ConsoleReporterConfig.d.ts.map +1 -0
- package/esm/stage/crew/console-reporter/ConsoleReporterConfig.js +2 -0
- package/esm/stage/crew/console-reporter/ConsoleReporterConfig.js.map +1 -0
- package/esm/stage/crew/console-reporter/Printer.d.ts +32 -0
- package/esm/stage/crew/console-reporter/Printer.d.ts.map +1 -0
- package/esm/stage/crew/console-reporter/Printer.js +67 -0
- package/esm/stage/crew/console-reporter/Printer.js.map +1 -0
- package/esm/stage/crew/console-reporter/Summary.d.ts +39 -0
- package/esm/stage/crew/console-reporter/Summary.d.ts.map +1 -0
- package/esm/stage/crew/console-reporter/Summary.js +49 -0
- package/esm/stage/crew/console-reporter/Summary.js.map +1 -0
- package/esm/stage/crew/console-reporter/SummaryFormatter.d.ts +14 -0
- package/esm/stage/crew/console-reporter/SummaryFormatter.d.ts.map +1 -0
- package/esm/stage/crew/console-reporter/SummaryFormatter.js +57 -0
- package/esm/stage/crew/console-reporter/SummaryFormatter.js.map +1 -0
- package/esm/stage/crew/console-reporter/index.d.ts +3 -0
- package/esm/stage/crew/console-reporter/index.d.ts.map +1 -0
- package/esm/stage/crew/console-reporter/index.js +3 -0
- package/esm/stage/crew/console-reporter/index.js.map +1 -0
- package/esm/stage/crew/console-reporter/themes/TerminalTheme.d.ts +21 -0
- package/esm/stage/crew/console-reporter/themes/TerminalTheme.d.ts.map +1 -0
- package/esm/stage/crew/console-reporter/themes/TerminalTheme.js +24 -0
- package/esm/stage/crew/console-reporter/themes/TerminalTheme.js.map +1 -0
- package/esm/stage/crew/console-reporter/themes/ThemeForColourTerminals.d.ts +29 -0
- package/esm/stage/crew/console-reporter/themes/ThemeForColourTerminals.d.ts.map +1 -0
- package/esm/stage/crew/console-reporter/themes/ThemeForColourTerminals.js +50 -0
- package/esm/stage/crew/console-reporter/themes/ThemeForColourTerminals.js.map +1 -0
- package/esm/stage/crew/console-reporter/themes/ThemeForDarkTerminals.d.ts +32 -0
- package/esm/stage/crew/console-reporter/themes/ThemeForDarkTerminals.d.ts.map +1 -0
- package/esm/stage/crew/console-reporter/themes/ThemeForDarkTerminals.js +39 -0
- package/esm/stage/crew/console-reporter/themes/ThemeForDarkTerminals.js.map +1 -0
- package/esm/stage/crew/console-reporter/themes/ThemeForLightTerminals.d.ts +32 -0
- package/esm/stage/crew/console-reporter/themes/ThemeForLightTerminals.d.ts.map +1 -0
- package/esm/stage/crew/console-reporter/themes/ThemeForLightTerminals.js +39 -0
- package/esm/stage/crew/console-reporter/themes/ThemeForLightTerminals.js.map +1 -0
- package/esm/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.d.ts +41 -0
- package/esm/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.d.ts.map +1 -0
- package/esm/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.js +48 -0
- package/esm/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.js.map +1 -0
- package/esm/stage/crew/console-reporter/themes/index.d.ts +5 -0
- package/esm/stage/crew/console-reporter/themes/index.d.ts.map +1 -0
- package/esm/stage/crew/console-reporter/themes/index.js +5 -0
- package/esm/stage/crew/console-reporter/themes/index.js.map +1 -0
- package/esm/stage/crew/index.d.ts +2 -0
- package/esm/stage/crew/index.d.ts.map +1 -0
- package/esm/stage/crew/index.js +2 -0
- package/esm/stage/crew/index.js.map +1 -0
- package/esm/stage/index.d.ts +2 -0
- package/esm/stage/index.d.ts.map +1 -0
- package/esm/stage/index.js +2 -0
- package/esm/stage/index.js.map +1 -0
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -0
- package/lib/stage/crew/console-reporter/ConsoleReporter.d.ts +4 -4
- package/lib/stage/crew/console-reporter/ConsoleReporter.d.ts.map +1 -1
- package/lib/stage/crew/console-reporter/ConsoleReporter.js +36 -29
- package/lib/stage/crew/console-reporter/ConsoleReporter.js.map +1 -1
- package/lib/stage/crew/console-reporter/Printer.d.ts +1 -1
- package/lib/stage/crew/console-reporter/Printer.d.ts.map +1 -1
- package/lib/stage/crew/console-reporter/Summary.d.ts +1 -1
- package/lib/stage/crew/console-reporter/Summary.d.ts.map +1 -1
- package/lib/stage/crew/console-reporter/Summary.js +1 -1
- package/lib/stage/crew/console-reporter/Summary.js.map +1 -1
- package/lib/stage/crew/console-reporter/SummaryFormatter.d.ts +2 -2
- package/lib/stage/crew/console-reporter/SummaryFormatter.d.ts.map +1 -1
- package/lib/stage/crew/console-reporter/SummaryFormatter.js +1 -1
- package/lib/stage/crew/console-reporter/SummaryFormatter.js.map +1 -1
- package/lib/stage/crew/console-reporter/index.d.ts +2 -2
- package/lib/stage/crew/console-reporter/index.d.ts.map +1 -1
- package/lib/stage/crew/console-reporter/index.js +2 -2
- package/lib/stage/crew/console-reporter/index.js.map +1 -1
- package/lib/stage/crew/console-reporter/themes/TerminalTheme.d.ts +1 -1
- package/lib/stage/crew/console-reporter/themes/TerminalTheme.d.ts.map +1 -1
- package/lib/stage/crew/console-reporter/themes/ThemeForColourTerminals.d.ts +2 -2
- package/lib/stage/crew/console-reporter/themes/ThemeForColourTerminals.d.ts.map +1 -1
- package/lib/stage/crew/console-reporter/themes/ThemeForColourTerminals.js +3 -3
- package/lib/stage/crew/console-reporter/themes/ThemeForColourTerminals.js.map +1 -1
- package/lib/stage/crew/console-reporter/themes/ThemeForDarkTerminals.d.ts +1 -1
- package/lib/stage/crew/console-reporter/themes/ThemeForDarkTerminals.d.ts.map +1 -1
- package/lib/stage/crew/console-reporter/themes/ThemeForDarkTerminals.js +2 -2
- package/lib/stage/crew/console-reporter/themes/ThemeForDarkTerminals.js.map +1 -1
- package/lib/stage/crew/console-reporter/themes/ThemeForLightTerminals.d.ts +1 -1
- package/lib/stage/crew/console-reporter/themes/ThemeForLightTerminals.d.ts.map +1 -1
- package/lib/stage/crew/console-reporter/themes/ThemeForLightTerminals.js +2 -2
- package/lib/stage/crew/console-reporter/themes/ThemeForLightTerminals.js.map +1 -1
- package/lib/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.d.ts +2 -2
- package/lib/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.d.ts.map +1 -1
- package/lib/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.js +2 -2
- package/lib/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.js.map +1 -1
- package/lib/stage/crew/console-reporter/themes/index.d.ts +4 -4
- package/lib/stage/crew/console-reporter/themes/index.d.ts.map +1 -1
- package/lib/stage/crew/console-reporter/themes/index.js +4 -4
- package/lib/stage/crew/console-reporter/themes/index.js.map +1 -1
- package/lib/stage/crew/index.d.ts +1 -1
- package/lib/stage/crew/index.d.ts.map +1 -1
- package/lib/stage/crew/index.js +1 -1
- package/lib/stage/crew/index.js.map +1 -1
- package/lib/stage/index.d.ts +1 -1
- package/lib/stage/index.d.ts.map +1 -1
- package/lib/stage/index.js +1 -1
- package/lib/stage/index.js.map +1 -1
- package/package.json +29 -8
- package/src/index.ts +3 -3
- package/src/stage/crew/console-reporter/ConsoleReporter.ts +32 -27
- package/src/stage/crew/console-reporter/Printer.ts +1 -1
- package/src/stage/crew/console-reporter/Summary.ts +2 -2
- package/src/stage/crew/console-reporter/SummaryFormatter.ts +3 -3
- package/src/stage/crew/console-reporter/index.ts +2 -2
- package/src/stage/crew/console-reporter/themes/TerminalTheme.ts +1 -1
- package/src/stage/crew/console-reporter/themes/ThemeForColourTerminals.ts +2 -2
- package/src/stage/crew/console-reporter/themes/ThemeForDarkTerminals.ts +1 -1
- package/src/stage/crew/console-reporter/themes/ThemeForLightTerminals.ts +1 -1
- package/src/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.ts +2 -2
- package/src/stage/crew/console-reporter/themes/index.ts +4 -4
- package/src/stage/crew/index.ts +1 -1
- package/src/stage/index.ts +1 -1
- package/tsconfig-cjs.build.json +18 -0
- package/tsconfig-esm.build.json +18 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Used to configure the [`ConsoleReporter`](https://serenity-js.org/api/console-reporter/class/ConsoleReporter/).
|
|
3
|
+
*
|
|
4
|
+
* @group Stage
|
|
5
|
+
*/
|
|
6
|
+
export interface ConsoleReporterConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Choose a colour theme optimised for light, dark, or monochromatic terminals.
|
|
9
|
+
* Or, use 'auto' to automatically pick the most suitable one.
|
|
10
|
+
*/
|
|
11
|
+
theme: 'light' | 'dark' | 'mono' | 'auto';
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ConsoleReporterConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConsoleReporterConfig.d.ts","sourceRoot":"","sources":["../../../../src/stage/crew/console-reporter/ConsoleReporterConfig.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IAClC;;;OAGG;IACH,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAC5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConsoleReporterConfig.js","sourceRoot":"","sources":["../../../../src/stage/crew/console-reporter/ConsoleReporterConfig.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { OutputStream } from '@serenity-js/core/adapter';
|
|
2
|
+
/**
|
|
3
|
+
* A simple abstraction around the standard output stream
|
|
4
|
+
* with support for indenting the printed text.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Printer {
|
|
7
|
+
private readonly stdout;
|
|
8
|
+
private indentation;
|
|
9
|
+
constructor(stdout?: OutputStream);
|
|
10
|
+
/**
|
|
11
|
+
* Prints the `args` to the `stdout`, followed by a new line character (`\n`).
|
|
12
|
+
*
|
|
13
|
+
* Please note that this method bypasses any indentation as it's intended
|
|
14
|
+
* to be used to print separator lines, etc.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
println(...args: any[]): void;
|
|
18
|
+
/**
|
|
19
|
+
* Prints the `args` to the `stdout`, indenting the output according to
|
|
20
|
+
* the current indentation level.
|
|
21
|
+
*/
|
|
22
|
+
print(...args: any[]): void;
|
|
23
|
+
/**
|
|
24
|
+
* Increases the current indentation by 2 spaces.
|
|
25
|
+
*/
|
|
26
|
+
indent(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Reduces the current indentation by 2 spaces.
|
|
29
|
+
*/
|
|
30
|
+
outdent(): void;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=Printer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Printer.d.ts","sourceRoot":"","sources":["../../../../src/stage/crew/console-reporter/Printer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;GAGG;AACH,qBAAa,OAAO;IAGJ,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,WAAW,CAAsB;gBAEZ,MAAM,GAAE,YAA6B;IAGlE;;;;;;OAMG;IACH,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAI7B;;;OAGG;IACH,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAM3B;;OAEG;IACH,MAAM,IAAI,IAAI;IAId;;OAEG;IACH,OAAO,IAAI,IAAI;CAGlB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple abstraction around the standard output stream
|
|
3
|
+
* with support for indenting the printed text.
|
|
4
|
+
*/
|
|
5
|
+
export class Printer {
|
|
6
|
+
stdout;
|
|
7
|
+
indentation = new Indentation(2);
|
|
8
|
+
constructor(stdout = process.stdout) {
|
|
9
|
+
this.stdout = stdout;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Prints the `args` to the `stdout`, followed by a new line character (`\n`).
|
|
13
|
+
*
|
|
14
|
+
* Please note that this method bypasses any indentation as it's intended
|
|
15
|
+
* to be used to print separator lines, etc.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
println(...args) {
|
|
19
|
+
return this.print(...args, '\n');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Prints the `args` to the `stdout`, indenting the output according to
|
|
23
|
+
* the current indentation level.
|
|
24
|
+
*/
|
|
25
|
+
print(...args) {
|
|
26
|
+
this.stdout.write(this.indentation.indented(`${args.map(String).join('')}`));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Increases the current indentation by 2 spaces.
|
|
30
|
+
*/
|
|
31
|
+
indent() {
|
|
32
|
+
this.indentation.increase();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Reduces the current indentation by 2 spaces.
|
|
36
|
+
*/
|
|
37
|
+
outdent() {
|
|
38
|
+
this.indentation.decrease();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @package
|
|
43
|
+
*/
|
|
44
|
+
class Indentation {
|
|
45
|
+
step;
|
|
46
|
+
current = 0;
|
|
47
|
+
constructor(step) {
|
|
48
|
+
this.step = step;
|
|
49
|
+
}
|
|
50
|
+
increase() {
|
|
51
|
+
this.current += this.step;
|
|
52
|
+
}
|
|
53
|
+
decrease() {
|
|
54
|
+
if (this.current - this.step >= 0) {
|
|
55
|
+
this.current -= this.step;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
indented(...fragments) {
|
|
59
|
+
return fragments.join('')
|
|
60
|
+
.split('\n')
|
|
61
|
+
.map(line => line
|
|
62
|
+
? ' '.repeat(this.current) + line
|
|
63
|
+
: '')
|
|
64
|
+
.join('\n');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=Printer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Printer.js","sourceRoot":"","sources":["../../../../src/stage/crew/console-reporter/Printer.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,OAAO;IAGa;IAFrB,WAAW,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;IAEzC,YAA6B,SAAuB,OAAO,CAAC,MAAM;QAArC,WAAM,GAAN,MAAM,CAA+B;IAClE,CAAC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,GAAG,IAAW;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,GAAG,IAAW;QAChB,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAE,EAAE,CAAC,CAC9D,CAAC;IACN,CAAC;IAED;;OAEG;IACH,MAAM;QACF,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,OAAO;QACH,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;IAChC,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,WAAW;IAGgB;IAFrB,OAAO,GAAG,CAAC,CAAC;IAEpB,YAA6B,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IACzC,CAAC;IAED,QAAQ;QACJ,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED,QAAQ;QACJ,IAAI,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC;QAC9B,CAAC;IACL,CAAC;IAED,QAAQ,CAAC,GAAG,SAAmB;QAC3B,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;aACpB,KAAK,CAAC,IAAI,CAAC;aACX,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI;YACb,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI;YACjC,CAAC,CAAC,EAAE,CACP;aACA,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;CACJ"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Duration, Timestamp } from '@serenity-js/core';
|
|
2
|
+
import type { Outcome, ScenarioDetails } from '@serenity-js/core/model';
|
|
3
|
+
/**
|
|
4
|
+
* @package
|
|
5
|
+
*/
|
|
6
|
+
export declare class Summary {
|
|
7
|
+
private readonly records;
|
|
8
|
+
private testRunStartedAt;
|
|
9
|
+
private testRunFinishedAt;
|
|
10
|
+
record(details: ScenarioDetails, outcome: Outcome, duration: Duration): void;
|
|
11
|
+
aggregated(): AggregatedCategories;
|
|
12
|
+
recordTestRunStartedAt(timestamp: Timestamp): void;
|
|
13
|
+
recordTestRunFinishedAt(timestamp: Timestamp): void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @package
|
|
17
|
+
*/
|
|
18
|
+
export interface AggregatedCategories {
|
|
19
|
+
categories: {
|
|
20
|
+
[categoryName: string]: AggregatedCategory;
|
|
21
|
+
};
|
|
22
|
+
totalTime: Duration;
|
|
23
|
+
realTime: Duration;
|
|
24
|
+
numberOfScenarios: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @package
|
|
28
|
+
*/
|
|
29
|
+
export interface AggregatedCategory {
|
|
30
|
+
name: string;
|
|
31
|
+
outcomes: {
|
|
32
|
+
[outcomeType: string]: {
|
|
33
|
+
count: number;
|
|
34
|
+
code: number;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
totalTime: Duration;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=Summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Summary.d.ts","sourceRoot":"","sources":["../../../../src/stage/crew/console-reporter/Summary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EACR,OAAO,EACP,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAWpD;;GAEG;AACH,qBAAa,OAAO;IAChB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuB;IAE/C,OAAO,CAAC,gBAAgB,CAA8B;IACtD,OAAO,CAAC,iBAAiB,CAA8B;IAEvD,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAI5E,UAAU,IAAI,oBAAoB;IAmClC,sBAAsB,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAIlD,uBAAuB,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;CAGtD;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,UAAU,EAAE;QAAC,CAAC,YAAY,EAAE,MAAM,GAAG,kBAAkB,CAAA;KAAC,CAAC;IACzD,SAAS,EAAE,QAAQ,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE;QAAC,CAAC,WAAW,EAAE,MAAM,GAAG;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAC,CAAC;IACnE,SAAS,EAAE,QAAQ,CAAC;CACvB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Duration, Timestamp } from '@serenity-js/core';
|
|
2
|
+
import { ExecutionCompromised, ExecutionFailedWithAssertionError, ExecutionFailedWithError, ExecutionIgnored, ExecutionSkipped, ExecutionSuccessful, ImplementationPending } from '@serenity-js/core/model';
|
|
3
|
+
/**
|
|
4
|
+
* @package
|
|
5
|
+
*/
|
|
6
|
+
export class Summary {
|
|
7
|
+
records = [];
|
|
8
|
+
testRunStartedAt = new Timestamp();
|
|
9
|
+
testRunFinishedAt = new Timestamp();
|
|
10
|
+
record(details, outcome, duration) {
|
|
11
|
+
this.records.push({ details, outcome, duration });
|
|
12
|
+
}
|
|
13
|
+
aggregated() {
|
|
14
|
+
return this.records.reduce((acc, record) => {
|
|
15
|
+
acc.totalTime = acc.totalTime.plus(record.duration);
|
|
16
|
+
const categoryName = record.details.category.value;
|
|
17
|
+
if (!acc.categories[categoryName]) {
|
|
18
|
+
acc.categories[categoryName] = {
|
|
19
|
+
name: categoryName,
|
|
20
|
+
outcomes: {
|
|
21
|
+
[ExecutionCompromised.name]: { count: 0, code: ExecutionCompromised.Code },
|
|
22
|
+
[ExecutionFailedWithError.name]: { count: 0, code: ExecutionFailedWithError.Code },
|
|
23
|
+
[ExecutionFailedWithAssertionError.name]: { count: 0, code: ExecutionFailedWithAssertionError.Code },
|
|
24
|
+
[ImplementationPending.name]: { count: 0, code: ImplementationPending.Code },
|
|
25
|
+
[ExecutionSkipped.name]: { count: 0, code: ExecutionSkipped.Code },
|
|
26
|
+
[ExecutionIgnored.name]: { count: 0, code: ExecutionIgnored.Code },
|
|
27
|
+
[ExecutionSuccessful.name]: { count: 0, code: ExecutionSuccessful.Code },
|
|
28
|
+
},
|
|
29
|
+
totalTime: Duration.ofMilliseconds(0),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
acc.categories[categoryName].outcomes[record.outcome.constructor.name].count++;
|
|
33
|
+
acc.categories[categoryName].totalTime = acc.categories[categoryName].totalTime.plus(record.duration);
|
|
34
|
+
return acc;
|
|
35
|
+
}, {
|
|
36
|
+
categories: {},
|
|
37
|
+
totalTime: Duration.ofMilliseconds(0),
|
|
38
|
+
realTime: this.testRunFinishedAt.diff(this.testRunStartedAt),
|
|
39
|
+
numberOfScenarios: this.records.length
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
recordTestRunStartedAt(timestamp) {
|
|
43
|
+
this.testRunStartedAt = timestamp;
|
|
44
|
+
}
|
|
45
|
+
recordTestRunFinishedAt(timestamp) {
|
|
46
|
+
this.testRunFinishedAt = timestamp;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=Summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Summary.js","sourceRoot":"","sources":["../../../../src/stage/crew/console-reporter/Summary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAIxD,OAAO,EACH,oBAAoB,EACpB,iCAAiC,EACjC,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACxB,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,MAAM,OAAO,OAAO;IACC,OAAO,GAAoB,EAAE,CAAC;IAEvC,gBAAgB,GAAc,IAAI,SAAS,EAAE,CAAC;IAC9C,iBAAiB,GAAc,IAAI,SAAS,EAAE,CAAC;IAEvD,MAAM,CAAC,OAAwB,EAAE,OAAgB,EAAE,QAAkB;QACjE,IAAI,CAAC,OAAO,CAAC,IAA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AI,CAAC,EAAkB,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,mBAAmB,CAAC,IAAI,EAAmB;qBAC5G;oBACD,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC;iBACxC,CAAC;YACN,CAAC;YAED,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,EAAG,CAAC;YAEhF,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAEtG,OAAO,GAAG,CAAC;QACf,CAAC,EAAE;YACC,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC;YACrC,QAAQ,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC;YAC5D,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;SACzC,CAAC,CAAC;IACP,CAAC;IAED,sBAAsB,CAAC,SAAoB;QACvC,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;IACtC,CAAC;IAED,uBAAuB,CAAC,SAAoB;QACxC,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;IACvC,CAAC;CACJ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AggregatedCategories } from './Summary.js';
|
|
2
|
+
import type { TerminalTheme } from './themes/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* @package
|
|
5
|
+
*/
|
|
6
|
+
export declare class SummaryFormatter {
|
|
7
|
+
private readonly theme;
|
|
8
|
+
constructor(theme: TerminalTheme);
|
|
9
|
+
format(aggregatedCategories: AggregatedCategories): string;
|
|
10
|
+
private sorted;
|
|
11
|
+
private formatTotalsFor;
|
|
12
|
+
private nameOf;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=SummaryFormatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SummaryFormatter.d.ts","sourceRoot":"","sources":["../../../../src/stage/crew/console-reporter/SummaryFormatter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAsB,MAAM,cAAc,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;GAEG;AACH,qBAAa,gBAAgB;IACb,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,aAAa;IAGjD,MAAM,CAAC,oBAAoB,EAAE,oBAAoB,GAAG,MAAM;IAwB1D,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,MAAM;CAajB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ExecutionCompromised, ExecutionFailedWithAssertionError, ExecutionFailedWithError, ExecutionIgnored, ExecutionSkipped, ImplementationPending } from '@serenity-js/core/model';
|
|
2
|
+
/**
|
|
3
|
+
* @package
|
|
4
|
+
*/
|
|
5
|
+
export class SummaryFormatter {
|
|
6
|
+
theme;
|
|
7
|
+
constructor(theme) {
|
|
8
|
+
this.theme = theme;
|
|
9
|
+
}
|
|
10
|
+
format(aggregatedCategories) {
|
|
11
|
+
const categoryNames = this.sorted(Object.keys(aggregatedCategories.categories)), maxCategoryNameLength = Math.max(...(categoryNames.map(categoryName => categoryName.length))), maxCategoryNameLengthAllowed = Math.min(Math.max(maxCategoryNameLength, 10), 30);
|
|
12
|
+
return [
|
|
13
|
+
this.theme.heading('Execution Summary'),
|
|
14
|
+
'',
|
|
15
|
+
...categoryNames.map(categoryName => {
|
|
16
|
+
const displayName = (categoryName.length > maxCategoryNameLengthAllowed
|
|
17
|
+
? categoryName.slice(0, maxCategoryNameLengthAllowed - 4) + `...:`
|
|
18
|
+
: `${categoryName}:`).padEnd(maxCategoryNameLengthAllowed + 1);
|
|
19
|
+
return `${this.theme.heading(displayName)} ${this.formatTotalsFor(aggregatedCategories.categories[categoryName])}`;
|
|
20
|
+
}),
|
|
21
|
+
``,
|
|
22
|
+
`Total time: ${this.theme.heading(aggregatedCategories.totalTime)}`,
|
|
23
|
+
`Real time: ${this.theme.heading(aggregatedCategories.realTime)}`,
|
|
24
|
+
`Scenarios: ${this.theme.heading(aggregatedCategories.numberOfScenarios)}`,
|
|
25
|
+
'',
|
|
26
|
+
].join('\n');
|
|
27
|
+
}
|
|
28
|
+
sorted(strings) {
|
|
29
|
+
return strings.sort((a, b) => a.localeCompare(b, undefined, { sensitivity: 'base' }));
|
|
30
|
+
}
|
|
31
|
+
formatTotalsFor(category) {
|
|
32
|
+
const outcomes = Object.keys(category.outcomes)
|
|
33
|
+
.filter(outcomeName => category.outcomes[outcomeName].count > 0)
|
|
34
|
+
.sort((left, right) => category.outcomes[left].code > category.outcomes[right].code ? 1 : -1)
|
|
35
|
+
.reduce((acc, outcomeName) => {
|
|
36
|
+
acc.push(this.theme.outcome(outcomeName, `${category.outcomes[outcomeName].count} ${this.nameOf(outcomeName)}`));
|
|
37
|
+
return acc;
|
|
38
|
+
}, [])
|
|
39
|
+
.join(', ');
|
|
40
|
+
const total = Object.keys(category.outcomes).map(outcomeName => category.outcomes[outcomeName].count).reduce((acc, count) => acc + count, 0);
|
|
41
|
+
return `${outcomes}, ${total} total (${category.totalTime})`;
|
|
42
|
+
}
|
|
43
|
+
nameOf(outcomeName) {
|
|
44
|
+
switch (outcomeName) {
|
|
45
|
+
case ExecutionCompromised.name: return 'compromised';
|
|
46
|
+
case ExecutionFailedWithError.name: return 'broken';
|
|
47
|
+
case ExecutionFailedWithAssertionError.name: return 'failed';
|
|
48
|
+
case ImplementationPending.name: return 'pending';
|
|
49
|
+
case ExecutionSkipped.name: return 'skipped';
|
|
50
|
+
case ExecutionIgnored.name: return 'ignored';
|
|
51
|
+
// case ExecutionSuccessful.name:
|
|
52
|
+
default:
|
|
53
|
+
return 'successful';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=SummaryFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SummaryFormatter.js","sourceRoot":"","sources":["../../../../src/stage/crew/console-reporter/SummaryFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,iCAAiC,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAKvL;;GAEG;AACH,MAAM,OAAO,gBAAgB;IACI;IAA7B,YAA6B,KAAoB;QAApB,UAAK,GAAL,KAAK,CAAe;IACjD,CAAC;IAED,MAAM,CAAC,oBAA0C;QAC7C,MACI,aAAa,GAAqB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,EAC3F,qBAAqB,GAAa,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EACvG,4BAA4B,GAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAExF,OAAO;YACH,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,mBAAmB,CAAC;YACvC,EAAE;YACF,GAAG,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;gBAChC,MAAM,WAAW,GAAG,CAAC,YAAY,CAAC,MAAM,GAAG,4BAA4B;oBACnE,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,4BAA4B,GAAG,CAAC,CAAC,GAAG,MAAM;oBAClE,CAAC,CAAC,GAAI,YAAa,GAAG,CAAC,C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"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/stage/crew/console-reporter/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/stage/crew/console-reporter/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Outcome } from '@serenity-js/core/model';
|
|
2
|
+
/**
|
|
3
|
+
* Decorates text with control characters to make the terminal
|
|
4
|
+
* print output in colour.
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class TerminalTheme {
|
|
7
|
+
abstract heading(...parts: any[]): string;
|
|
8
|
+
abstract outcome(outcome: Outcome | string, ...parts: any[]): string;
|
|
9
|
+
abstract separator(pattern: string): string;
|
|
10
|
+
abstract log(...parts: any[]): string;
|
|
11
|
+
/**
|
|
12
|
+
* Converts the `parts` to `string` and joins them together.
|
|
13
|
+
*/
|
|
14
|
+
protected joined(parts: any[]): string;
|
|
15
|
+
/**
|
|
16
|
+
* Repeats a given `pattern` so that it takes up to `maxLength` characters.
|
|
17
|
+
* Used to produce separator lines.
|
|
18
|
+
*/
|
|
19
|
+
protected repeat(pattern: string, maxLength?: number): string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=TerminalTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalTheme.d.ts","sourceRoot":"","sources":["../../../../../src/stage/crew/console-reporter/themes/TerminalTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEvD;;;GAGG;AACH,8BAAsB,aAAa;IAC/B,QAAQ,CAAC,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM;IACzC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM;IACpE,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAC3C,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM;IAErC;;OAEG;IACH,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM;IAItC;;;OAGG;IACH,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,SAAK,GAAG,MAAM;CAS5D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decorates text with control characters to make the terminal
|
|
3
|
+
* print output in colour.
|
|
4
|
+
*/
|
|
5
|
+
export class TerminalTheme {
|
|
6
|
+
/**
|
|
7
|
+
* Converts the `parts` to `string` and joins them together.
|
|
8
|
+
*/
|
|
9
|
+
joined(parts) {
|
|
10
|
+
return parts.map(String).join('');
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Repeats a given `pattern` so that it takes up to `maxLength` characters.
|
|
14
|
+
* Used to produce separator lines.
|
|
15
|
+
*/
|
|
16
|
+
repeat(pattern, maxLength = 80) {
|
|
17
|
+
if (!pattern) {
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
const repetitions = Math.floor(maxLength / pattern.length);
|
|
21
|
+
return pattern.repeat(repetitions);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=TerminalTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalTheme.js","sourceRoot":"","sources":["../../../../../src/stage/crew/console-reporter/themes/TerminalTheme.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAgB,aAAa;IAM/B;;OAEG;IACO,MAAM,CAAC,KAAY;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACtC,CAAC;IAED;;;OAGG;IACO,MAAM,CAAC,OAAe,EAAE,SAAS,GAAG,EAAE;QAC5C,IAAI,CAAE,OAAO,EAAE,CAAC;YACZ,OAAO,EAAE,CAAC;QACd,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAE3D,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;CACJ"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Outcome } from '@serenity-js/core/model';
|
|
2
|
+
import type { Chalk } from 'chalk';
|
|
3
|
+
import { TerminalTheme } from './TerminalTheme.js';
|
|
4
|
+
/**
|
|
5
|
+
* Base class for `TerminalTheme` implementations intended
|
|
6
|
+
* to print to terminals that support colour output.
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class ThemeForColourTerminals extends TerminalTheme {
|
|
9
|
+
protected readonly chalk: Chalk;
|
|
10
|
+
/**
|
|
11
|
+
* @param {chalk~Chalk} chalk
|
|
12
|
+
*
|
|
13
|
+
* @see https://www.npmjs.com/package/chalk
|
|
14
|
+
*/
|
|
15
|
+
constructor(chalk: Chalk);
|
|
16
|
+
/**
|
|
17
|
+
* Joins the `parts` into a single string and decorates it
|
|
18
|
+
* using a colour appropriate for a given `Outcome`.
|
|
19
|
+
*
|
|
20
|
+
* @param outcome
|
|
21
|
+
* an instance of an `Outcome`
|
|
22
|
+
* or a string class name of one of its implementations.
|
|
23
|
+
*
|
|
24
|
+
* @param parts
|
|
25
|
+
* the parts of the message to be decorated
|
|
26
|
+
*/
|
|
27
|
+
outcome(outcome: Outcome | string, ...parts: any[]): string;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=ThemeForColourTerminals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeForColourTerminals.d.ts","sourceRoot":"","sources":["../../../../../src/stage/crew/console-reporter/themes/ThemeForColourTerminals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgJ,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAChM,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;GAGG;AACH,8BAAsB,uBAAwB,SAAQ,aAAa;IAOnD,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK;IAL3C;;;;OAIG;gBAC4B,KAAK,EAAE,KAAK;IAI3C;;;;;;;;;;OAUG;IACH,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM;CAqB9D"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ExecutionCompromised, ExecutionFailedWithAssertionError, ExecutionFailedWithError, ExecutionIgnored, ExecutionSkipped, ImplementationPending, Outcome } from '@serenity-js/core/model';
|
|
2
|
+
import { TerminalTheme } from './TerminalTheme.js';
|
|
3
|
+
/**
|
|
4
|
+
* Base class for `TerminalTheme` implementations intended
|
|
5
|
+
* to print to terminals that support colour output.
|
|
6
|
+
*/
|
|
7
|
+
export class ThemeForColourTerminals extends TerminalTheme {
|
|
8
|
+
chalk;
|
|
9
|
+
/**
|
|
10
|
+
* @param {chalk~Chalk} chalk
|
|
11
|
+
*
|
|
12
|
+
* @see https://www.npmjs.com/package/chalk
|
|
13
|
+
*/
|
|
14
|
+
constructor(chalk) {
|
|
15
|
+
super();
|
|
16
|
+
this.chalk = chalk;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Joins the `parts` into a single string and decorates it
|
|
20
|
+
* using a colour appropriate for a given `Outcome`.
|
|
21
|
+
*
|
|
22
|
+
* @param outcome
|
|
23
|
+
* an instance of an `Outcome`
|
|
24
|
+
* or a string class name of one of its implementations.
|
|
25
|
+
*
|
|
26
|
+
* @param parts
|
|
27
|
+
* the parts of the message to be decorated
|
|
28
|
+
*/
|
|
29
|
+
outcome(outcome, ...parts) {
|
|
30
|
+
const outcomeName = (outcome instanceof Outcome)
|
|
31
|
+
? outcome.constructor.name
|
|
32
|
+
: outcome;
|
|
33
|
+
switch (outcomeName) {
|
|
34
|
+
case ExecutionCompromised.name:
|
|
35
|
+
return this.chalk.magenta(this.joined(parts));
|
|
36
|
+
case ExecutionFailedWithError.name:
|
|
37
|
+
case ExecutionFailedWithAssertionError.name:
|
|
38
|
+
return this.chalk.red(this.joined(parts));
|
|
39
|
+
case ImplementationPending.name:
|
|
40
|
+
return this.chalk.blue(this.joined(parts));
|
|
41
|
+
case ExecutionSkipped.name:
|
|
42
|
+
case ExecutionIgnored.name:
|
|
43
|
+
return this.chalk.blackBright(this.joined(parts));
|
|
44
|
+
// case ExecutionSuccessful.name:
|
|
45
|
+
default:
|
|
46
|
+
return this.chalk.green(this.joined(parts));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=ThemeForColourTerminals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeForColourTerminals.js","sourceRoot":"","sources":["../../../../../src/stage/crew/console-reporter/themes/ThemeForColourTerminals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,iCAAiC,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGhM,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAgB,uBAAwB,SAAQ,aAAa;IAOhC;IAL/B;;;;OAIG;IACH,YAA+B,KAAY;QACvC,KAAK,EAAE,CAAC;QADmB,UAAK,GAAL,KAAK,CAAO;IAE3C,CAAC;IAED;;;;;;;;;;OAUG;IACH,OAAO,CAAC,OAAyB,EAAE,GAAG,KAAY;QAC9C,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,OAAO,CAAC;YAC5C,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI;YAC1B,CAAC,CAAC,OAAO,CAAC;QAEd,QAAQ,WAAW,EAAE,CAAC;YAClB,KAAK,oBAAoB,CAAC,IAAI;gBAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAClD,KAAK,wBAAwB,CAAC,IAAI,CAAC;YACnC,KAAK,iCAAiC,CAAC,IAAI;gBACvC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAC9C,KAAK,qBAAqB,CAAC,IAAI;gBAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAC/C,KAAK,gBAAgB,CAAC,IAAI,CAAC;YAC3B,KAAK,gBAAgB,CAAC,IAAI;gBACtB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACtD,iCAAiC;YACjC;gBACI,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACpD,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Chalk } from 'chalk';
|
|
2
|
+
import { ThemeForColourTerminals } from './ThemeForColourTerminals.js';
|
|
3
|
+
/**
|
|
4
|
+
* A simple colour theme for terminals with dark backgrounds.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ThemeForDarkTerminals extends ThemeForColourTerminals {
|
|
7
|
+
/**
|
|
8
|
+
* @param {chalk~Chalk} chalk
|
|
9
|
+
*
|
|
10
|
+
* @see https://www.npmjs.com/package/chalk
|
|
11
|
+
*/
|
|
12
|
+
constructor(chalk: Chalk);
|
|
13
|
+
/**
|
|
14
|
+
* Formats the heading
|
|
15
|
+
*
|
|
16
|
+
* @param parts
|
|
17
|
+
* `parts` to be converted to string, joined together, and formatted as a heading
|
|
18
|
+
*/
|
|
19
|
+
heading(...parts: any[]): string;
|
|
20
|
+
/**
|
|
21
|
+
* Decorates the heading with theme colours.
|
|
22
|
+
*
|
|
23
|
+
* @param pattern
|
|
24
|
+
* The pattern to be repeated to create a separator, for example `-`, `✂ - - `, etc.
|
|
25
|
+
*/
|
|
26
|
+
separator(pattern: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Decorates the log entries that the developer wanted to have captured in the output.
|
|
29
|
+
*/
|
|
30
|
+
log(...parts: any[]): string;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=ThemeForDarkTerminals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeForDarkTerminals.d.ts","sourceRoot":"","sources":["../../../../../src/stage/crew/console-reporter/themes/ThemeForDarkTerminals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,uBAAuB;IAE9D;;;;OAIG;gBACS,KAAK,EAAE,KAAK;IAIxB;;;;;OAKG;IACH,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM;IAIhC;;;;;OAKG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAIlC;;OAEG;IACH,GAAG,CAAC,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM;CAG/B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ThemeForColourTerminals } from './ThemeForColourTerminals.js';
|
|
2
|
+
/**
|
|
3
|
+
* A simple colour theme for terminals with dark backgrounds.
|
|
4
|
+
*/
|
|
5
|
+
export class ThemeForDarkTerminals extends ThemeForColourTerminals {
|
|
6
|
+
/**
|
|
7
|
+
* @param {chalk~Chalk} chalk
|
|
8
|
+
*
|
|
9
|
+
* @see https://www.npmjs.com/package/chalk
|
|
10
|
+
*/
|
|
11
|
+
constructor(chalk) {
|
|
12
|
+
super(chalk);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Formats the heading
|
|
16
|
+
*
|
|
17
|
+
* @param parts
|
|
18
|
+
* `parts` to be converted to string, joined together, and formatted as a heading
|
|
19
|
+
*/
|
|
20
|
+
heading(...parts) {
|
|
21
|
+
return this.chalk.bold.white(this.joined(parts));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Decorates the heading with theme colours.
|
|
25
|
+
*
|
|
26
|
+
* @param pattern
|
|
27
|
+
* The pattern to be repeated to create a separator, for example `-`, `✂ - - `, etc.
|
|
28
|
+
*/
|
|
29
|
+
separator(pattern) {
|
|
30
|
+
return this.chalk.yellow(this.repeat(pattern));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Decorates the log entries that the developer wanted to have captured in the output.
|
|
34
|
+
*/
|
|
35
|
+
log(...parts) {
|
|
36
|
+
return this.chalk.yellow(this.joined(parts));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=ThemeForDarkTerminals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeForDarkTerminals.js","sourceRoot":"","sources":["../../../../../src/stage/crew/console-reporter/themes/ThemeForDarkTerminals.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,uBAAuB;IAE9D;;;;OAIG;IACH,YAAY,KAAY;QACpB,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,GAAG,KAAY;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACrD,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAC,OAAe;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,GAAG,KAAY;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACjD,CAAC;CACJ"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Chalk } from 'chalk';
|
|
2
|
+
import { ThemeForColourTerminals } from './ThemeForColourTerminals.js';
|
|
3
|
+
/**
|
|
4
|
+
* A simple colour theme for terminals with light backgrounds.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ThemeForLightTerminals extends ThemeForColourTerminals {
|
|
7
|
+
/**
|
|
8
|
+
* @see https://www.npmjs.com/package/chalk
|
|
9
|
+
*/
|
|
10
|
+
constructor(chalk: Chalk);
|
|
11
|
+
/**
|
|
12
|
+
* Decorates the heading with theme colours.
|
|
13
|
+
*
|
|
14
|
+
* @param parts
|
|
15
|
+
* `parts` to be converted to string, joined together, and formatted as a heading
|
|
16
|
+
*/
|
|
17
|
+
heading(...parts: any[]): string;
|
|
18
|
+
/**
|
|
19
|
+
* Decorates the heading with theme colours.
|
|
20
|
+
*
|
|
21
|
+
* @param pattern
|
|
22
|
+
* The pattern to be repeated to create a separator, for example `-`, `✂ - - `, etc.
|
|
23
|
+
*/
|
|
24
|
+
separator(pattern: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Decorates the log entries that the developer wanted to have captured in the output.
|
|
27
|
+
*
|
|
28
|
+
* @param parts
|
|
29
|
+
*/
|
|
30
|
+
log(...parts: any[]): string;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=ThemeForLightTerminals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeForLightTerminals.d.ts","sourceRoot":"","sources":["../../../../../src/stage/crew/console-reporter/themes/ThemeForLightTerminals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,uBAAuB;IAE/D;;OAEG;gBACS,KAAK,EAAE,KAAK;IAIxB;;;;;OAKG;IACH,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM;IAIhC;;;;;OAKG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAIlC;;;;OAIG;IACH,GAAG,CAAC,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM;CAG/B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ThemeForColourTerminals } from './ThemeForColourTerminals.js';
|
|
2
|
+
/**
|
|
3
|
+
* A simple colour theme for terminals with light backgrounds.
|
|
4
|
+
*/
|
|
5
|
+
export class ThemeForLightTerminals extends ThemeForColourTerminals {
|
|
6
|
+
/**
|
|
7
|
+
* @see https://www.npmjs.com/package/chalk
|
|
8
|
+
*/
|
|
9
|
+
constructor(chalk) {
|
|
10
|
+
super(chalk);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Decorates the heading with theme colours.
|
|
14
|
+
*
|
|
15
|
+
* @param parts
|
|
16
|
+
* `parts` to be converted to string, joined together, and formatted as a heading
|
|
17
|
+
*/
|
|
18
|
+
heading(...parts) {
|
|
19
|
+
return this.chalk.bold.black(this.joined(parts));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Decorates the heading with theme colours.
|
|
23
|
+
*
|
|
24
|
+
* @param pattern
|
|
25
|
+
* The pattern to be repeated to create a separator, for example `-`, `✂ - - `, etc.
|
|
26
|
+
*/
|
|
27
|
+
separator(pattern) {
|
|
28
|
+
return this.repeat(pattern);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Decorates the log entries that the developer wanted to have captured in the output.
|
|
32
|
+
*
|
|
33
|
+
* @param parts
|
|
34
|
+
*/
|
|
35
|
+
log(...parts) {
|
|
36
|
+
return this.joined(parts);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=ThemeForLightTerminals.js.map
|