@reventlessdev/reventless-gwt 1.0.0-alpha.100
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 +916 -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 +569 -0
- package/src/Behavior_GWT.res.mjs +523 -0
- package/src/Bind.res +29 -0
- package/src/Bind.res.mjs +22 -0
- package/src/BuildClassifier.res +147 -0
- package/src/BuildClassifier.res.mjs +136 -0
- package/src/Cancellation.res +37 -0
- package/src/Cancellation.res.mjs +46 -0
- package/src/ChildProcess.res +102 -0
- package/src/ChildProcess.res.mjs +107 -0
- package/src/Cli.res +905 -0
- package/src/Cli.res.mjs +952 -0
- package/src/Collector.res +212 -0
- package/src/Collector.res.mjs +218 -0
- package/src/ComponentMeta.res +77 -0
- package/src/ComponentMeta.res.mjs +91 -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 +99 -0
- package/src/DomainDeadCode.res +98 -0
- package/src/DomainDeadCode.res.mjs +72 -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 +45 -0
- package/src/Filter.res.mjs +47 -0
- package/src/Flow_GWT.res +664 -0
- package/src/Flow_GWT.res.mjs +604 -0
- package/src/FormatterHuman.res +109 -0
- package/src/FormatterHuman.res.mjs +115 -0
- package/src/FormatterJson.res +264 -0
- package/src/FormatterJson.res.mjs +322 -0
- package/src/FormatterJunit.res +93 -0
- package/src/FormatterJunit.res.mjs +90 -0
- package/src/FormatterTap.res +100 -0
- package/src/FormatterTap.res.mjs +131 -0
- package/src/FormatterVsCode.res +352 -0
- package/src/FormatterVsCode.res.mjs +546 -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 +119 -0
- package/src/LocalHost.res.mjs +99 -0
- package/src/Mapping_GWT.res +474 -0
- package/src/Mapping_GWT.res.mjs +322 -0
- package/src/MismatchRender.res +72 -0
- package/src/MismatchRender.res.mjs +127 -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 +97 -0
- package/src/Outcome.res.mjs +93 -0
- package/src/PackageScan.res +80 -0
- package/src/PackageScan.res.mjs +81 -0
- package/src/PlatformRunner.res +181 -0
- package/src/PlatformRunner.res.mjs +176 -0
- package/src/PlatformScan.res +142 -0
- package/src/PlatformScan.res.mjs +132 -0
- package/src/ProcessManager.res +135 -0
- package/src/ProcessManager.res.mjs +119 -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/RunWorker.res +24 -0
- package/src/RunWorker.res.mjs +16 -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 +54 -0
- package/src/StubRuntime.res.mjs +55 -0
- package/src/TestFixtures.res +16 -0
- package/src/TestFixtures.res.mjs +34 -0
- package/src/Watch.res +108 -0
- package/src/Watch.res.mjs +85 -0
- package/src/WatcherProbe.res +56 -0
- package/src/WatcherProbe.res.mjs +59 -0
- package/src/Worker.res +24 -0
- package/src/Worker.res.mjs +9 -0
- package/tests/AutomationGwtTest.res +71 -0
- package/tests/AutomationGwtTest.res.mjs +189 -0
- package/tests/BuildClassifierTest.res +133 -0
- package/tests/BuildClassifierTest.res.mjs +176 -0
- package/tests/CliRunEntryTest.res +57 -0
- package/tests/CliRunEntryTest.res.mjs +65 -0
- package/tests/CliWatchScopeTest.res +62 -0
- package/tests/CliWatchScopeTest.res.mjs +95 -0
- package/tests/ComponentMetaTest.res +67 -0
- package/tests/ComponentMetaTest.res.mjs +71 -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 +119 -0
- package/tests/DomainDeadCodeTest.res.mjs +158 -0
- package/tests/DomainGraphTest.res +448 -0
- package/tests/DomainGraphTest.res.mjs +505 -0
- package/tests/FlowAggregateGwtTest.res +171 -0
- package/tests/FlowAggregateGwtTest.res.mjs +273 -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 +433 -0
- package/tests/FormatterGoldenTest.res +125 -0
- package/tests/FormatterGoldenTest.res.mjs +162 -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 +99 -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 +350 -0
- package/tests/MappingGwtTest.res.mjs +596 -0
- package/tests/OutboundTranslationGwtTest.res +59 -0
- package/tests/OutboundTranslationGwtTest.res.mjs +139 -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 +106 -0
- package/tests/WatchDebounceTest.res.mjs +128 -0
|
@@ -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,100 @@
|
|
|
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 n = MismatchRender.normalize(m)
|
|
22
|
+
let lines = [yamlLine("kind", yamlString(n.kind))]
|
|
23
|
+
// `ExpectedNoEvents` is a Human-only literal (TAP simply omits `expected`);
|
|
24
|
+
// every other field maps to one yaml `key: "escaped-value"` line.
|
|
25
|
+
n.fields->Array.forEach(f =>
|
|
26
|
+
switch f {
|
|
27
|
+
| Expected(v) => lines->Array.push(yamlLine("expected", yamlString(v)))
|
|
28
|
+
| Actual(v) => lines->Array.push(yamlLine("actual", yamlString(v)))
|
|
29
|
+
| Key(k) => lines->Array.push(yamlLine("key", yamlString(k)))
|
|
30
|
+
| Error(e) => lines->Array.push(yamlLine("error", yamlString(e)))
|
|
31
|
+
| Stack(s) => lines->Array.push(yamlLine("stack", yamlString(s)))
|
|
32
|
+
| ExpectedNoEvents => ()
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
lines->Array.join("\n")
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let emit = (r: RunnerTypes.runResult) => {
|
|
39
|
+
writeLine("TAP version 14")
|
|
40
|
+
writeLine(`1..${Int.toString(r.summary.total)}`)
|
|
41
|
+
let index = ref(0)
|
|
42
|
+
r.files->Array.forEach(f => {
|
|
43
|
+
writeLine("")
|
|
44
|
+
writeLine(`# ${f.path}`)
|
|
45
|
+
f.tests->Array.forEach(t => {
|
|
46
|
+
index := index.contents + 1
|
|
47
|
+
let n = index.contents
|
|
48
|
+
let path = t.describePath->Array.join(" > ")
|
|
49
|
+
let title = path == "" ? t.name : `${path} > ${t.name}`
|
|
50
|
+
let ms = ` # time=${Float.toString(t.durationMs)}ms`
|
|
51
|
+
switch t.status {
|
|
52
|
+
| Pass => writeLine(`ok ${Int.toString(n)} - ${title}${ms}`)
|
|
53
|
+
| Skip => {
|
|
54
|
+
let reason = t.skipReason->Option.getOr("skipped")
|
|
55
|
+
writeLine(`ok ${Int.toString(n)} - ${title} # SKIP ${reason}`)
|
|
56
|
+
}
|
|
57
|
+
| Fail => {
|
|
58
|
+
writeLine(`not ok ${Int.toString(n)} - ${title}${ms}`)
|
|
59
|
+
writeLine(" ---")
|
|
60
|
+
switch t.location {
|
|
61
|
+
| Some(loc) =>
|
|
62
|
+
writeLine(
|
|
63
|
+
yamlLine(
|
|
64
|
+
"location",
|
|
65
|
+
`{ file: "${loc.file}", line: ${Int.toString(loc.line)} }`,
|
|
66
|
+
),
|
|
67
|
+
)
|
|
68
|
+
| None => ()
|
|
69
|
+
}
|
|
70
|
+
switch t.mismatch {
|
|
71
|
+
| Some(m) => writeLine(renderMismatchYaml(m))
|
|
72
|
+
| None => ()
|
|
73
|
+
}
|
|
74
|
+
switch t.mismatch {
|
|
75
|
+
| Some(m) => {
|
|
76
|
+
let hint = Hint.forMismatch(~slice=?t.slice, m)
|
|
77
|
+
writeLine(yamlLine("hint", ""))
|
|
78
|
+
writeLine(yamlLine(~indent=4, "locus", yamlString(hint.locus)))
|
|
79
|
+
writeLine(
|
|
80
|
+
yamlLine(
|
|
81
|
+
~indent=4,
|
|
82
|
+
"branch",
|
|
83
|
+
yamlString(hint.branch->Option.getOr("(none)")),
|
|
84
|
+
),
|
|
85
|
+
)
|
|
86
|
+
writeLine(yamlLine(~indent=4, "message", yamlString(hint.message)))
|
|
87
|
+
}
|
|
88
|
+
| None => ()
|
|
89
|
+
}
|
|
90
|
+
writeLine(" ...")
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
writeLine("")
|
|
96
|
+
writeLine(`# tests ${Int.toString(r.summary.total)}`)
|
|
97
|
+
writeLine(`# pass ${Int.toString(r.summary.passed)}`)
|
|
98
|
+
writeLine(`# fail ${Int.toString(r.summary.failed)}`)
|
|
99
|
+
writeLine(`# skip ${Int.toString(r.summary.skipped)}`)
|
|
100
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
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 Hint$ReventlessGwt from "./Hint.res.mjs";
|
|
5
|
+
import * as MismatchRender$ReventlessGwt from "./MismatchRender.res.mjs";
|
|
6
|
+
|
|
7
|
+
function write(s) {
|
|
8
|
+
process.stdout.write(s);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function writeLine(s) {
|
|
12
|
+
process.stdout.write(s + "\n");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function escapeYamlString(s) {
|
|
16
|
+
return s.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"").replaceAll("\n", "\\n");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function yamlString(s) {
|
|
20
|
+
return "\"" + escapeYamlString(s) + "\"";
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function yamlLine(indentOpt, key, value) {
|
|
24
|
+
let indent = indentOpt !== undefined ? indentOpt : 2;
|
|
25
|
+
return " ".repeat(indent) + key + ": " + value;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function renderMismatchYaml(m) {
|
|
29
|
+
let n = MismatchRender$ReventlessGwt.normalize(m);
|
|
30
|
+
let lines = [yamlLine(undefined, "kind", yamlString(n.kind))];
|
|
31
|
+
n.fields.forEach(f => {
|
|
32
|
+
if (typeof f !== "object") {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
switch (f.TAG) {
|
|
36
|
+
case "Expected" :
|
|
37
|
+
lines.push(yamlLine(undefined, "expected", yamlString(f._0)));
|
|
38
|
+
return;
|
|
39
|
+
case "Actual" :
|
|
40
|
+
lines.push(yamlLine(undefined, "actual", yamlString(f._0)));
|
|
41
|
+
return;
|
|
42
|
+
case "Key" :
|
|
43
|
+
lines.push(yamlLine(undefined, "key", yamlString(f._0)));
|
|
44
|
+
return;
|
|
45
|
+
case "Error" :
|
|
46
|
+
lines.push(yamlLine(undefined, "error", yamlString(f._0)));
|
|
47
|
+
return;
|
|
48
|
+
case "Stack" :
|
|
49
|
+
lines.push(yamlLine(undefined, "stack", yamlString(f._0)));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return lines.join("\n");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function emit(r) {
|
|
57
|
+
process.stdout.write("TAP version 14\n");
|
|
58
|
+
let s = `1..` + r.summary.total.toString();
|
|
59
|
+
process.stdout.write(s + "\n");
|
|
60
|
+
let index = {
|
|
61
|
+
contents: 0
|
|
62
|
+
};
|
|
63
|
+
r.files.forEach(f => {
|
|
64
|
+
process.stdout.write("\n");
|
|
65
|
+
process.stdout.write(`# ` + f.path + "\n");
|
|
66
|
+
f.tests.forEach(t => {
|
|
67
|
+
index.contents = index.contents + 1 | 0;
|
|
68
|
+
let n = index.contents;
|
|
69
|
+
let path = t.describePath.join(" > ");
|
|
70
|
+
let title = path === "" ? t.name : path + ` > ` + t.name;
|
|
71
|
+
let ms = ` # time=` + t.durationMs.toString() + `ms`;
|
|
72
|
+
let match = t.status;
|
|
73
|
+
switch (match) {
|
|
74
|
+
case "Pass" :
|
|
75
|
+
let s = `ok ` + n.toString() + ` - ` + title + ms;
|
|
76
|
+
return process.stdout.write(s + "\n");
|
|
77
|
+
case "Fail" :
|
|
78
|
+
let s$1 = `not ok ` + n.toString() + ` - ` + title + ms;
|
|
79
|
+
process.stdout.write(s$1 + "\n");
|
|
80
|
+
process.stdout.write(" ---\n");
|
|
81
|
+
let loc = t.location;
|
|
82
|
+
if (loc !== undefined) {
|
|
83
|
+
let s$2 = yamlLine(undefined, "location", `{ file: "` + loc.file + `", line: ` + loc.line.toString() + ` }`);
|
|
84
|
+
process.stdout.write(s$2 + "\n");
|
|
85
|
+
}
|
|
86
|
+
let m = t.mismatch;
|
|
87
|
+
if (m !== undefined) {
|
|
88
|
+
let s$3 = renderMismatchYaml(m);
|
|
89
|
+
process.stdout.write(s$3 + "\n");
|
|
90
|
+
}
|
|
91
|
+
let m$1 = t.mismatch;
|
|
92
|
+
if (m$1 !== undefined) {
|
|
93
|
+
let hint = Hint$ReventlessGwt.forMismatch(t.slice, m$1);
|
|
94
|
+
let s$4 = yamlLine(undefined, "hint", "");
|
|
95
|
+
process.stdout.write(s$4 + "\n");
|
|
96
|
+
let s$5 = yamlLine(4, "locus", yamlString(hint.locus));
|
|
97
|
+
process.stdout.write(s$5 + "\n");
|
|
98
|
+
let s$6 = yamlLine(4, "branch", yamlString(Stdlib_Option.getOr(hint.branch, "(none)")));
|
|
99
|
+
process.stdout.write(s$6 + "\n");
|
|
100
|
+
let s$7 = yamlLine(4, "message", yamlString(hint.message));
|
|
101
|
+
process.stdout.write(s$7 + "\n");
|
|
102
|
+
}
|
|
103
|
+
return process.stdout.write(" ...\n");
|
|
104
|
+
case "Skip" :
|
|
105
|
+
let reason = Stdlib_Option.getOr(t.skipReason, "skipped");
|
|
106
|
+
let s$8 = `ok ` + n.toString() + ` - ` + title + ` # SKIP ` + reason;
|
|
107
|
+
return process.stdout.write(s$8 + "\n");
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
process.stdout.write("\n");
|
|
112
|
+
let s$1 = `# tests ` + r.summary.total.toString();
|
|
113
|
+
process.stdout.write(s$1 + "\n");
|
|
114
|
+
let s$2 = `# pass ` + r.summary.passed.toString();
|
|
115
|
+
process.stdout.write(s$2 + "\n");
|
|
116
|
+
let s$3 = `# fail ` + r.summary.failed.toString();
|
|
117
|
+
process.stdout.write(s$3 + "\n");
|
|
118
|
+
let s$4 = `# skip ` + r.summary.skipped.toString();
|
|
119
|
+
process.stdout.write(s$4 + "\n");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export {
|
|
123
|
+
write,
|
|
124
|
+
writeLine,
|
|
125
|
+
escapeYamlString,
|
|
126
|
+
yamlString,
|
|
127
|
+
yamlLine,
|
|
128
|
+
renderMismatchYaml,
|
|
129
|
+
emit,
|
|
130
|
+
}
|
|
131
|
+
/* No side effect */
|