@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.
Files changed (73) hide show
  1. package/CHANGELOG.md +75 -1171
  2. package/README.md +98 -27
  3. package/lib/index.d.ts +4 -0
  4. package/lib/index.d.ts.map +1 -0
  5. package/lib/index.js +11 -1
  6. package/lib/index.js.map +1 -1
  7. package/lib/stage/crew/console-reporter/ConsoleReporter.d.ts +84 -60
  8. package/lib/stage/crew/console-reporter/ConsoleReporter.d.ts.map +1 -0
  9. package/lib/stage/crew/console-reporter/ConsoleReporter.js +233 -171
  10. package/lib/stage/crew/console-reporter/ConsoleReporter.js.map +1 -1
  11. package/lib/stage/crew/console-reporter/ConsoleReporterConfig.d.ts +13 -0
  12. package/lib/stage/crew/console-reporter/ConsoleReporterConfig.d.ts.map +1 -0
  13. package/lib/stage/crew/console-reporter/ConsoleReporterConfig.js +3 -0
  14. package/lib/stage/crew/console-reporter/ConsoleReporterConfig.js.map +1 -0
  15. package/lib/stage/crew/console-reporter/Printer.d.ts +2 -4
  16. package/lib/stage/crew/console-reporter/Printer.d.ts.map +1 -0
  17. package/lib/stage/crew/console-reporter/Printer.js +0 -3
  18. package/lib/stage/crew/console-reporter/Printer.js.map +1 -1
  19. package/lib/stage/crew/console-reporter/Summary.d.ts +7 -1
  20. package/lib/stage/crew/console-reporter/Summary.d.ts.map +1 -0
  21. package/lib/stage/crew/console-reporter/Summary.js +14 -1
  22. package/lib/stage/crew/console-reporter/Summary.js.map +1 -1
  23. package/lib/stage/crew/console-reporter/SummaryFormatter.d.ts +1 -0
  24. package/lib/stage/crew/console-reporter/SummaryFormatter.d.ts.map +1 -0
  25. package/lib/stage/crew/console-reporter/SummaryFormatter.js +4 -1
  26. package/lib/stage/crew/console-reporter/SummaryFormatter.js.map +1 -1
  27. package/lib/stage/crew/console-reporter/index.d.ts +2 -0
  28. package/lib/stage/crew/console-reporter/index.d.ts.map +1 -0
  29. package/lib/stage/crew/console-reporter/index.js +6 -1
  30. package/lib/stage/crew/console-reporter/index.js.map +1 -1
  31. package/lib/stage/crew/console-reporter/themes/TerminalTheme.d.ts +1 -7
  32. package/lib/stage/crew/console-reporter/themes/TerminalTheme.d.ts.map +1 -0
  33. package/lib/stage/crew/console-reporter/themes/TerminalTheme.js +0 -6
  34. package/lib/stage/crew/console-reporter/themes/TerminalTheme.js.map +1 -1
  35. package/lib/stage/crew/console-reporter/themes/ThemeForColourTerminals.d.ts +7 -21
  36. package/lib/stage/crew/console-reporter/themes/ThemeForColourTerminals.d.ts.map +1 -0
  37. package/lib/stage/crew/console-reporter/themes/ThemeForColourTerminals.js +9 -30
  38. package/lib/stage/crew/console-reporter/themes/ThemeForColourTerminals.js.map +1 -1
  39. package/lib/stage/crew/console-reporter/themes/ThemeForDarkTerminals.d.ts +1 -0
  40. package/lib/stage/crew/console-reporter/themes/ThemeForDarkTerminals.d.ts.map +1 -0
  41. package/lib/stage/crew/console-reporter/themes/ThemeForLightTerminals.d.ts +1 -0
  42. package/lib/stage/crew/console-reporter/themes/ThemeForLightTerminals.d.ts.map +1 -0
  43. package/lib/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.d.ts +7 -20
  44. package/lib/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.d.ts.map +1 -0
  45. package/lib/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.js +6 -29
  46. package/lib/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.js.map +1 -1
  47. package/lib/stage/crew/console-reporter/themes/index.d.ts +1 -0
  48. package/lib/stage/crew/console-reporter/themes/index.d.ts.map +1 -0
  49. package/lib/stage/crew/console-reporter/themes/index.js +5 -1
  50. package/lib/stage/crew/console-reporter/themes/index.js.map +1 -1
  51. package/lib/stage/crew/index.d.ts +1 -0
  52. package/lib/stage/crew/index.d.ts.map +1 -0
  53. package/lib/stage/crew/index.js +5 -1
  54. package/lib/stage/crew/index.js.map +1 -1
  55. package/lib/stage/index.d.ts +1 -0
  56. package/lib/stage/index.d.ts.map +1 -0
  57. package/lib/stage/index.js +5 -1
  58. package/lib/stage/index.js.map +1 -1
  59. package/package.json +19 -42
  60. package/src/index.ts +9 -0
  61. package/src/stage/crew/console-reporter/ConsoleReporter.ts +237 -173
  62. package/src/stage/crew/console-reporter/ConsoleReporterConfig.ts +12 -0
  63. package/src/stage/crew/console-reporter/Printer.ts +1 -4
  64. package/src/stage/crew/console-reporter/Summary.ts +23 -4
  65. package/src/stage/crew/console-reporter/SummaryFormatter.ts +5 -10
  66. package/src/stage/crew/console-reporter/index.ts +1 -0
  67. package/src/stage/crew/console-reporter/themes/TerminalTheme.ts +0 -8
  68. package/src/stage/crew/console-reporter/themes/ThemeForColourTerminals.ts +11 -42
  69. package/src/stage/crew/console-reporter/themes/ThemeForDarkTerminals.ts +1 -1
  70. package/src/stage/crew/console-reporter/themes/ThemeForLightTerminals.ts +1 -1
  71. package/src/stage/crew/console-reporter/themes/ThemeForMonochromaticTerminals.ts +6 -30
  72. package/tsconfig.build.json +10 -0
  73. 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: return 'successful';
