7
7
import gherkin .ast .ScenarioOutline ;
8
8
import gherkin .ast .Step ;
9
9
import gherkin .ast .Tag ;
10
+ import io .cucumber .core .exception .CucumberException ;
10
11
import io .cucumber .plugin .ColorAware ;
11
12
import io .cucumber .plugin .EventListener ;
12
13
import io .cucumber .plugin .event .Argument ;
22
23
import io .cucumber .plugin .event .TestStepStarted ;
23
24
import io .cucumber .plugin .event .WriteEvent ;
24
25
26
+ import java .io .BufferedReader ;
27
+ import java .io .IOException ;
25
28
import java .io .PrintWriter ;
29
+ import java .io .StringReader ;
26
30
import java .io .StringWriter ;
27
31
import java .net .URI ;
28
32
import java .util .List ;
@@ -34,6 +38,7 @@ public final class PrettyFormatter implements EventListener, ColorAware {
34
38
private static final String SCENARIO_INDENT = " " ;
35
39
private static final String STEP_INDENT = " " ;
36
40
private static final String EXAMPLES_INDENT = " " ;
41
+ private static final String STEP_SCENARIO_INDENT = " " ;
37
42
private final TestSourcesModel testSources = new TestSourcesModel ();
38
43
private final NiceAppendable out ;
39
44
private Formats formats ;
@@ -100,7 +105,17 @@ private void handleTestStepFinished(TestStepFinished event) {
100
105
}
101
106
102
107
private void handleWrite (WriteEvent event ) {
103
- out .println (event .getText ());
108
+ out .println ();
109
+ try (BufferedReader lines = new BufferedReader (new StringReader (event .getText ()))) {
110
+ String line ;
111
+ while ((line = lines .readLine ()) != null ) {
112
+ out .println (STEP_SCENARIO_INDENT + line );
113
+ }
114
+ } catch (IOException e ) {
115
+ throw new CucumberException (e );
116
+ }
117
+ out .println ();
118
+
104
119
}
105
120
106
121
private void finishReport () {
0 commit comments