@@ -16,6 +16,12 @@ export async function generateHtml(data: DataFixture) {
16
16
17
17
const highlighter = createHighlighter ( ) ;
18
18
19
+ /**
20
+ * Closure-based HTML generator for test case data.
21
+ *
22
+ * @param {DataFixture } data - The state object containing the necessary data for HTML generation.
23
+ * @returns {Object } An object with generate, generateAll, and getDecorations async functions.
24
+ */
19
25
function createHtmlGenerator ( data : DataFixture ) {
20
26
const lang = data . languageId as BundledLanguage ;
21
27
const command = data . command ;
@@ -42,6 +48,12 @@ function createHtmlGenerator(data: DataFixture) {
42
48
after : data . finalState
43
49
} ;
44
50
51
+ /**
52
+ * Generates HTML for a specific test case step (before, during, after).
53
+ *
54
+ * @param {StepNameType } stepName - The step to generate HTML for.
55
+ * @returns {Promise<{ html: string; data: any[] } | string> } The generated HTML and decoration data, or an error string.
56
+ */
45
57
async function generate ( stepName : StepNameType ) {
46
58
const state = testCaseStates [ stepName ] ;
47
59
if ( ! state ) {
@@ -98,6 +110,11 @@ function createHtmlGenerator(data: DataFixture) {
98
110
return { html : htmlArray . join ( "" ) , data : [ decorations ] } ;
99
111
}
100
112
113
+ /**
114
+ * Generates HTML for all test case steps (before, during, after).
115
+ *
116
+ * @returns {Promise<{ before: any; during: any; after: any }> } The generated HTML and decoration data for each step.
117
+ */
101
118
async function generateAll ( ) {
102
119
return {
103
120
before : await generate ( "before" ) ,
@@ -106,6 +123,12 @@ function createHtmlGenerator(data: DataFixture) {
106
123
} ;
107
124
}
108
125
126
+ /**
127
+ * Computes code decorations for a given test case state.
128
+ *
129
+ * @param {ExtendedTestCaseSnapshot } testCaseState - The test case state to decorate.
130
+ * @returns {Promise<Decoration[]> } The computed decorations for the state.
131
+ */
109
132
async function getDecorations ( testCaseState : ExtendedTestCaseSnapshot ) {
110
133
const { messages, flashes, highlights, finalStateMarkHelpers } = testCaseState ;
111
134
const potentialMarks = testCaseState . marks || { } ;
0 commit comments