@serenity-js/console-reporter 3.0.0-rc.9 → 3.0.1
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 +75 -1171
- package/README.md +98 -27
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +11 -1
- package/lib/index.js.map +1 -1
- package/lib/stage/crew/console-reporter/ConsoleReporter.d.ts +84 -60
- package/lib/stage/crew/console-reporter/ConsoleReporter.d.ts.map +1 -0
- package/lib/stage/crew/console-reporter/ConsoleReporter.js +233 -171
- package/lib/stage/crew/console-reporter/ConsoleReporter.js.map +1 -1
- package/lib/stage/crew/console-reporter/ConsoleReporterConfig.d.ts +13 -0
- package/lib/stage/crew/console-reporter/ConsoleReporterConfig.d.ts.map +1 -0
- package/lib/stage/crew/console-reporter/ConsoleReporterConfig.js +3 -0
- package/lib/stage/crew/console-reporter/ConsoleReporterConfig.js.map +1 -0
- package/lib/stage/crew/console-reporter/Printer.d.ts +2 -4
- package/lib/stage/crew/console-reporter/Printer.d.ts.map +1 -0
- package/lib/stage/crew/console-reporter/Printer.js +0 -3
- package/lib/stage/crew/console-reporter/Printer.js.map +1 -1
- package/lib/stage/crew/console-reporter/Summary.d.ts +7 -1
- package/lib/stage/crew/console-reporter/Summary.d.ts.map +1 -0
- package/lib/stage/crew/console-reporter/Summary.js +14 -1
- package/lib/stage/crew/console-reporter/Summary.js.map +1 -1
- package/lib/stage/crew/console-reporter/SummaryFormatter.d.ts +1 -0
- package/lib/stage/crew/console-reporter/SummaryFormatter.d.ts.map +1 -0
- package/lib/stage/crew/console-reporter/SummaryFormatter.js +4 -1
- package/lib/stage/crew/console-reporter/SummaryFormatter.js.map +1 -1
- package/lib/stage/crew/console-reporter/index.d.ts +2 -0
- package/lib/stage/crew/console-reporter/index.d.ts.map +1 -0
- package/lib/stage/crew/console-reporter/index.js +6 -1
- package/lib/stage/crew/console-reporter/index.js.map +1 -1
- package/lib/stage/crew/console-reporter/themes/TerminalTheme.d.ts +1 -7
- package/lib/stage/crew/console-reporter/themes/TerminalTheme.d.ts.map +1 -0
- package/lib/stage/crew/console-reporter/themes/TerminalTheme.js +0 -6
- package/lib/stage/crew/console-reporter/themes/TerminalTheme.js.map +1 -1
- package/lib/stage/crew/console-reporter/themes/ThemeForColourTerminals.d.ts +7 -21
- package/lib/stage/crew/console-reporter/themes/ThemeForColourTerminals.d.ts.map +1 -0
- package/lib/stage/crew/console-reporter/themes/ThemeForColourTerminals.js +9 -30
- package/lib/stage/crew/console-reporter/themes/ThemeForColourTerminals.js.map +1 -1
- package/lib/stage/crew/console-reporter/themes/ThemeForDarkTerminals.d.ts +1 -0
- package/lib/stage/crew/console-reporter/themes/ThemeForDarkTerminals.d.ts.map +1 -0
- package/lib/stage/crew/console-reporter/themes/ThemeForLightTerminals.d.ts +1 -0
- package/lib/stage/crew/console-reporter/themes/ThemeForLightTerminals.d.ts.map +1 -0
- package/lib/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.d.ts +7 -20
- package/lib/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.d.ts.map +1 -0
- package/lib/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.js +6 -29
- package/lib/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.js.map +1 -1
- package/lib/stage/crew/console-reporter/themes/index.d.ts +1 -0
- package/lib/stage/crew/console-reporter/themes/index.d.ts.map +1 -0
- package/lib/stage/crew/console-reporter/themes/index.js +5 -1
- package/lib/stage/crew/console-reporter/themes/index.js.map +1 -1
- package/lib/stage/crew/index.d.ts +1 -0
- package/lib/stage/crew/index.d.ts.map +1 -0
- package/lib/stage/crew/index.js +5 -1
- package/lib/stage/crew/index.js.map +1 -1
- package/lib/stage/index.d.ts +1 -0
- package/lib/stage/index.d.ts.map +1 -0
- package/lib/stage/index.js +5 -1
- package/lib/stage/index.js.map +1 -1
- package/package.json +19 -42
- package/src/index.ts +9 -0
- package/src/stage/crew/console-reporter/ConsoleReporter.ts +237 -173
- package/src/stage/crew/console-reporter/ConsoleReporterConfig.ts +12 -0
- package/src/stage/crew/console-reporter/Printer.ts +1 -4
- package/src/stage/crew/console-reporter/Summary.ts +23 -4
- package/src/stage/crew/console-reporter/SummaryFormatter.ts +5 -10
- package/src/stage/crew/console-reporter/index.ts +1 -0
- package/src/stage/crew/console-reporter/themes/TerminalTheme.ts +0 -8
- package/src/stage/crew/console-reporter/themes/ThemeForColourTerminals.ts +11 -42
- 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 +6 -30
- package/tsconfig.build.json +10 -0
- package/tsconfig.eslint.json +0 -10
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ExecutionCompromised,
|
|
3
|
-
ExecutionFailedWithAssertionError,
|
|
4
|
-
ExecutionFailedWithError,
|
|
5
|
-
ExecutionIgnored,
|
|
6
|
-
ExecutionSkipped,
|
|
7
|
-
ExecutionSuccessful,
|
|
8
|
-
ImplementationPending,
|
|
9
|
-
} from '@serenity-js/core/lib/model';
|
|
1
|
+
import { ExecutionCompromised, ExecutionFailedWithAssertionError, ExecutionFailedWithError, ExecutionIgnored, ExecutionSkipped, ImplementationPending } from '@serenity-js/core/lib/model';
|
|
10
2
|
|
|
11
3
|
import { AggregatedCategories, AggregatedCategory } from './Summary';
|
|
12
4
|
import { TerminalTheme } from './themes';
|
|
@@ -36,6 +28,7 @@ export class SummaryFormatter {
|
|
|
36
28
|
}),
|
|
37
29
|
``,
|
|
38
30
|
`Total time: ${ this.theme.heading(aggregatedCategories.totalTime) }`,
|
|
31
|
+
`Real time: ${ this.theme.heading(aggregatedCategories.realTime) }`,
|
|
39
32
|
`Scenarios: ${ this.theme.heading(aggregatedCategories.numberOfScenarios) }`,
|
|
40
33
|
'',
|
|
41
34
|
].join('\n');
|
|
@@ -68,7 +61,9 @@ export class SummaryFormatter {
|
|
|
68
61
|
case ImplementationPending.name: return 'pending';
|
|
69
62
|
case ExecutionSkipped.name: return 'skipped';
|
|
70
63
|
case ExecutionIgnored.name: return 'ignored';
|
|
71
|
-
case ExecutionSuccessful.name:
|
|
64
|
+
// case ExecutionSuccessful.name:
|
|
65
|
+
default:
|
|
66
|
+
return 'successful';
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
69
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AssertionReportDiffer } from '@serenity-js/core/lib/io';
|
|
2
1
|
import { Outcome } from '@serenity-js/core/lib/model';
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -10,16 +9,9 @@ import { Outcome } from '@serenity-js/core/lib/model';
|
|
|
10
9
|
* @abstract
|
|
11
10
|
*/
|
|
12
11
|
export abstract class TerminalTheme {
|
|
13
|
-
/**
|
|
14
|
-
* @param {@serenity-js/core/lib/io~AssertionReportDiffer} differ
|
|
15
|
-
*/
|
|
16
|
-
constructor(protected readonly differ: AssertionReportDiffer) {
|
|
17
|
-
}
|
|
18
|
-
|
|
19
12
|
abstract heading(...parts: any[]): string;
|
|
20
13
|
abstract outcome(outcome: Outcome | string, ...parts: any[]): string;
|
|
21
14
|
abstract separator(pattern: string): string;
|
|
22
|
-
abstract diff(expected: string, actual: string): string;
|
|
23
15
|
abstract log(...parts: any[]): string;
|
|
24
16
|
|
|
25
17
|
/**
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
ExecutionCompromised,
|
|
6
|
-
ExecutionFailedWithAssertionError,
|
|
7
|
-
ExecutionFailedWithError,
|
|
8
|
-
ExecutionIgnored,
|
|
9
|
-
ExecutionSkipped,
|
|
10
|
-
ExecutionSuccessful,
|
|
11
|
-
ImplementationPending,
|
|
12
|
-
Outcome,
|
|
13
|
-
} from '@serenity-js/core/lib/model';
|
|
14
|
-
import { Chalk } from 'chalk'; // eslint-disable-line unicorn/import-style
|
|
3
|
+
import { ExecutionCompromised, ExecutionFailedWithAssertionError, ExecutionFailedWithError, ExecutionIgnored, ExecutionSkipped, ImplementationPending, Outcome } from '@serenity-js/core/lib/model';
|
|
4
|
+
import { Chalk } from 'chalk'; // eslint-disable-line unicorn/import-style
|
|
15
5
|
|
|
16
6
|
import { TerminalTheme } from './TerminalTheme';
|
|
17
7
|
|
|
18
8
|
/**
|
|
19
9
|
* @desc
|
|
20
|
-
* Base class for {@
|
|
10
|
+
* Base class for {@apilink TerminalTheme} implementations intended
|
|
21
11
|
* to print to terminals that support colour output.
|
|
22
12
|
*
|
|
23
13
|
* @extends {TerminalTheme}
|
|
@@ -33,26 +23,19 @@ export abstract class ThemeForColourTerminals extends TerminalTheme {
|
|
|
33
23
|
* @see https://www.npmjs.com/package/chalk
|
|
34
24
|
*/
|
|
35
25
|
constructor(protected readonly chalk: Chalk) {
|
|
36
|
-
super(
|
|
37
|
-
expected: line => this.chalk.green(`+ ${ line }`),
|
|
38
|
-
actual: line => this.chalk.red(`- ${ line }`),
|
|
39
|
-
matching: line => ` ${ line }`,
|
|
40
|
-
}));
|
|
26
|
+
super();
|
|
41
27
|
}
|
|
42
28
|
|
|
43
29
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* using a colour appropriate for a given {@link @serenity-js/core/lib/model~Outcome}.
|
|
30
|
+
* Joins the `parts` into a single string and decorates it
|
|
31
|
+
* using a colour appropriate for a given {@apilink Outcome}.
|
|
47
32
|
*
|
|
48
|
-
* @param
|
|
49
|
-
* an instance of an {@
|
|
33
|
+
* @param outcome
|
|
34
|
+
* an instance of an {@apilink @serenity-js/core/lib/model~Outcome}
|
|
50
35
|
* or a string class name of one of its implementations.
|
|
51
36
|
*
|
|
52
|
-
* @param
|
|
37
|
+
* @param parts
|
|
53
38
|
* the parts of the message to be decorated
|
|
54
|
-
*
|
|
55
|
-
* @returns {string}
|
|
56
39
|
*/
|
|
57
40
|
outcome(outcome: Outcome | string, ...parts: any[]): string {
|
|
58
41
|
const outcomeName = (outcome instanceof Outcome)
|
|
@@ -70,23 +53,9 @@ export abstract class ThemeForColourTerminals extends TerminalTheme {
|
|
|
70
53
|
case ExecutionSkipped.name:
|
|
71
54
|
case ExecutionIgnored.name:
|
|
72
55
|
return this.chalk.blackBright(this.joined(parts));
|
|
73
|
-
case ExecutionSuccessful.name:
|
|
56
|
+
// case ExecutionSuccessful.name:
|
|
57
|
+
default:
|
|
74
58
|
return this.chalk.green(this.joined(parts));
|
|
75
59
|
}
|
|
76
60
|
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* @desc
|
|
80
|
-
* Turns the serialised `expectedValue` and `actualValue` into
|
|
81
|
-
* a visual diff, so that it's easier for the developer to spot
|
|
82
|
-
* the difference between the two values.
|
|
83
|
-
*
|
|
84
|
-
* @param {string} expectedValue
|
|
85
|
-
* @param {string} actualValue
|
|
86
|
-
*
|
|
87
|
-
* @returns {string}
|
|
88
|
-
*/
|
|
89
|
-
diff(expectedValue: string, actualValue: string): string {
|
|
90
|
-
return this.differ.diff(expectedValue, actualValue);
|
|
91
|
-
}
|
|
92
61
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AssertionReportDiffer } from '@serenity-js/core/lib/io';
|
|
2
1
|
import { Outcome } from '@serenity-js/core/lib/model';
|
|
3
2
|
|
|
4
3
|
import { TerminalTheme } from './TerminalTheme';
|
|
@@ -12,13 +11,6 @@ import { TerminalTheme } from './TerminalTheme';
|
|
|
12
11
|
* @public
|
|
13
12
|
*/
|
|
14
13
|
export class ThemeForMonochromaticTerminals extends TerminalTheme {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(new AssertionReportDiffer({
|
|
17
|
-
expected: line => `+ ${ line }`,
|
|
18
|
-
actual: line => `- ${ line }`,
|
|
19
|
-
matching: line => ` ${ line }`,
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
14
|
|
|
23
15
|
/**
|
|
24
16
|
* @desc
|
|
@@ -34,16 +26,15 @@ export class ThemeForMonochromaticTerminals extends TerminalTheme {
|
|
|
34
26
|
}
|
|
35
27
|
|
|
36
28
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* no decoration of the text is performed.
|
|
29
|
+
* Joins the `parts` into a single string.
|
|
30
|
+
* Since this class represents a theme for monochromatic terminals,
|
|
31
|
+
* no decoration of the text is performed.
|
|
41
32
|
*
|
|
42
|
-
* @param
|
|
43
|
-
* an instance of an {@
|
|
33
|
+
* @param outcome
|
|
34
|
+
* an instance of an {@apilink Outcome}
|
|
44
35
|
* or a string class name of one of its implementations.
|
|
45
36
|
*
|
|
46
|
-
* @param
|
|
37
|
+
* @param parts
|
|
47
38
|
* the parts of the message
|
|
48
39
|
*
|
|
49
40
|
* @returns {string}
|
|
@@ -65,21 +56,6 @@ export class ThemeForMonochromaticTerminals extends TerminalTheme {
|
|
|
65
56
|
return this.repeat(pattern);
|
|
66
57
|
}
|
|
67
58
|
|
|
68
|
-
/**
|
|
69
|
-
* @desc
|
|
70
|
-
* Turns the serialised `expectedValue` and `actualValue` into
|
|
71
|
-
* a visual diff, so that it's easier for the developer to spot
|
|
72
|
-
* the difference between the two values.
|
|
73
|
-
*
|
|
74
|
-
* @param {string} expectedValue
|
|
75
|
-
* @param {string} actualValue
|
|
76
|
-
*
|
|
77
|
-
* @returns {string}
|
|
78
|
-
*/
|
|
79
|
-
diff(expectedValue: string, actualValue: string): string {
|
|
80
|
-
return this.differ.diff(expectedValue, actualValue);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
59
|
/**
|
|
84
60
|
* @desc
|
|
85
61
|
* Decorates the log entries that the developer wanted to have captured in the output.
|