@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.
Files changed (184) hide show
  1. package/CHANGELOG.md +916 -0
  2. package/LICENSE +202 -0
  3. package/bin/reventless-dev.mjs +21 -0
  4. package/package.json +54 -0
  5. package/rescript.json +36 -0
  6. package/src/.gwtignore +10 -0
  7. package/src/Automation_GWT.res +207 -0
  8. package/src/Automation_GWT.res.mjs +160 -0
  9. package/src/Behavior_GWT.res +569 -0
  10. package/src/Behavior_GWT.res.mjs +523 -0
  11. package/src/Bind.res +29 -0
  12. package/src/Bind.res.mjs +22 -0
  13. package/src/BuildClassifier.res +147 -0
  14. package/src/BuildClassifier.res.mjs +136 -0
  15. package/src/Cancellation.res +37 -0
  16. package/src/Cancellation.res.mjs +46 -0
  17. package/src/ChildProcess.res +102 -0
  18. package/src/ChildProcess.res.mjs +107 -0
  19. package/src/Cli.res +905 -0
  20. package/src/Cli.res.mjs +952 -0
  21. package/src/Collector.res +212 -0
  22. package/src/Collector.res.mjs +218 -0
  23. package/src/ComponentMeta.res +77 -0
  24. package/src/ComponentMeta.res.mjs +91 -0
  25. package/src/ComponentScan.res +103 -0
  26. package/src/ComponentScan.res.mjs +105 -0
  27. package/src/Delegate_GWT.res +303 -0
  28. package/src/Delegate_GWT.res.mjs +372 -0
  29. package/src/Diff.res +91 -0
  30. package/src/Diff.res.mjs +98 -0
  31. package/src/Discovery.res +105 -0
  32. package/src/Discovery.res.mjs +99 -0
  33. package/src/DomainDeadCode.res +98 -0
  34. package/src/DomainDeadCode.res.mjs +72 -0
  35. package/src/DomainGraph.res +0 -0
  36. package/src/DomainGraph.res.mjs +0 -0
  37. package/src/EventMapping_GWT.res +29 -0
  38. package/src/EventMapping_GWT.res.mjs +44 -0
  39. package/src/Filter.res +45 -0
  40. package/src/Filter.res.mjs +47 -0
  41. package/src/Flow_GWT.res +664 -0
  42. package/src/Flow_GWT.res.mjs +604 -0
  43. package/src/FormatterHuman.res +109 -0
  44. package/src/FormatterHuman.res.mjs +115 -0
  45. package/src/FormatterJson.res +264 -0
  46. package/src/FormatterJson.res.mjs +322 -0
  47. package/src/FormatterJunit.res +93 -0
  48. package/src/FormatterJunit.res.mjs +90 -0
  49. package/src/FormatterTap.res +100 -0
  50. package/src/FormatterTap.res.mjs +131 -0
  51. package/src/FormatterVsCode.res +352 -0
  52. package/src/FormatterVsCode.res.mjs +546 -0
  53. package/src/Hint.res +119 -0
  54. package/src/Hint.res.mjs +124 -0
  55. package/src/InboundTranslation_GWT.res +83 -0
  56. package/src/InboundTranslation_GWT.res.mjs +94 -0
  57. package/src/JestBind.res +70 -0
  58. package/src/JestBind.res.mjs +63 -0
  59. package/src/Loader.res +24 -0
  60. package/src/Loader.res.mjs +23 -0
  61. package/src/LocalHost.res +119 -0
  62. package/src/LocalHost.res.mjs +99 -0
  63. package/src/Mapping_GWT.res +474 -0
  64. package/src/Mapping_GWT.res.mjs +322 -0
  65. package/src/MismatchRender.res +72 -0
  66. package/src/MismatchRender.res.mjs +127 -0
  67. package/src/MultiSourceProjection_GWT.res +316 -0
  68. package/src/MultiSourceProjection_GWT.res.mjs +354 -0
  69. package/src/OutboundTranslation_GWT.res +238 -0
  70. package/src/OutboundTranslation_GWT.res.mjs +186 -0
  71. package/src/Outcome.res +97 -0
  72. package/src/Outcome.res.mjs +93 -0
  73. package/src/PackageScan.res +80 -0
  74. package/src/PackageScan.res.mjs +81 -0
  75. package/src/PlatformRunner.res +181 -0
  76. package/src/PlatformRunner.res.mjs +176 -0
  77. package/src/PlatformScan.res +142 -0
  78. package/src/PlatformScan.res.mjs +132 -0
  79. package/src/ProcessManager.res +135 -0
  80. package/src/ProcessManager.res.mjs +119 -0
  81. package/src/Projection_GWT.res +312 -0
  82. package/src/Projection_GWT.res.mjs +332 -0
  83. package/src/Query_GWT.res +379 -0
  84. package/src/Query_GWT.res.mjs +367 -0
  85. package/src/RenderRescript.res +125 -0
  86. package/src/RenderRescript.res.mjs +141 -0
  87. package/src/RunWorker.res +24 -0
  88. package/src/RunWorker.res.mjs +16 -0
  89. package/src/RunnerTypes.res +68 -0
  90. package/src/RunnerTypes.res.mjs +60 -0
  91. package/src/SideEffect_GWT.res +157 -0
  92. package/src/SideEffect_GWT.res.mjs +113 -0
  93. package/src/StateChange/ExternalAddCategorySlice.res +25 -0
  94. package/src/StateChange/ExternalAddCategorySlice.res.mjs +34 -0
  95. package/src/StateChange/ExternalAddCategorySlice_Behavior.res +19 -0
  96. package/src/StateChange/ExternalAddCategorySlice_Behavior.res.mjs +46 -0
  97. package/src/StateChange/WithFixtures.res +22 -0
  98. package/src/StateChange/WithFixtures.res.mjs +31 -0
  99. package/src/StateChange/WithFixtures_Behavior.res +17 -0
  100. package/src/StateChange/WithFixtures_Behavior.res.mjs +37 -0
  101. package/src/StateChange/WithManualOpen.res +23 -0
  102. package/src/StateChange/WithManualOpen.res.mjs +31 -0
  103. package/src/StateChange/WithManualOpen_Behavior.res +17 -0
  104. package/src/StateChange/WithManualOpen_Behavior.res.mjs +37 -0
  105. package/src/StubRuntime.res +54 -0
  106. package/src/StubRuntime.res.mjs +55 -0
  107. package/src/TestFixtures.res +16 -0
  108. package/src/TestFixtures.res.mjs +34 -0
  109. package/src/Watch.res +108 -0
  110. package/src/Watch.res.mjs +85 -0
  111. package/src/WatcherProbe.res +56 -0
  112. package/src/WatcherProbe.res.mjs +59 -0
  113. package/src/Worker.res +24 -0
  114. package/src/Worker.res.mjs +9 -0
  115. package/tests/AutomationGwtTest.res +71 -0
  116. package/tests/AutomationGwtTest.res.mjs +189 -0
  117. package/tests/BuildClassifierTest.res +133 -0
  118. package/tests/BuildClassifierTest.res.mjs +176 -0
  119. package/tests/CliRunEntryTest.res +57 -0
  120. package/tests/CliRunEntryTest.res.mjs +65 -0
  121. package/tests/CliWatchScopeTest.res +62 -0
  122. package/tests/CliWatchScopeTest.res.mjs +95 -0
  123. package/tests/ComponentMetaTest.res +67 -0
  124. package/tests/ComponentMetaTest.res.mjs +71 -0
  125. package/tests/DelegateGwtTest.res +487 -0
  126. package/tests/DelegateGwtTest.res.mjs +891 -0
  127. package/tests/DiscoveryTest.res +42 -0
  128. package/tests/DiscoveryTest.res.mjs +43 -0
  129. package/tests/DomainDeadCodeTest.res +119 -0
  130. package/tests/DomainDeadCodeTest.res.mjs +158 -0
  131. package/tests/DomainGraphTest.res +448 -0
  132. package/tests/DomainGraphTest.res.mjs +505 -0
  133. package/tests/FlowAggregateGwtTest.res +171 -0
  134. package/tests/FlowAggregateGwtTest.res.mjs +273 -0
  135. package/tests/FlowCrossPluginGwtTest.res +340 -0
  136. package/tests/FlowCrossPluginGwtTest.res.mjs +798 -0
  137. package/tests/FlowGwtTest.res +222 -0
  138. package/tests/FlowGwtTest.res.mjs +433 -0
  139. package/tests/FormatterGoldenTest.res +125 -0
  140. package/tests/FormatterGoldenTest.res.mjs +162 -0
  141. package/tests/FormatterVsCodeMessageTest.res +41 -0
  142. package/tests/FormatterVsCodeMessageTest.res.mjs +42 -0
  143. package/tests/InboundTranslationGwtTest.res +34 -0
  144. package/tests/InboundTranslationGwtTest.res.mjs +99 -0
  145. package/tests/LocalHostIntegration.res +70 -0
  146. package/tests/LocalHostIntegration.res.mjs +64 -0
  147. package/tests/LocalHostTest.res +71 -0
  148. package/tests/LocalHostTest.res.mjs +63 -0
  149. package/tests/MappingGwtTest.res +350 -0
  150. package/tests/MappingGwtTest.res.mjs +596 -0
  151. package/tests/OutboundTranslationGwtTest.res +59 -0
  152. package/tests/OutboundTranslationGwtTest.res.mjs +139 -0
  153. package/tests/PlatformRunnerTest.res +66 -0
  154. package/tests/PlatformRunnerTest.res.mjs +85 -0
  155. package/tests/PlatformScanTest.res +61 -0
  156. package/tests/PlatformScanTest.res.mjs +56 -0
  157. package/tests/QueryGwtTest.res +161 -0
  158. package/tests/QueryGwtTest.res.mjs +314 -0
  159. package/tests/QueryResolverGwtTest.res +71 -0
  160. package/tests/QueryResolverGwtTest.res.mjs +136 -0
  161. package/tests/RunnerUnitTest.res +219 -0
  162. package/tests/RunnerUnitTest.res.mjs +244 -0
  163. package/tests/SideEffect/FakeOrderNotification.res +23 -0
  164. package/tests/SideEffect/FakeOrderNotification.res.mjs +36 -0
  165. package/tests/SideEffect/FakeOrderNotificationGwtTest.res +35 -0
  166. package/tests/SideEffect/FakeOrderNotificationGwtTest.res.mjs +73 -0
  167. package/tests/SideEffect/MockEmail.res +18 -0
  168. package/tests/SideEffect/MockEmail.res.mjs +47 -0
  169. package/tests/StateChange/ExternalAddCategorySlice_GWT.res +27 -0
  170. package/tests/StateChange/ExternalAddCategorySlice_GWT.res.mjs +70 -0
  171. package/tests/StateChange/WithFixtures_Fixtures.res +9 -0
  172. package/tests/StateChange/WithFixtures_Fixtures.res.mjs +20 -0
  173. package/tests/StateChange/WithFixtures_GWT.res +23 -0
  174. package/tests/StateChange/WithFixtures_GWT.res.mjs +56 -0
  175. package/tests/StateChange/WithManualOpen_Fixtures.res +7 -0
  176. package/tests/StateChange/WithManualOpen_Fixtures.res.mjs +20 -0
  177. package/tests/StateChange/WithManualOpen_GWT.res +17 -0
  178. package/tests/StateChange/WithManualOpen_GWT.res.mjs +56 -0
  179. package/tests/StateChangeSliceGwtTest.res +160 -0
  180. package/tests/StateChangeSliceGwtTest.res.mjs +280 -0
  181. package/tests/StateViewSliceGwtTest.res +64 -0
  182. package/tests/StateViewSliceGwtTest.res.mjs +161 -0
  183. package/tests/WatchDebounceTest.res +106 -0
  184. 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("&", "&amp;")
13
+ ->String.replaceAll("<", "&lt;")
14
+ ->String.replaceAll(">", "&gt;")
15
+ ->String.replaceAll("\"", "&quot;")
16
+ ->String.replaceAll("'", "&apos;")
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("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;");
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 */