@reventlessdev/reventless-gwt 1.0.0-alpha.74
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 +698 -0
- package/LICENSE +202 -0
- package/bin/reventless-dev.mjs +21 -0
- package/package.json +54 -0
- package/rescript.json +36 -0
- package/src/.gwtignore +10 -0
- package/src/Automation_GWT.res +207 -0
- package/src/Automation_GWT.res.mjs +160 -0
- package/src/Behavior_GWT.res +603 -0
- package/src/Behavior_GWT.res.mjs +426 -0
- package/src/Bind.res +29 -0
- package/src/Bind.res.mjs +22 -0
- package/src/BuildClassifier.res +137 -0
- package/src/BuildClassifier.res.mjs +136 -0
- package/src/Cancellation.res +31 -0
- package/src/Cancellation.res.mjs +45 -0
- package/src/ChildProcess.res +84 -0
- package/src/ChildProcess.res.mjs +92 -0
- package/src/Cli.res +671 -0
- package/src/Cli.res.mjs +754 -0
- package/src/Collector.res +201 -0
- package/src/Collector.res.mjs +215 -0
- package/src/ComponentMeta.res +104 -0
- package/src/ComponentMeta.res.mjs +120 -0
- package/src/ComponentScan.res +103 -0
- package/src/ComponentScan.res.mjs +105 -0
- package/src/Delegate_GWT.res +303 -0
- package/src/Delegate_GWT.res.mjs +372 -0
- package/src/Diff.res +91 -0
- package/src/Diff.res.mjs +98 -0
- package/src/Discovery.res +105 -0
- package/src/Discovery.res.mjs +103 -0
- package/src/DomainDeadCode.res +93 -0
- package/src/DomainDeadCode.res.mjs +69 -0
- package/src/DomainGraph.res +0 -0
- package/src/DomainGraph.res.mjs +0 -0
- package/src/EventMapping_GWT.res +29 -0
- package/src/EventMapping_GWT.res.mjs +44 -0
- package/src/Filter.res +36 -0
- package/src/Filter.res.mjs +40 -0
- package/src/Flow_GWT.res +664 -0
- package/src/Flow_GWT.res.mjs +604 -0
- package/src/FormatterHuman.res +138 -0
- package/src/FormatterHuman.res.mjs +122 -0
- package/src/FormatterJson.res +257 -0
- package/src/FormatterJson.res.mjs +320 -0
- package/src/FormatterJunit.res +93 -0
- package/src/FormatterJunit.res.mjs +90 -0
- package/src/FormatterTap.res +139 -0
- package/src/FormatterTap.res.mjs +149 -0
- package/src/FormatterVsCode.res +362 -0
- package/src/FormatterVsCode.res.mjs +564 -0
- package/src/Hint.res +119 -0
- package/src/Hint.res.mjs +124 -0
- package/src/InboundTranslation_GWT.res +83 -0
- package/src/InboundTranslation_GWT.res.mjs +94 -0
- package/src/JestBind.res +70 -0
- package/src/JestBind.res.mjs +63 -0
- package/src/Loader.res +24 -0
- package/src/Loader.res.mjs +23 -0
- package/src/LocalHost.res +135 -0
- package/src/LocalHost.res.mjs +127 -0
- package/src/Mapping_GWT.res +474 -0
- package/src/Mapping_GWT.res.mjs +322 -0
- package/src/MultiSourceProjection_GWT.res +316 -0
- package/src/MultiSourceProjection_GWT.res.mjs +354 -0
- package/src/OutboundTranslation_GWT.res +238 -0
- package/src/OutboundTranslation_GWT.res.mjs +186 -0
- package/src/Outcome.res +161 -0
- package/src/Outcome.res.mjs +140 -0
- package/src/PackageScan.res +80 -0
- package/src/PackageScan.res.mjs +81 -0
- package/src/PlatformRunner.res +160 -0
- package/src/PlatformRunner.res.mjs +155 -0
- package/src/PlatformScan.res +138 -0
- package/src/PlatformScan.res.mjs +131 -0
- package/src/ProcessManager.res +91 -0
- package/src/ProcessManager.res.mjs +80 -0
- package/src/Projection_GWT.res +312 -0
- package/src/Projection_GWT.res.mjs +332 -0
- package/src/Query_GWT.res +379 -0
- package/src/Query_GWT.res.mjs +367 -0
- package/src/RenderRescript.res +125 -0
- package/src/RenderRescript.res.mjs +141 -0
- package/src/RunnerTypes.res +68 -0
- package/src/RunnerTypes.res.mjs +60 -0
- package/src/SideEffect_GWT.res +157 -0
- package/src/SideEffect_GWT.res.mjs +113 -0
- package/src/StateChange/ExternalAddCategorySlice.res +25 -0
- package/src/StateChange/ExternalAddCategorySlice.res.mjs +34 -0
- package/src/StateChange/ExternalAddCategorySlice_Behavior.res +19 -0
- package/src/StateChange/ExternalAddCategorySlice_Behavior.res.mjs +46 -0
- package/src/StateChange/WithFixtures.res +22 -0
- package/src/StateChange/WithFixtures.res.mjs +31 -0
- package/src/StateChange/WithFixtures_Behavior.res +17 -0
- package/src/StateChange/WithFixtures_Behavior.res.mjs +37 -0
- package/src/StateChange/WithManualOpen.res +23 -0
- package/src/StateChange/WithManualOpen.res.mjs +31 -0
- package/src/StateChange/WithManualOpen_Behavior.res +17 -0
- package/src/StateChange/WithManualOpen_Behavior.res.mjs +37 -0
- package/src/StubRuntime.res +53 -0
- package/src/StubRuntime.res.mjs +54 -0
- package/src/TestFixtures.res +16 -0
- package/src/TestFixtures.res.mjs +34 -0
- package/src/Watch.res +92 -0
- package/src/Watch.res.mjs +83 -0
- package/src/WatcherProbe.res +48 -0
- package/src/WatcherProbe.res.mjs +46 -0
- package/tests/AutomationGwtTest.res +71 -0
- package/tests/AutomationGwtTest.res.mjs +189 -0
- package/tests/BuildClassifierTest.res +94 -0
- package/tests/BuildClassifierTest.res.mjs +132 -0
- package/tests/ComponentMetaTest.res +52 -0
- package/tests/ComponentMetaTest.res.mjs +57 -0
- package/tests/DelegateGwtTest.res +487 -0
- package/tests/DelegateGwtTest.res.mjs +891 -0
- package/tests/DiscoveryTest.res +42 -0
- package/tests/DiscoveryTest.res.mjs +43 -0
- package/tests/DomainDeadCodeTest.res +116 -0
- package/tests/DomainDeadCodeTest.res.mjs +155 -0
- package/tests/DomainGraphTest.res +365 -0
- package/tests/DomainGraphTest.res.mjs +413 -0
- package/tests/FlowAggregateGwtTest.res +169 -0
- package/tests/FlowAggregateGwtTest.res.mjs +269 -0
- package/tests/FlowCrossPluginGwtTest.res +340 -0
- package/tests/FlowCrossPluginGwtTest.res.mjs +798 -0
- package/tests/FlowGwtTest.res +222 -0
- package/tests/FlowGwtTest.res.mjs +432 -0
- package/tests/FormatterVsCodeMessageTest.res +41 -0
- package/tests/FormatterVsCodeMessageTest.res.mjs +42 -0
- package/tests/InboundTranslationGwtTest.res +34 -0
- package/tests/InboundTranslationGwtTest.res.mjs +98 -0
- package/tests/LocalHostIntegration.res +70 -0
- package/tests/LocalHostIntegration.res.mjs +64 -0
- package/tests/LocalHostTest.res +71 -0
- package/tests/LocalHostTest.res.mjs +63 -0
- package/tests/MappingGwtTest.res +348 -0
- package/tests/MappingGwtTest.res.mjs +592 -0
- package/tests/OutboundTranslationGwtTest.res +59 -0
- package/tests/OutboundTranslationGwtTest.res.mjs +138 -0
- package/tests/PlatformRunnerTest.res +66 -0
- package/tests/PlatformRunnerTest.res.mjs +85 -0
- package/tests/PlatformScanTest.res +61 -0
- package/tests/PlatformScanTest.res.mjs +56 -0
- package/tests/QueryGwtTest.res +161 -0
- package/tests/QueryGwtTest.res.mjs +314 -0
- package/tests/QueryResolverGwtTest.res +71 -0
- package/tests/QueryResolverGwtTest.res.mjs +136 -0
- package/tests/RunnerUnitTest.res +219 -0
- package/tests/RunnerUnitTest.res.mjs +244 -0
- package/tests/SideEffect/FakeOrderNotification.res +23 -0
- package/tests/SideEffect/FakeOrderNotification.res.mjs +36 -0
- package/tests/SideEffect/FakeOrderNotificationGwtTest.res +35 -0
- package/tests/SideEffect/FakeOrderNotificationGwtTest.res.mjs +73 -0
- package/tests/SideEffect/MockEmail.res +18 -0
- package/tests/SideEffect/MockEmail.res.mjs +47 -0
- package/tests/StateChange/ExternalAddCategorySlice_GWT.res +27 -0
- package/tests/StateChange/ExternalAddCategorySlice_GWT.res.mjs +70 -0
- package/tests/StateChange/WithFixtures_Fixtures.res +9 -0
- package/tests/StateChange/WithFixtures_Fixtures.res.mjs +20 -0
- package/tests/StateChange/WithFixtures_GWT.res +23 -0
- package/tests/StateChange/WithFixtures_GWT.res.mjs +56 -0
- package/tests/StateChange/WithManualOpen_Fixtures.res +7 -0
- package/tests/StateChange/WithManualOpen_Fixtures.res.mjs +20 -0
- package/tests/StateChange/WithManualOpen_GWT.res +17 -0
- package/tests/StateChange/WithManualOpen_GWT.res.mjs +56 -0
- package/tests/StateChangeSliceGwtTest.res +160 -0
- package/tests/StateChangeSliceGwtTest.res.mjs +280 -0
- package/tests/StateViewSliceGwtTest.res +64 -0
- package/tests/StateViewSliceGwtTest.res.mjs +161 -0
- package/tests/WatchDebounceTest.res +78 -0
- package/tests/WatchDebounceTest.res.mjs +97 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
4
|
+
import * as Diff$ReventlessGwt from "./Diff.res.mjs";
|
|
5
|
+
import * as Hint$ReventlessGwt from "./Hint.res.mjs";
|
|
6
|
+
import * as Outcome$ReventlessGwt from "./Outcome.res.mjs";
|
|
7
|
+
import * as RunnerTypes$ReventlessGwt from "./RunnerTypes.res.mjs";
|
|
8
|
+
import * as RenderRescript$ReventlessGwt from "./RenderRescript.res.mjs";
|
|
9
|
+
|
|
10
|
+
let schemaVersion = "1.1.0";
|
|
11
|
+
|
|
12
|
+
function write(s) {
|
|
13
|
+
process.stdout.write(s);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function writeLine(s) {
|
|
17
|
+
process.stdout.write(s + "\n");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function renderValue(j) {
|
|
21
|
+
let obj = {};
|
|
22
|
+
let exit = 0;
|
|
23
|
+
if (j === null || Array.isArray(j)) {
|
|
24
|
+
exit = 1;
|
|
25
|
+
} else {
|
|
26
|
+
switch (typeof j) {
|
|
27
|
+
case "string" :
|
|
28
|
+
obj["type"] = j;
|
|
29
|
+
obj["payload"] = null;
|
|
30
|
+
break;
|
|
31
|
+
case "object" :
|
|
32
|
+
let match = j["TAG"];
|
|
33
|
+
let exit$1 = 0;
|
|
34
|
+
if (typeof match === "string") {
|
|
35
|
+
obj["type"] = match;
|
|
36
|
+
let payloadKeys = Object.keys(j).filter(k => {
|
|
37
|
+
if (k !== "TAG") {
|
|
38
|
+
return k.startsWith("_");
|
|
39
|
+
} else {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
let payload;
|
|
44
|
+
let exit$2 = 0;
|
|
45
|
+
let len = payloadKeys.length;
|
|
46
|
+
if (len !== 1) {
|
|
47
|
+
if (len !== 0) {
|
|
48
|
+
exit$2 = 3;
|
|
49
|
+
} else {
|
|
50
|
+
payload = null;
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
let match$1 = payloadKeys[0];
|
|
54
|
+
if (match$1 === "_0") {
|
|
55
|
+
payload = Stdlib_Option.getOr(j["_0"], null);
|
|
56
|
+
} else {
|
|
57
|
+
exit$2 = 3;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (exit$2 === 3) {
|
|
61
|
+
let payloadDict = {};
|
|
62
|
+
payloadKeys.forEach(k => {
|
|
63
|
+
payloadDict[k] = Stdlib_Option.getOr(j[k], null);
|
|
64
|
+
});
|
|
65
|
+
payload = payloadDict;
|
|
66
|
+
}
|
|
67
|
+
obj["payload"] = payload;
|
|
68
|
+
} else {
|
|
69
|
+
exit$1 = 2;
|
|
70
|
+
}
|
|
71
|
+
if (exit$1 === 2) {
|
|
72
|
+
obj["type"] = null;
|
|
73
|
+
obj["payload"] = j;
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
default:
|
|
77
|
+
exit = 1;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (exit === 1) {
|
|
81
|
+
obj["type"] = null;
|
|
82
|
+
obj["payload"] = j;
|
|
83
|
+
}
|
|
84
|
+
obj["rendered"] = RenderRescript$ReventlessGwt.render(undefined, j);
|
|
85
|
+
return obj;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function renderValues(arr) {
|
|
89
|
+
return arr.map(renderValue);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function mismatchJson(m, slice) {
|
|
93
|
+
let obj = {};
|
|
94
|
+
obj["kind"] = Outcome$ReventlessGwt.kindName(m);
|
|
95
|
+
let optVal = o => {
|
|
96
|
+
if (o !== undefined) {
|
|
97
|
+
return renderValue(o);
|
|
98
|
+
} else {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
switch (m.TAG) {
|
|
103
|
+
case "EventsMismatch" :
|
|
104
|
+
let actual = m.actual;
|
|
105
|
+
let expected = m.expected;
|
|
106
|
+
obj["expected"] = expected.map(renderValue);
|
|
107
|
+
obj["actual"] = actual.map(renderValue);
|
|
108
|
+
obj["fieldDiff"] = Diff$ReventlessGwt.toJsonArray(Diff$ReventlessGwt.diffArrays(expected, actual));
|
|
109
|
+
break;
|
|
110
|
+
case "ErrorMismatch" :
|
|
111
|
+
obj["expected"] = renderValue(m.expected);
|
|
112
|
+
obj["actual"] = optVal(m.actual);
|
|
113
|
+
obj["actualEvents"] = m.actualEvents.map(renderValue);
|
|
114
|
+
break;
|
|
115
|
+
case "StateMismatch" :
|
|
116
|
+
let actual$1 = m.actual;
|
|
117
|
+
let expected$1 = m.expected;
|
|
118
|
+
obj["key"] = m.key;
|
|
119
|
+
obj["expected"] = optVal(expected$1);
|
|
120
|
+
obj["actual"] = optVal(actual$1);
|
|
121
|
+
let eJson = Stdlib_Option.getOr(expected$1, null);
|
|
122
|
+
let aJson = Stdlib_Option.getOr(actual$1, null);
|
|
123
|
+
obj["fieldDiff"] = Diff$ReventlessGwt.toJsonArray(Diff$ReventlessGwt.diff(eJson, aJson));
|
|
124
|
+
break;
|
|
125
|
+
case "NoEventExpected" :
|
|
126
|
+
obj["actual"] = m.actual.map(renderValue);
|
|
127
|
+
break;
|
|
128
|
+
case "TodoMismatch" :
|
|
129
|
+
let pairArr = pairs => pairs.map(param => {
|
|
130
|
+
let d = {};
|
|
131
|
+
d["id"] = param[0];
|
|
132
|
+
d["value"] = renderValue(param[1]);
|
|
133
|
+
return d;
|
|
134
|
+
});
|
|
135
|
+
obj["expected"] = pairArr(m.expected);
|
|
136
|
+
obj["actual"] = pairArr(m.actual);
|
|
137
|
+
break;
|
|
138
|
+
case "AppendConditionMismatch" :
|
|
139
|
+
obj["expected"] = m.expected;
|
|
140
|
+
obj["actual"] = m.actual;
|
|
141
|
+
break;
|
|
142
|
+
case "TranslateError" :
|
|
143
|
+
obj["expected"] = m.expected;
|
|
144
|
+
obj["actual"] = Stdlib_Option.mapOr(m.actual, null, prim => prim);
|
|
145
|
+
break;
|
|
146
|
+
case "QueryRowsMismatch" :
|
|
147
|
+
let actual$2 = m.actual;
|
|
148
|
+
let expected$2 = m.expected;
|
|
149
|
+
obj["expected"] = expected$2.map(renderValue);
|
|
150
|
+
obj["actual"] = actual$2.map(renderValue);
|
|
151
|
+
obj["fieldDiff"] = Diff$ReventlessGwt.toJsonArray(Diff$ReventlessGwt.diffArrays(expected$2, actual$2));
|
|
152
|
+
break;
|
|
153
|
+
case "PublishedActionsMismatch" :
|
|
154
|
+
let actual$3 = m.actual;
|
|
155
|
+
let expected$3 = m.expected;
|
|
156
|
+
obj["expected"] = expected$3.map(renderValue);
|
|
157
|
+
obj["actual"] = actual$3.map(renderValue);
|
|
158
|
+
obj["fieldDiff"] = Diff$ReventlessGwt.toJsonArray(Diff$ReventlessGwt.diffArrays(expected$3, actual$3));
|
|
159
|
+
break;
|
|
160
|
+
case "Throw" :
|
|
161
|
+
obj["error"] = m.error;
|
|
162
|
+
obj["stack"] = m.stack;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
let hint = Hint$ReventlessGwt.forMismatch(slice, m);
|
|
166
|
+
obj["hint"] = Hint$ReventlessGwt.toJson(hint);
|
|
167
|
+
return obj;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function locationJson(loc) {
|
|
171
|
+
if (loc === undefined) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
let d = {};
|
|
175
|
+
d["file"] = loc.file;
|
|
176
|
+
d["line"] = loc.line;
|
|
177
|
+
d["column"] = loc.column;
|
|
178
|
+
return d;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function testJson(t) {
|
|
182
|
+
let d = {};
|
|
183
|
+
d["id"] = t.id;
|
|
184
|
+
d["name"] = t.name;
|
|
185
|
+
d["describePath"] = t.describePath.map(prim => prim);
|
|
186
|
+
d["status"] = RunnerTypes$ReventlessGwt.statusString(t.status);
|
|
187
|
+
d["durationMs"] = t.durationMs;
|
|
188
|
+
d["location"] = locationJson(t.location);
|
|
189
|
+
let m = t.mismatch;
|
|
190
|
+
if (m !== undefined) {
|
|
191
|
+
d["mismatch"] = mismatchJson(m, t.slice);
|
|
192
|
+
}
|
|
193
|
+
let r = t.skipReason;
|
|
194
|
+
if (r !== undefined) {
|
|
195
|
+
d["skipReason"] = r;
|
|
196
|
+
}
|
|
197
|
+
return d;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function fileJson(f) {
|
|
201
|
+
let d = {};
|
|
202
|
+
d["path"] = f.path;
|
|
203
|
+
d["tests"] = f.tests.map(testJson);
|
|
204
|
+
return d;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function summaryJson(s) {
|
|
208
|
+
let d = {};
|
|
209
|
+
d["total"] = s.total;
|
|
210
|
+
d["passed"] = s.passed;
|
|
211
|
+
d["failed"] = s.failed;
|
|
212
|
+
d["skipped"] = s.skipped;
|
|
213
|
+
d["files"] = s.files;
|
|
214
|
+
return d;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function envelope(r, toolVersion) {
|
|
218
|
+
let d = {};
|
|
219
|
+
d["schemaVersion"] = schemaVersion;
|
|
220
|
+
d["tool"] = "reventless-gwt";
|
|
221
|
+
d["toolVersion"] = toolVersion;
|
|
222
|
+
d["startedAt"] = r.summary.startedAt;
|
|
223
|
+
d["durationMs"] = r.summary.durationMs;
|
|
224
|
+
d["summary"] = summaryJson(r.summary);
|
|
225
|
+
d["files"] = r.files.map(fileJson);
|
|
226
|
+
return d;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function emit(r, toolVersion) {
|
|
230
|
+
process.stdout.write(JSON.stringify(envelope(r, toolVersion), undefined, 2) + "\n");
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function streamRunStart(toolVersion, startedAt) {
|
|
234
|
+
let d = {};
|
|
235
|
+
d["type"] = "runStarted";
|
|
236
|
+
d["schemaVersion"] = schemaVersion;
|
|
237
|
+
d["toolVersion"] = toolVersion;
|
|
238
|
+
d["at"] = startedAt;
|
|
239
|
+
let s = JSON.stringify(d);
|
|
240
|
+
process.stdout.write(s + "\n");
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function streamFileStart(path) {
|
|
244
|
+
let d = {};
|
|
245
|
+
d["type"] = "fileStarted";
|
|
246
|
+
d["path"] = path;
|
|
247
|
+
let s = JSON.stringify(d);
|
|
248
|
+
process.stdout.write(s + "\n");
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function streamTest(t) {
|
|
252
|
+
let d = {};
|
|
253
|
+
d["type"] = "testResult";
|
|
254
|
+
let tj = testJson(t);
|
|
255
|
+
if (typeof tj === "object" && tj !== null && !Array.isArray(tj)) {
|
|
256
|
+
Object.keys(tj).forEach(k => {
|
|
257
|
+
d[k] = tj[k];
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
let s = JSON.stringify(d);
|
|
261
|
+
process.stdout.write(s + "\n");
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function streamFileFinished(f) {
|
|
265
|
+
let passed = {
|
|
266
|
+
contents: 0
|
|
267
|
+
};
|
|
268
|
+
let failed = {
|
|
269
|
+
contents: 0
|
|
270
|
+
};
|
|
271
|
+
f.tests.forEach(t => {
|
|
272
|
+
let match = t.status;
|
|
273
|
+
switch (match) {
|
|
274
|
+
case "Pass" :
|
|
275
|
+
passed.contents = passed.contents + 1 | 0;
|
|
276
|
+
return;
|
|
277
|
+
case "Fail" :
|
|
278
|
+
failed.contents = failed.contents + 1 | 0;
|
|
279
|
+
return;
|
|
280
|
+
case "Skip" :
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
let d = {};
|
|
285
|
+
d["type"] = "fileFinished";
|
|
286
|
+
d["path"] = f.path;
|
|
287
|
+
d["passed"] = passed.contents;
|
|
288
|
+
d["failed"] = failed.contents;
|
|
289
|
+
let s = JSON.stringify(d);
|
|
290
|
+
process.stdout.write(s + "\n");
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function streamRunEnd(r) {
|
|
294
|
+
let d = {};
|
|
295
|
+
d["type"] = "runFinished";
|
|
296
|
+
d["summary"] = summaryJson(r.summary);
|
|
297
|
+
let s = JSON.stringify(d);
|
|
298
|
+
process.stdout.write(s + "\n");
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export {
|
|
302
|
+
schemaVersion,
|
|
303
|
+
write,
|
|
304
|
+
writeLine,
|
|
305
|
+
renderValue,
|
|
306
|
+
renderValues,
|
|
307
|
+
mismatchJson,
|
|
308
|
+
locationJson,
|
|
309
|
+
testJson,
|
|
310
|
+
fileJson,
|
|
311
|
+
summaryJson,
|
|
312
|
+
envelope,
|
|
313
|
+
emit,
|
|
314
|
+
streamRunStart,
|
|
315
|
+
streamFileStart,
|
|
316
|
+
streamTest,
|
|
317
|
+
streamFileFinished,
|
|
318
|
+
streamRunEnd,
|
|
319
|
+
}
|
|
320
|
+
/* No side effect */
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// JUnit XML emitter — one `<testsuite>` per file, one `<testcase>` per test.
|
|
2
|
+
// Failures carry the human-readable mismatch + hint inside `<failure>` so
|
|
3
|
+
// CI tools like Jenkins surface the ReScript-rendered expected/actual in
|
|
4
|
+
// their test report UI.
|
|
5
|
+
|
|
6
|
+
@val external processStdout: {"write": string => unit} = "process.stdout"
|
|
7
|
+
let write = (s: string) => processStdout["write"](s)
|
|
8
|
+
let writeLine = (s: string) => write(s ++ "\n")
|
|
9
|
+
|
|
10
|
+
let escapeXml = (s: string) =>
|
|
11
|
+
s
|
|
12
|
+
->String.replaceAll("&", "&")
|
|
13
|
+
->String.replaceAll("<", "<")
|
|
14
|
+
->String.replaceAll(">", ">")
|
|
15
|
+
->String.replaceAll("\"", """)
|
|
16
|
+
->String.replaceAll("'", "'")
|
|
17
|
+
|
|
18
|
+
let emitFile = (f: RunnerTypes.fileResult) => {
|
|
19
|
+
let tests = f.tests->Array.length
|
|
20
|
+
let failures = ref(0)
|
|
21
|
+
let skipped = ref(0)
|
|
22
|
+
f.tests->Array.forEach(t =>
|
|
23
|
+
switch t.status {
|
|
24
|
+
| Fail => failures := failures.contents + 1
|
|
25
|
+
| Skip => skipped := skipped.contents + 1
|
|
26
|
+
| Pass => ()
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
let totalTime = f.tests->Array.reduce(0.0, (a, t) => a +. t.durationMs) /. 1000.0
|
|
30
|
+
writeLine(
|
|
31
|
+
` <testsuite name="${escapeXml(f.path)}" tests="${Int.toString(
|
|
32
|
+
tests,
|
|
33
|
+
)}" failures="${Int.toString(failures.contents)}" skipped="${Int.toString(
|
|
34
|
+
skipped.contents,
|
|
35
|
+
)}" time="${Float.toString(totalTime)}">`,
|
|
36
|
+
)
|
|
37
|
+
f.tests->Array.forEach(t => {
|
|
38
|
+
let name = t.describePath->Array.join(" > ")
|
|
39
|
+
let classname = name == "" ? f.path : name
|
|
40
|
+
let time = t.durationMs /. 1000.0
|
|
41
|
+
write(
|
|
42
|
+
` <testcase name="${escapeXml(t.name)}" classname="${escapeXml(
|
|
43
|
+
classname,
|
|
44
|
+
)}" time="${Float.toString(time)}"`,
|
|
45
|
+
)
|
|
46
|
+
switch t.status {
|
|
47
|
+
| Pass => writeLine(" />")
|
|
48
|
+
| Skip => {
|
|
49
|
+
writeLine(">")
|
|
50
|
+
writeLine(
|
|
51
|
+
` <skipped message="${escapeXml(t.skipReason->Option.getOr("skipped"))}" />`,
|
|
52
|
+
)
|
|
53
|
+
writeLine(` </testcase>`)
|
|
54
|
+
}
|
|
55
|
+
| Fail => {
|
|
56
|
+
writeLine(">")
|
|
57
|
+
switch t.mismatch {
|
|
58
|
+
| Some(m) => {
|
|
59
|
+
let hint = Hint.forMismatch(~slice=?t.slice, m)
|
|
60
|
+
let msg =
|
|
61
|
+
escapeXml(Outcome.kindName(m)) ++
|
|
62
|
+
": " ++
|
|
63
|
+
escapeXml(Outcome.format(m)) ++
|
|
64
|
+
"\n\n" ++
|
|
65
|
+
escapeXml(Hint.format(hint))
|
|
66
|
+
writeLine(
|
|
67
|
+
` <failure type="${escapeXml(Outcome.kindName(m))}" message="${escapeXml(
|
|
68
|
+
Outcome.format(m),
|
|
69
|
+
)}">${msg}</failure>`,
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
| None =>
|
|
73
|
+
writeLine(` <failure message="failed" type="unknown">failed</failure>`)
|
|
74
|
+
}
|
|
75
|
+
writeLine(` </testcase>`)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
writeLine(` </testsuite>`)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
let emit = (r: RunnerTypes.runResult) => {
|
|
83
|
+
writeLine(`<?xml version="1.0" encoding="UTF-8"?>`)
|
|
84
|
+
writeLine(
|
|
85
|
+
`<testsuites name="reventless-gwt" tests="${Int.toString(
|
|
86
|
+
r.summary.total,
|
|
87
|
+
)}" failures="${Int.toString(r.summary.failed)}" skipped="${Int.toString(
|
|
88
|
+
r.summary.skipped,
|
|
89
|
+
)}" time="${Float.toString(r.summary.durationMs /. 1000.0)}">`,
|
|
90
|
+
)
|
|
91
|
+
r.files->Array.forEach(emitFile)
|
|
92
|
+
writeLine(`</testsuites>`)
|
|
93
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
4
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
+
import * as Hint$ReventlessGwt from "./Hint.res.mjs";
|
|
6
|
+
import * as Outcome$ReventlessGwt from "./Outcome.res.mjs";
|
|
7
|
+
|
|
8
|
+
function write(s) {
|
|
9
|
+
process.stdout.write(s);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function writeLine(s) {
|
|
13
|
+
process.stdout.write(s + "\n");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function escapeXml(s) {
|
|
17
|
+
return s.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function emitFile(f) {
|
|
21
|
+
let tests = f.tests.length;
|
|
22
|
+
let failures = {
|
|
23
|
+
contents: 0
|
|
24
|
+
};
|
|
25
|
+
let skipped = {
|
|
26
|
+
contents: 0
|
|
27
|
+
};
|
|
28
|
+
f.tests.forEach(t => {
|
|
29
|
+
let match = t.status;
|
|
30
|
+
switch (match) {
|
|
31
|
+
case "Pass" :
|
|
32
|
+
return;
|
|
33
|
+
case "Fail" :
|
|
34
|
+
failures.contents = failures.contents + 1 | 0;
|
|
35
|
+
return;
|
|
36
|
+
case "Skip" :
|
|
37
|
+
skipped.contents = skipped.contents + 1 | 0;
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
let totalTime = Stdlib_Array.reduce(f.tests, 0.0, (a, t) => a + t.durationMs) / 1000.0;
|
|
42
|
+
let s = ` <testsuite name="` + escapeXml(f.path) + `" tests="` + tests.toString() + `" failures="` + failures.contents.toString() + `" skipped="` + skipped.contents.toString() + `" time="` + totalTime.toString() + `">`;
|
|
43
|
+
process.stdout.write(s + "\n");
|
|
44
|
+
f.tests.forEach(t => {
|
|
45
|
+
let name = t.describePath.join(" > ");
|
|
46
|
+
let classname = name === "" ? f.path : name;
|
|
47
|
+
let time = t.durationMs / 1000.0;
|
|
48
|
+
process.stdout.write(` <testcase name="` + escapeXml(t.name) + `" classname="` + escapeXml(classname) + `" time="` + time.toString() + `"`);
|
|
49
|
+
let match = t.status;
|
|
50
|
+
switch (match) {
|
|
51
|
+
case "Pass" :
|
|
52
|
+
return process.stdout.write(" />\n");
|
|
53
|
+
case "Fail" :
|
|
54
|
+
process.stdout.write(">\n");
|
|
55
|
+
let m = t.mismatch;
|
|
56
|
+
if (m !== undefined) {
|
|
57
|
+
let hint = Hint$ReventlessGwt.forMismatch(t.slice, m);
|
|
58
|
+
let msg = escapeXml(Outcome$ReventlessGwt.kindName(m)) + ": " + escapeXml(Outcome$ReventlessGwt.format(m)) + "\n\n" + escapeXml(Hint$ReventlessGwt.format(hint));
|
|
59
|
+
let s = ` <failure type="` + escapeXml(Outcome$ReventlessGwt.kindName(m)) + `" message="` + escapeXml(Outcome$ReventlessGwt.format(m)) + `">` + msg + `</failure>`;
|
|
60
|
+
process.stdout.write(s + "\n");
|
|
61
|
+
} else {
|
|
62
|
+
process.stdout.write(` <failure message="failed" type="unknown">failed</failure>` + "\n");
|
|
63
|
+
}
|
|
64
|
+
return process.stdout.write(` </testcase>` + "\n");
|
|
65
|
+
case "Skip" :
|
|
66
|
+
process.stdout.write(">\n");
|
|
67
|
+
let s$1 = ` <skipped message="` + escapeXml(Stdlib_Option.getOr(t.skipReason, "skipped")) + `" />`;
|
|
68
|
+
process.stdout.write(s$1 + "\n");
|
|
69
|
+
return process.stdout.write(` </testcase>` + "\n");
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
process.stdout.write(` </testsuite>` + "\n");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function emit(r) {
|
|
76
|
+
process.stdout.write(`<?xml version="1.0" encoding="UTF-8"?>` + "\n");
|
|
77
|
+
let s = `<testsuites name="reventless-gwt" tests="` + r.summary.total.toString() + `" failures="` + r.summary.failed.toString() + `" skipped="` + r.summary.skipped.toString() + `" time="` + (r.summary.durationMs / 1000.0).toString() + `">`;
|
|
78
|
+
process.stdout.write(s + "\n");
|
|
79
|
+
r.files.forEach(emitFile);
|
|
80
|
+
process.stdout.write(`</testsuites>` + "\n");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export {
|
|
84
|
+
write,
|
|
85
|
+
writeLine,
|
|
86
|
+
escapeXml,
|
|
87
|
+
emitFile,
|
|
88
|
+
emit,
|
|
89
|
+
}
|
|
90
|
+
/* No side effect */
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// TAP 14 emitter with YAML diagnostic blocks on failure. Streamed line-by-line
|
|
2
|
+
// so `tap-spec` and GitHub Actions' `actions/test-reporter` can consume the
|
|
3
|
+
// output live.
|
|
4
|
+
|
|
5
|
+
@val external processStdout: {"write": string => unit} = "process.stdout"
|
|
6
|
+
let write = (s: string) => processStdout["write"](s)
|
|
7
|
+
let writeLine = (s: string) => write(s ++ "\n")
|
|
8
|
+
|
|
9
|
+
let escapeYamlString = (s: string) =>
|
|
10
|
+
s
|
|
11
|
+
->String.replaceAll("\\", "\\\\")
|
|
12
|
+
->String.replaceAll("\"", "\\\"")
|
|
13
|
+
->String.replaceAll("\n", "\\n")
|
|
14
|
+
|
|
15
|
+
let yamlString = (s: string) => "\"" ++ escapeYamlString(s) ++ "\""
|
|
16
|
+
|
|
17
|
+
let yamlLine = (~indent=2, key: string, value: string) =>
|
|
18
|
+
String.repeat(" ", indent) ++ key ++ ": " ++ value
|
|
19
|
+
|
|
20
|
+
let renderMismatchYaml = (m: Outcome.mismatch) => {
|
|
21
|
+
let lines = []
|
|
22
|
+
lines->Array.push(yamlLine("kind", yamlString(Outcome.kindName(m))))
|
|
23
|
+
switch m {
|
|
24
|
+
| EventsMismatch({expected, actual}) => {
|
|
25
|
+
lines->Array.push(yamlLine("expected", yamlString(RenderRescript.renderMany(expected))))
|
|
26
|
+
lines->Array.push(yamlLine("actual", yamlString(RenderRescript.renderMany(actual))))
|
|
27
|
+
}
|
|
28
|
+
| ErrorMismatch({expected, actual, actualEvents}) => {
|
|
29
|
+
lines->Array.push(
|
|
30
|
+
yamlLine("expected", yamlString("Error(" ++ RenderRescript.render(expected) ++ ")")),
|
|
31
|
+
)
|
|
32
|
+
let actualStr = switch actual {
|
|
33
|
+
| Some(v) => "Error(" ++ RenderRescript.render(v) ++ ")"
|
|
34
|
+
| None => "Ok(" ++ RenderRescript.renderMany(actualEvents) ++ ")"
|
|
35
|
+
}
|
|
36
|
+
lines->Array.push(yamlLine("actual", yamlString(actualStr)))
|
|
37
|
+
}
|
|
38
|
+
| StateMismatch({key, expected, actual}) => {
|
|
39
|
+
lines->Array.push(yamlLine("key", yamlString(key)))
|
|
40
|
+
lines->Array.push(yamlLine("expected", yamlString(RenderRescript.renderOption(expected))))
|
|
41
|
+
lines->Array.push(yamlLine("actual", yamlString(RenderRescript.renderOption(actual))))
|
|
42
|
+
}
|
|
43
|
+
| NoEventExpected({actual}) =>
|
|
44
|
+
lines->Array.push(yamlLine("actual", yamlString(RenderRescript.renderMany(actual))))
|
|
45
|
+
| TodoMismatch({expected, actual}) => {
|
|
46
|
+
let fmt = arr =>
|
|
47
|
+
arr
|
|
48
|
+
->Array.map(((id, v)) => "(" ++ id ++ ", " ++ RenderRescript.render(v) ++ ")")
|
|
49
|
+
->Array.join(", ")
|
|
50
|
+
lines->Array.push(yamlLine("expected", yamlString("[" ++ fmt(expected) ++ "]")))
|
|
51
|
+
lines->Array.push(yamlLine("actual", yamlString("[" ++ fmt(actual) ++ "]")))
|
|
52
|
+
}
|
|
53
|
+
| AppendConditionMismatch({expected, actual}) => {
|
|
54
|
+
lines->Array.push(yamlLine("expected", yamlString(RenderRescript.render(expected))))
|
|
55
|
+
lines->Array.push(yamlLine("actual", yamlString(RenderRescript.render(actual))))
|
|
56
|
+
}
|
|
57
|
+
| TranslateError({expected, actual}) => {
|
|
58
|
+
lines->Array.push(yamlLine("expected", yamlString(expected)))
|
|
59
|
+
lines->Array.push(yamlLine("actual", yamlString(actual->Option.getOr("(none)"))))
|
|
60
|
+
}
|
|
61
|
+
| QueryRowsMismatch({expected, actual}) => {
|
|
62
|
+
lines->Array.push(yamlLine("expected", yamlString(RenderRescript.renderMany(expected))))
|
|
63
|
+
lines->Array.push(yamlLine("actual", yamlString(RenderRescript.renderMany(actual))))
|
|
64
|
+
}
|
|
65
|
+
| PublishedActionsMismatch({expected, actual}) => {
|
|
66
|
+
lines->Array.push(yamlLine("expected", yamlString(RenderRescript.renderMany(expected))))
|
|
67
|
+
lines->Array.push(yamlLine("actual", yamlString(RenderRescript.renderMany(actual))))
|
|
68
|
+
}
|
|
69
|
+
| Throw({error, stack}) => {
|
|
70
|
+
lines->Array.push(yamlLine("error", yamlString(error)))
|
|
71
|
+
lines->Array.push(yamlLine("stack", yamlString(stack)))
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
lines->Array.join("\n")
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let emit = (r: RunnerTypes.runResult) => {
|
|
78
|
+
writeLine("TAP version 14")
|
|
79
|
+
writeLine(`1..${Int.toString(r.summary.total)}`)
|
|
80
|
+
let index = ref(0)
|
|
81
|
+
r.files->Array.forEach(f => {
|
|
82
|
+
writeLine("")
|
|
83
|
+
writeLine(`# ${f.path}`)
|
|
84
|
+
f.tests->Array.forEach(t => {
|
|
85
|
+
index := index.contents + 1
|
|
86
|
+
let n = index.contents
|
|
87
|
+
let path = t.describePath->Array.join(" > ")
|
|
88
|
+
let title = path == "" ? t.name : `${path} > ${t.name}`
|
|
89
|
+
let ms = ` # time=${Float.toString(t.durationMs)}ms`
|
|
90
|
+
switch t.status {
|
|
91
|
+
| Pass => writeLine(`ok ${Int.toString(n)} - ${title}${ms}`)
|
|
92
|
+
| Skip => {
|
|
93
|
+
let reason = t.skipReason->Option.getOr("skipped")
|
|
94
|
+
writeLine(`ok ${Int.toString(n)} - ${title} # SKIP ${reason}`)
|
|
95
|
+
}
|
|
96
|
+
| Fail => {
|
|
97
|
+
writeLine(`not ok ${Int.toString(n)} - ${title}${ms}`)
|
|
98
|
+
writeLine(" ---")
|
|
99
|
+
switch t.location {
|
|
100
|
+
| Some(loc) =>
|
|
101
|
+
writeLine(
|
|
102
|
+
yamlLine(
|
|
103
|
+
"location",
|
|
104
|
+
`{ file: "${loc.file}", line: ${Int.toString(loc.line)} }`,
|
|
105
|
+
),
|
|
106
|
+
)
|
|
107
|
+
| None => ()
|
|
108
|
+
}
|
|
109
|
+
switch t.mismatch {
|
|
110
|
+
| Some(m) => writeLine(renderMismatchYaml(m))
|
|
111
|
+
| None => ()
|
|
112
|
+
}
|
|
113
|
+
switch t.mismatch {
|
|
114
|
+
| Some(m) => {
|
|
115
|
+
let hint = Hint.forMismatch(~slice=?t.slice, m)
|
|
116
|
+
writeLine(yamlLine("hint", ""))
|
|
117
|
+
writeLine(yamlLine(~indent=4, "locus", yamlString(hint.locus)))
|
|
118
|
+
writeLine(
|
|
119
|
+
yamlLine(
|
|
120
|
+
~indent=4,
|
|
121
|
+
"branch",
|
|
122
|
+
yamlString(hint.branch->Option.getOr("(none)")),
|
|
123
|
+
),
|
|
124
|
+
)
|
|
125
|
+
writeLine(yamlLine(~indent=4, "message", yamlString(hint.message)))
|
|
126
|
+
}
|
|
127
|
+
| None => ()
|
|
128
|
+
}
|
|
129
|
+
writeLine(" ...")
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
writeLine("")
|
|
135
|
+
writeLine(`# tests ${Int.toString(r.summary.total)}`)
|
|
136
|
+
writeLine(`# pass ${Int.toString(r.summary.passed)}`)
|
|
137
|
+
writeLine(`# fail ${Int.toString(r.summary.failed)}`)
|
|
138
|
+
writeLine(`# skip ${Int.toString(r.summary.skipped)}`)
|
|
139
|
+
}
|