64
+ // case ExecutionSuccessful.name:
65
+ default:
66
+ return 'successful';
72
67
  }
73
68
  }
74
69
  }
@@ -1 +1,2 @@
1
1
  export * from './ConsoleReporter';
2
+ export * from './ConsoleReporterConfig';
@@ -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 { AssertionReportDiffer } from '@serenity-js/core/lib/io';
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 {@link TerminalTheme} implementations intended
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(new AssertionReportDiffer({
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
- * @desc
45
- * Joins the `parts` into a single string and decorates it
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 {@serenity-js/core/lib/model~Outcome | string} outcome
49
- * an instance of an {@link @serenity-js/core/lib/model~Outcome}
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 {...any[]} parts
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,6 +1,6 @@
1
1
  /* istanbul ignore file */
2
2
 
3
- import { Chalk } from 'chalk'; // eslint-disable-line unicorn/import-style
3
+ import { Chalk } from 'chalk'; // eslint-disable-line unicorn/import-style
4
4
 
5
5
  import { ThemeForColourTerminals } from './ThemeForColourTerminals';
6
6
 
@@ -1,6 +1,6 @@
1
1
  /* istanbul ignore file */
2
2
 
3
- import { Chalk } from 'chalk'; // eslint-disable-line unicorn/import-style
3
+ import { Chalk } from 'chalk'; // eslint-disable-line unicorn/import-style
4
4
 
5
5
  import { ThemeForColourTerminals } from './ThemeForColourTerminals';
6
6
 
@@ -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
- * @desc
38
- * Joins the `parts` into a single string.
39
- * Since this class represents a theme for monochromatic terminals,
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 {@serenity-js/core/lib/model~Outcome | string} outcome
43
- * an instance of an {@link @serenity-js/core/lib/model~Outcome}
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 {...any[]} parts
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.
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.build.json",
3
+ "compilerOptions": {
4
+ "outDir": "lib",
5
+ "rootDir": "src"
6
+ },
7
+ "include": [
8
+ "src/**/*.ts"
9
+ ]
10
+ }
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "./tsconfig",
3
- "include": [
4
- "src/**/*.ts",
5
- "spec/**/*.ts"
6
- ],
7
- "exclude": [
8
- "node_modules"
9
- ]
10
- }