tstyche 7.2.5 → 8.0.0-beta.0

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 (393) hide show
  1. package/README.md +4 -0
  2. package/dist/api.d.ts +16 -761
  3. package/dist/api.js +16 -6204
  4. package/dist/bin.js +2 -3
  5. package/dist/checker/BaseCheckerAdapter.d.ts +15 -0
  6. package/dist/checker/BaseCheckerAdapter.js +32 -0
  7. package/dist/checker/CompatCheckerAdapter.d.ts +70 -0
  8. package/dist/checker/CompatCheckerAdapter.js +221 -0
  9. package/dist/checker/NativeCheckerAdapter.d.ts +70 -0
  10. package/dist/checker/NativeCheckerAdapter.js +200 -0
  11. package/dist/checker/index.d.ts +3 -0
  12. package/dist/checker/index.js +2 -0
  13. package/dist/checker/types.d.ts +9 -0
  14. package/dist/checker/types.js +1 -0
  15. package/dist/cli/Cli.d.ts +5 -0
  16. package/dist/cli/Cli.js +144 -0
  17. package/dist/cli/CliDIagnosticText.d.ts +3 -0
  18. package/dist/cli/CliDIagnosticText.js +9 -0
  19. package/dist/cli/index.d.ts +1 -0
  20. package/dist/cli/index.js +1 -0
  21. package/dist/collect/CollectDiagnosticText.d.ts +3 -0
  22. package/dist/collect/CollectDiagnosticText.js +5 -0
  23. package/dist/collect/CollectService.d.ts +9 -0
  24. package/dist/collect/CollectService.js +150 -0
  25. package/dist/collect/ExpectNode.d.ts +16 -0
  26. package/dist/collect/ExpectNode.js +30 -0
  27. package/dist/collect/IdentifierLookup.d.ts +18 -0
  28. package/dist/collect/IdentifierLookup.js +90 -0
  29. package/dist/collect/TestTree.d.ts +16 -0
  30. package/dist/collect/TestTree.js +15 -0
  31. package/dist/collect/TestTreeNode.d.ts +15 -0
  32. package/dist/collect/TestTreeNode.js +27 -0
  33. package/dist/collect/TestTreeNodeBrand.enum.d.ts +6 -0
  34. package/dist/collect/TestTreeNodeBrand.enum.js +7 -0
  35. package/dist/collect/TestTreeNodeFlags.enum.d.ts +6 -0
  36. package/dist/collect/TestTreeNodeFlags.enum.js +7 -0
  37. package/dist/collect/index.d.ts +6 -0
  38. package/dist/collect/index.js +6 -0
  39. package/dist/config/CommandParser.d.ts +7 -0
  40. package/dist/config/CommandParser.js +107 -0
  41. package/dist/config/Config.d.ts +18 -0
  42. package/dist/config/Config.js +59 -0
  43. package/dist/config/ConfigDiagnosticText.d.ts +19 -0
  44. package/dist/config/ConfigDiagnosticText.js +57 -0
  45. package/dist/config/ConfigParser.d.ts +10 -0
  46. package/dist/config/ConfigParser.js +165 -0
  47. package/dist/config/Directive.d.ts +9 -0
  48. package/dist/config/Directive.js +119 -0
  49. package/dist/config/DirectiveDiagnosticText.d.ts +5 -0
  50. package/dist/config/DirectiveDiagnosticText.js +11 -0
  51. package/dist/config/OptionBrand.enum.d.ts +8 -0
  52. package/dist/config/OptionBrand.enum.js +9 -0
  53. package/dist/config/OptionGroup.enum.d.ts +5 -0
  54. package/dist/config/OptionGroup.enum.js +6 -0
  55. package/dist/config/Options.d.ts +29 -0
  56. package/dist/config/Options.js +290 -0
  57. package/dist/config/Target.d.ts +7 -0
  58. package/dist/config/Target.js +47 -0
  59. package/dist/config/defaultOptions.d.ts +2 -0
  60. package/dist/config/defaultOptions.js +14 -0
  61. package/dist/config/index.d.ts +8 -0
  62. package/dist/config/index.js +7 -0
  63. package/dist/config/types.d.ts +55 -0
  64. package/dist/config/types.js +1 -0
  65. package/dist/diagnostic/Diagnostic.d.ts +19 -0
  66. package/dist/diagnostic/Diagnostic.js +51 -0
  67. package/dist/diagnostic/DiagnosticCategory.enum.d.ts +4 -0
  68. package/dist/diagnostic/DiagnosticCategory.enum.js +5 -0
  69. package/dist/diagnostic/DiagnosticOrigin.d.ts +13 -0
  70. package/dist/diagnostic/DiagnosticOrigin.js +27 -0
  71. package/dist/diagnostic/helpers.d.ts +6 -0
  72. package/dist/diagnostic/helpers.js +74 -0
  73. package/dist/diagnostic/index.d.ts +5 -0
  74. package/dist/diagnostic/index.js +4 -0
  75. package/dist/diagnostic/types.d.ts +2 -0
  76. package/dist/diagnostic/types.js +1 -0
  77. package/dist/editor/TextEditor.d.ts +15 -0
  78. package/dist/editor/TextEditor.js +88 -0
  79. package/dist/editor/index.d.ts +2 -0
  80. package/dist/editor/index.js +1 -0
  81. package/dist/editor/types.d.ts +4 -0
  82. package/dist/editor/types.js +1 -0
  83. package/dist/environment/Environment.d.ts +5 -0
  84. package/dist/environment/Environment.js +89 -0
  85. package/dist/environment/environmentOptions.d.ts +1 -0
  86. package/dist/environment/environmentOptions.js +2 -0
  87. package/dist/environment/index.d.ts +2 -0
  88. package/dist/environment/index.js +1 -0
  89. package/dist/environment/types.d.ts +10 -0
  90. package/dist/environment/types.js +1 -0
  91. package/dist/events/EventEmitter.d.ts +14 -0
  92. package/dist/events/EventEmitter.js +42 -0
  93. package/dist/events/index.d.ts +2 -0
  94. package/dist/events/index.js +1 -0
  95. package/dist/events/types.d.ts +88 -0
  96. package/dist/events/types.js +1 -0
  97. package/dist/expect/AbilityMatcherBase.d.ts +16 -0
  98. package/dist/expect/AbilityMatcherBase.js +52 -0
  99. package/dist/expect/Ensure.d.ts +10 -0
  100. package/dist/expect/Ensure.js +51 -0
  101. package/dist/expect/ExpectDiagnosticText.d.ts +29 -0
  102. package/dist/expect/ExpectDiagnosticText.js +87 -0
  103. package/dist/expect/ExpectService.d.ts +21 -0
  104. package/dist/expect/ExpectService.js +90 -0
  105. package/dist/expect/RelationMatcherBase.d.ts +12 -0
  106. package/dist/expect/RelationMatcherBase.js +16 -0
  107. package/dist/expect/ToAcceptProps.d.ts +10 -0
  108. package/dist/expect/ToAcceptProps.js +52 -0
  109. package/dist/expect/ToBe.d.ts +13 -0
  110. package/dist/expect/ToBe.js +18 -0
  111. package/dist/expect/ToBeApplicable.d.ts +10 -0
  112. package/dist/expect/ToBeApplicable.js +72 -0
  113. package/dist/expect/ToBeAssignableFrom.d.ts +9 -0
  114. package/dist/expect/ToBeAssignableFrom.js +12 -0
  115. package/dist/expect/ToBeAssignableTo.d.ts +9 -0
  116. package/dist/expect/ToBeAssignableTo.js +12 -0
  117. package/dist/expect/ToBeCallableWith.d.ts +11 -0
  118. package/dist/expect/ToBeCallableWith.js +29 -0
  119. package/dist/expect/ToBeConstructableWith.d.ts +11 -0
  120. package/dist/expect/ToBeConstructableWith.js +29 -0
  121. package/dist/expect/ToBeInstantiableWith.d.ts +10 -0
  122. package/dist/expect/ToBeInstantiableWith.js +31 -0
  123. package/dist/expect/ToHaveProperty.d.ts +10 -0
  124. package/dist/expect/ToHaveProperty.js +59 -0
  125. package/dist/expect/ToRaiseError.d.ts +9 -0
  126. package/dist/expect/ToRaiseError.js +82 -0
  127. package/dist/expect/index.d.ts +2 -0
  128. package/dist/expect/index.js +1 -0
  129. package/dist/expect/types.d.ts +7 -0
  130. package/dist/expect/types.js +1 -0
  131. package/dist/file/FilePosition.d.ts +7 -0
  132. package/dist/file/FilePosition.js +16 -0
  133. package/dist/file/index.d.ts +1 -0
  134. package/dist/file/index.js +1 -0
  135. package/dist/glob/Braces.d.ts +4 -0
  136. package/dist/glob/Braces.js +56 -0
  137. package/dist/glob/Glob.d.ts +4 -0
  138. package/dist/glob/Glob.js +47 -0
  139. package/dist/glob/index.d.ts +1 -0
  140. package/dist/glob/index.js +1 -0
  141. package/dist/handlers/CancellationHandler.d.ts +7 -0
  142. package/dist/handlers/CancellationHandler.js +15 -0
  143. package/dist/handlers/ExitCodeHandler.d.ts +7 -0
  144. package/dist/handlers/ExitCodeHandler.js +20 -0
  145. package/dist/handlers/ResultHandler.d.ts +5 -0
  146. package/dist/handlers/ResultHandler.js +206 -0
  147. package/dist/handlers/index.d.ts +3 -0
  148. package/dist/handlers/index.js +3 -0
  149. package/dist/index.cjs +5 -5
  150. package/dist/index.d.cts +40 -45
  151. package/dist/index.d.ts +40 -45
  152. package/dist/index.js +1 -2
  153. package/dist/input/InputService.d.ts +6 -0
  154. package/dist/input/InputService.js +16 -0
  155. package/dist/input/index.d.ts +1 -0
  156. package/dist/input/index.js +1 -0
  157. package/dist/json/JsonNode.d.ts +11 -0
  158. package/dist/json/JsonNode.js +28 -0
  159. package/dist/json/JsonScanner.d.ts +14 -0
  160. package/dist/json/JsonScanner.js +105 -0
  161. package/dist/json/index.d.ts +3 -0
  162. package/dist/json/index.js +2 -0
  163. package/dist/json/types.d.ts +1 -0
  164. package/dist/json/types.js +1 -0
  165. package/dist/layers/AbilityLayer.d.ts +10 -0
  166. package/dist/layers/AbilityLayer.js +186 -0
  167. package/dist/layers/Layers.d.ts +11 -0
  168. package/dist/layers/Layers.js +47 -0
  169. package/dist/layers/SuppressedLayer.d.ts +11 -0
  170. package/dist/layers/SuppressedLayer.js +93 -0
  171. package/dist/layers/index.d.ts +2 -0
  172. package/dist/layers/index.js +1 -0
  173. package/dist/layers/types.d.ts +8 -0
  174. package/dist/layers/types.js +1 -0
  175. package/dist/output/CodeFrameText.d.ts +10 -0
  176. package/dist/output/CodeFrameText.js +71 -0
  177. package/dist/output/OutputService.d.ts +13 -0
  178. package/dist/output/OutputService.js +38 -0
  179. package/dist/output/StreamController.d.ts +10 -0
  180. package/dist/output/StreamController.js +16 -0
  181. package/dist/output/addsText.d.ts +4 -0
  182. package/dist/output/addsText.js +8 -0
  183. package/dist/output/describeNameText.d.ts +2 -0
  184. package/dist/output/describeNameText.js +5 -0
  185. package/dist/output/diagnosticText.d.ts +4 -0
  186. package/dist/output/diagnosticText.js +23 -0
  187. package/dist/output/dotText.d.ts +3 -0
  188. package/dist/output/dotText.js +11 -0
  189. package/dist/output/fileStatusText.d.ts +4 -0
  190. package/dist/output/fileStatusText.js +26 -0
  191. package/dist/output/formattedText.d.ts +2 -0
  192. package/dist/output/formattedText.js +19 -0
  193. package/dist/output/helpText.d.ts +3 -0
  194. package/dist/output/helpText.js +52 -0
  195. package/dist/output/helpers.d.ts +5 -0
  196. package/dist/output/helpers.js +23 -0
  197. package/dist/output/index.d.ts +16 -0
  198. package/dist/output/index.js +15 -0
  199. package/dist/output/prologueText.d.ts +2 -0
  200. package/dist/output/prologueText.js +5 -0
  201. package/dist/output/summaryText.d.ts +12 -0
  202. package/dist/output/summaryText.js +31 -0
  203. package/dist/output/testNameText.d.ts +3 -0
  204. package/dist/output/testNameText.js +24 -0
  205. package/dist/output/types.d.ts +5 -0
  206. package/dist/output/types.js +1 -0
  207. package/dist/output/usesText.d.ts +5 -0
  208. package/dist/output/usesText.js +22 -0
  209. package/dist/output/waitingForFileChangesText.d.ts +2 -0
  210. package/dist/output/waitingForFileChangesText.js +5 -0
  211. package/dist/output/watchUsageText.d.ts +2 -0
  212. package/dist/output/watchUsageText.js +12 -0
  213. package/dist/path/Path.d.ts +7 -0
  214. package/dist/path/Path.js +28 -0
  215. package/dist/path/index.d.ts +1 -0
  216. package/dist/path/index.js +1 -0
  217. package/dist/project/CompatMappedDiagnostic.d.ts +12 -0
  218. package/dist/project/CompatMappedDiagnostic.js +25 -0
  219. package/dist/project/CompatProjectService.d.ts +19 -0
  220. package/dist/project/CompatProjectService.js +188 -0
  221. package/dist/project/FileMapService.d.ts +6 -0
  222. package/dist/project/FileMapService.js +14 -0
  223. package/dist/project/NativeMappedDiagnostic.d.ts +14 -0
  224. package/dist/project/NativeMappedDiagnostic.js +29 -0
  225. package/dist/project/NativeProjectService.d.ts +21 -0
  226. package/dist/project/NativeProjectService.js +216 -0
  227. package/dist/project/ProjectConfigService.d.ts +8 -0
  228. package/dist/project/ProjectConfigService.js +73 -0
  229. package/dist/project/index.d.ts +3 -0
  230. package/dist/project/index.js +2 -0
  231. package/dist/project/types.d.ts +7 -0
  232. package/dist/project/types.js +1 -0
  233. package/dist/reject/Reject.d.ts +9 -0
  234. package/dist/reject/Reject.js +43 -0
  235. package/dist/reject/RejectDiagnosticText.d.ts +5 -0
  236. package/dist/reject/RejectDiagnosticText.js +16 -0
  237. package/dist/reject/helpers.d.ts +1 -0
  238. package/dist/reject/helpers.js +3 -0
  239. package/dist/reject/index.d.ts +1 -0
  240. package/dist/reject/index.js +1 -0
  241. package/dist/reporters/BaseReporter.d.ts +7 -0
  242. package/dist/reporters/BaseReporter.js +6 -0
  243. package/dist/reporters/DotReporter.d.ts +6 -0
  244. package/dist/reporters/DotReporter.js +51 -0
  245. package/dist/reporters/FileView.d.ts +13 -0
  246. package/dist/reporters/FileView.js +33 -0
  247. package/dist/reporters/ListReporter.d.ts +6 -0
  248. package/dist/reporters/ListReporter.js +125 -0
  249. package/dist/reporters/SetupReporter.d.ts +4 -0
  250. package/dist/reporters/SetupReporter.js +21 -0
  251. package/dist/reporters/SummaryReporter.d.ts +5 -0
  252. package/dist/reporters/SummaryReporter.js +19 -0
  253. package/dist/reporters/WatchReporter.d.ts +5 -0
  254. package/dist/reporters/WatchReporter.js +21 -0
  255. package/dist/reporters/index.d.ts +7 -0
  256. package/dist/reporters/index.js +6 -0
  257. package/dist/reporters/types.d.ts +5 -0
  258. package/dist/reporters/types.js +1 -0
  259. package/dist/result/DescribeResult.d.ts +9 -0
  260. package/dist/result/DescribeResult.js +11 -0
  261. package/dist/result/ExpectResult.d.ts +10 -0
  262. package/dist/result/ExpectResult.js +11 -0
  263. package/dist/result/FileResult.d.ts +15 -0
  264. package/dist/result/FileResult.js +13 -0
  265. package/dist/result/ProjectConfigKind.enum.d.ts +6 -0
  266. package/dist/result/ProjectConfigKind.enum.js +7 -0
  267. package/dist/result/ProjectResult.d.ts +8 -0
  268. package/dist/result/ProjectResult.js +9 -0
  269. package/dist/result/Result.d.ts +13 -0
  270. package/dist/result/Result.js +14 -0
  271. package/dist/result/ResultStatus.enum.d.ts +10 -0
  272. package/dist/result/ResultStatus.enum.js +11 -0
  273. package/dist/result/SuppressedResult.d.ts +5 -0
  274. package/dist/result/SuppressedResult.js +6 -0
  275. package/dist/result/TargetResult.d.ts +11 -0
  276. package/dist/result/TargetResult.js +12 -0
  277. package/dist/result/TestResult.d.ts +13 -0
  278. package/dist/result/TestResult.js +13 -0
  279. package/dist/result/helpers.d.ts +7 -0
  280. package/dist/result/helpers.js +21 -0
  281. package/dist/result/index.d.ts +11 -0
  282. package/dist/result/index.js +10 -0
  283. package/dist/result/types.d.ts +31 -0
  284. package/dist/result/types.js +1 -0
  285. package/dist/runner/FileRunner.d.ts +10 -0
  286. package/dist/runner/FileRunner.js +93 -0
  287. package/dist/runner/FixmeDiagnosticText.d.ts +4 -0
  288. package/dist/runner/FixmeDiagnosticText.js +8 -0
  289. package/dist/runner/FixmeService.d.ts +9 -0
  290. package/dist/runner/FixmeService.js +51 -0
  291. package/dist/runner/RunModeFlags.enum.d.ts +7 -0
  292. package/dist/runner/RunModeFlags.enum.js +8 -0
  293. package/dist/runner/Runner.d.ts +9 -0
  294. package/dist/runner/Runner.js +101 -0
  295. package/dist/runner/TestTreeWalker.d.ts +19 -0
  296. package/dist/runner/TestTreeWalker.js +169 -0
  297. package/dist/runner/index.d.ts +1 -0
  298. package/dist/runner/index.js +1 -0
  299. package/dist/scribbler/Color.enum.d.ts +10 -0
  300. package/dist/scribbler/Color.enum.js +11 -0
  301. package/dist/scribbler/Line.d.ts +9 -0
  302. package/dist/scribbler/Line.js +5 -0
  303. package/dist/scribbler/Scribbler.d.ts +10 -0
  304. package/dist/scribbler/Scribbler.js +53 -0
  305. package/dist/scribbler/Text.d.ts +9 -0
  306. package/dist/scribbler/Text.js +8 -0
  307. package/dist/scribbler/index.d.ts +5 -0
  308. package/dist/scribbler/index.js +4 -0
  309. package/dist/scribbler/jsxRuntime.d.ts +4 -0
  310. package/dist/scribbler/jsxRuntime.js +4 -0
  311. package/dist/scribbler/types.d.ts +19 -0
  312. package/dist/scribbler/types.js +1 -0
  313. package/dist/select/Select.d.ts +7 -0
  314. package/dist/select/Select.js +91 -0
  315. package/dist/select/SelectDiagnosticText.d.ts +6 -0
  316. package/dist/select/SelectDiagnosticText.js +24 -0
  317. package/dist/select/index.d.ts +2 -0
  318. package/dist/select/index.js +2 -0
  319. package/dist/store/Fetcher.d.ts +8 -0
  320. package/dist/store/Fetcher.js +52 -0
  321. package/dist/store/Lock.d.ts +5 -0
  322. package/dist/store/Lock.js +17 -0
  323. package/dist/store/LockService.d.ts +8 -0
  324. package/dist/store/LockService.js +36 -0
  325. package/dist/store/Manifest.d.ts +35 -0
  326. package/dist/store/Manifest.js +58 -0
  327. package/dist/store/ManifestService.d.ts +10 -0
  328. package/dist/store/ManifestService.js +129 -0
  329. package/dist/store/PackageService.d.ts +8 -0
  330. package/dist/store/PackageService.js +69 -0
  331. package/dist/store/Store.d.ts +12 -0
  332. package/dist/store/Store.js +103 -0
  333. package/dist/store/StoreDiagnosticText.d.ts +12 -0
  334. package/dist/store/StoreDiagnosticText.js +36 -0
  335. package/dist/store/TarReader.d.ts +9 -0
  336. package/dist/store/TarReader.js +56 -0
  337. package/dist/store/helpers.d.ts +1 -0
  338. package/dist/store/helpers.js +3 -0
  339. package/dist/store/index.d.ts +1 -0
  340. package/dist/store/index.js +1 -0
  341. package/dist/structure/ComparisonResult.enum.d.ts +5 -0
  342. package/dist/structure/ComparisonResult.enum.js +6 -0
  343. package/dist/structure/Structure.d.ts +24 -0
  344. package/dist/structure/Structure.js +481 -0
  345. package/dist/structure/index.d.ts +1 -0
  346. package/dist/structure/index.js +1 -0
  347. package/dist/suppressed/SuppressedDiagnosticText.d.ts +6 -0
  348. package/dist/suppressed/SuppressedDiagnosticText.js +18 -0
  349. package/dist/suppressed/SuppressedService.d.ts +5 -0
  350. package/dist/suppressed/SuppressedService.js +61 -0
  351. package/dist/suppressed/index.d.ts +1 -0
  352. package/dist/suppressed/index.js +1 -0
  353. package/dist/tag.d.ts +1 -3
  354. package/dist/tag.js +2 -5
  355. package/dist/text/TextFile.d.ts +11 -0
  356. package/dist/text/TextFile.js +41 -0
  357. package/dist/text/TextFileService.d.ts +10 -0
  358. package/dist/text/TextFileService.js +31 -0
  359. package/dist/text/index.d.ts +3 -0
  360. package/dist/text/index.js +2 -0
  361. package/dist/text/types.d.ts +5 -0
  362. package/dist/text/types.js +1 -0
  363. package/dist/token/CancellationReason.enum.d.ts +6 -0
  364. package/dist/token/CancellationReason.enum.js +7 -0
  365. package/dist/token/CancellationToken.d.ts +8 -0
  366. package/dist/token/CancellationToken.js +22 -0
  367. package/dist/token/index.d.ts +2 -0
  368. package/dist/token/index.js +2 -0
  369. package/dist/typescript/BaseAdapter.d.ts +36 -0
  370. package/dist/typescript/BaseAdapter.js +83 -0
  371. package/dist/typescript/CompatTypeScript.d.ts +21 -0
  372. package/dist/typescript/CompatTypeScript.js +37 -0
  373. package/dist/typescript/NativeTypeScript.d.ts +24 -0
  374. package/dist/typescript/NativeTypeScript.js +44 -0
  375. package/dist/typescript/index.d.ts +3 -0
  376. package/dist/typescript/index.js +2 -0
  377. package/dist/typescript/types.d.ts +69 -0
  378. package/dist/typescript/types.js +1 -0
  379. package/dist/version/Version.d.ts +6 -0
  380. package/dist/version/Version.js +30 -0
  381. package/dist/version/index.d.ts +1 -0
  382. package/dist/version/index.js +1 -0
  383. package/dist/watch/Debounce.d.ts +9 -0
  384. package/dist/watch/Debounce.js +27 -0
  385. package/dist/watch/FileWatcher.d.ts +5 -0
  386. package/dist/watch/FileWatcher.js +12 -0
  387. package/dist/watch/WatchService.d.ts +8 -0
  388. package/dist/watch/WatchService.js +96 -0
  389. package/dist/watch/Watcher.d.ts +10 -0
  390. package/dist/watch/Watcher.js +31 -0
  391. package/dist/watch/index.d.ts +3 -0
  392. package/dist/watch/index.js +3 -0
  393. package/package.json +9 -1
@@ -0,0 +1,216 @@
1
+ import { NativeCheckerAdapter } from "#checker";
2
+ import { Options } from "#config";
3
+ import { Diagnostic } from "#diagnostic";
4
+ import { EventEmitter } from "#events";
5
+ import { Path } from "#path";
6
+ import { Select } from "#select";
7
+ import { TextFileService } from "../text/TextFileService.js";
8
+ import { FileMapService } from "./FileMapService.js";
9
+ import { NativeMappedDiagnostic } from "./NativeMappedDiagnostic.js";
10
+ import { ProjectConfigService } from "./ProjectConfigService.js";
11
+ export class NativeProjectService {
12
+ #api;
13
+ #baseSnapshot;
14
+ #currentSnapshot;
15
+ #currentProject;
16
+ #currentSpecifier;
17
+ #declarationFileRegex = /\.d\.[cm]?ts$/;
18
+ #fileMap = new FileMapService();
19
+ #projectConfig;
20
+ #resolvedConfig;
21
+ #ts;
22
+ #tsconfigPath;
23
+ #tsconfigSyntheticPath;
24
+ constructor(ts, resolvedConfig) {
25
+ this.#ts = ts;
26
+ this.#resolvedConfig = resolvedConfig;
27
+ this.#api = ts.getApi();
28
+ this.#baseSnapshot = this.#api.createSnapshot();
29
+ this.#projectConfig = new ProjectConfigService(this.#api, resolvedConfig);
30
+ const id = Date.now().toString(36);
31
+ this.#tsconfigPath = Path.resolve(resolvedConfig.rootPath, `${id}.tsconfig.json`);
32
+ this.#tsconfigSyntheticPath = Path.resolve(resolvedConfig.rootPath, `${id}-synthetic.tsconfig.json`);
33
+ }
34
+ close() {
35
+ this.#currentProject?.dispose();
36
+ this.#currentProject = undefined;
37
+ this.#api.close();
38
+ }
39
+ closeFile() {
40
+ TextFileService.close();
41
+ }
42
+ getChecker() {
43
+ return new NativeCheckerAdapter(this.#ts, this.#currentProject.checker);
44
+ }
45
+ #getDefaultCompilerOptions() {
46
+ const options = {
47
+ allowJs: true,
48
+ checkJs: true,
49
+ allowImportingTsExtensions: true,
50
+ exactOptionalPropertyTypes: true,
51
+ jsx: "preserve",
52
+ module: "nodenext",
53
+ moduleResolution: "nodenext",
54
+ noEmit: true,
55
+ noUncheckedIndexedAccess: true,
56
+ noUncheckedSideEffectImports: true,
57
+ resolveJsonModule: true,
58
+ strict: true,
59
+ target: "esnext",
60
+ };
61
+ return options;
62
+ }
63
+ getMappedDiagnostic(sourceFile, diagnostic, offsets) {
64
+ return new NativeMappedDiagnostic(sourceFile, diagnostic, offsets);
65
+ }
66
+ getProgram() {
67
+ return this.#currentProject.program;
68
+ }
69
+ getSourceFile(filePath) {
70
+ return this.#currentProject.program.getSourceFile(filePath);
71
+ }
72
+ #getProjectFacts(filePath) {
73
+ let compilerOptions = this.#getDefaultCompilerOptions();
74
+ let kind = 1;
75
+ let specifier = "baseline";
76
+ switch (this.#resolvedConfig.tsconfig) {
77
+ case "baseline":
78
+ break;
79
+ case "findup":
80
+ {
81
+ const configPath = this.#projectConfig.findUp(filePath);
82
+ if (configPath != null) {
83
+ compilerOptions = {};
84
+ kind = 0;
85
+ specifier = configPath;
86
+ }
87
+ }
88
+ break;
89
+ default:
90
+ if (Options.isJsonString(this.#resolvedConfig.tsconfig)) {
91
+ if (this.#api
92
+ .parseJsonConfigFileContent(JSON.parse(this.#resolvedConfig.tsconfig), {
93
+ configFileName: this.#tsconfigSyntheticPath,
94
+ })
95
+ .fileNames.includes(filePath)) {
96
+ this.#fileMap.add(this.#tsconfigSyntheticPath, this.#resolvedConfig.tsconfig);
97
+ compilerOptions = {};
98
+ kind = 3;
99
+ specifier = this.#tsconfigSyntheticPath;
100
+ }
101
+ }
102
+ else if (this.#api.parseConfigFile(this.#resolvedConfig.tsconfig).fileNames.includes(filePath)) {
103
+ compilerOptions = {};
104
+ kind = 2;
105
+ specifier = this.#resolvedConfig.tsconfig;
106
+ }
107
+ }
108
+ if (kind !== 1 && specifier === this.#currentSpecifier && !this.#fileMap.hasChanged()) {
109
+ return { kind, project: this.#currentProject, specifier };
110
+ }
111
+ if (this.#resolvedConfig.checkDeclarationFiles) {
112
+ compilerOptions = { ...compilerOptions, skipLibCheck: false };
113
+ }
114
+ const tsconfigText = JSON.stringify({
115
+ extends: kind === 1 ? undefined : specifier,
116
+ compilerOptions,
117
+ include: kind === 1 ? [Path.relative(this.#resolvedConfig.rootPath, filePath)] : undefined,
118
+ });
119
+ this.#fileMap.add(this.#tsconfigPath, tsconfigText);
120
+ this.#currentSnapshot?.dispose();
121
+ this.#currentSnapshot = this.#baseSnapshot.update({
122
+ openProjects: [this.#tsconfigPath],
123
+ fileSystem: {
124
+ kind: "layer",
125
+ files: this.#fileMap.get(),
126
+ },
127
+ ensurePrograms: true,
128
+ });
129
+ const project = this.#currentSnapshot.getConfiguredProject(this.#tsconfigPath);
130
+ return { kind, project, specifier };
131
+ }
132
+ getSemanticDiagnostics(filePath) {
133
+ return this.#normalizeDiagnostics(this.#currentProject.program.getSemanticDiagnostics(filePath));
134
+ }
135
+ getSyntacticDiagnostics(filePath) {
136
+ return this.#normalizeDiagnostics(this.#currentProject.program.getSyntacticDiagnostics(filePath));
137
+ }
138
+ #normalizeDiagnostics(diagnostics) {
139
+ return diagnostics.map(function normalize(diagnostic) {
140
+ const { startPosition, endPosition, sourceLines, ...rest } = diagnostic;
141
+ return {
142
+ ...rest,
143
+ ...(diagnostic.messageChain && {
144
+ messageChain: diagnostic.messageChain.map((msg) => normalize(msg)),
145
+ }),
146
+ ...(diagnostic.relatedInformation && {
147
+ relatedInformation: diagnostic.relatedInformation.map((info) => normalize(info)),
148
+ }),
149
+ };
150
+ });
151
+ }
152
+ openFile(filePath, fileText) {
153
+ if (fileText != null) {
154
+ this.#fileMap.add(filePath, fileText);
155
+ }
156
+ const { kind, project, specifier } = this.#getProjectFacts(filePath);
157
+ TextFileService.open(project.program);
158
+ if (specifier !== this.#currentSpecifier) {
159
+ this.#currentSpecifier = specifier;
160
+ EventEmitter.dispatch([
161
+ "project:uses",
162
+ { compilerVersion: this.#ts.version, projectConfig: { kind, specifier } },
163
+ ]);
164
+ const configFileParsingDiagnostics = project.program.getConfigFileParsingDiagnostics();
165
+ if (configFileParsingDiagnostics.length > 0) {
166
+ EventEmitter.dispatch([
167
+ "project:error",
168
+ { diagnostics: Diagnostic.fromDiagnostics(configFileParsingDiagnostics) },
169
+ ]);
170
+ }
171
+ }
172
+ if (project === this.#currentProject) {
173
+ return;
174
+ }
175
+ this.#currentProject?.dispose();
176
+ this.#currentProject = project;
177
+ const filesToCheck = project.program.getSourceFileNames().filter((filePath) => {
178
+ const sourceFileMetadata = project.program.getSourceFileMetadata(filePath);
179
+ if (sourceFileMetadata.isFromExternalLibrary || sourceFileMetadata.isDefaultLibrary) {
180
+ return false;
181
+ }
182
+ if (this.#resolvedConfig.checkDeclarationFiles && this.#declarationFileRegex.test(filePath)) {
183
+ return true;
184
+ }
185
+ if (Select.isFixtureFile(filePath, this.#resolvedConfig)) {
186
+ return true;
187
+ }
188
+ return false;
189
+ });
190
+ const diagnostics = [
191
+ ...this.#normalizeDiagnostics(project.program.getProgramDiagnostics())
192
+ .map(({ fileName, ...rest }) => ({ ...rest, pos: -1, end: -1 })),
193
+ ...filesToCheck.flatMap((filePath) => [
194
+ ...this.#normalizeDiagnostics(project.program.getSyntacticDiagnostics(filePath)),
195
+ ...this.#normalizeDiagnostics(project.program.getSemanticDiagnostics(filePath)),
196
+ ...this.#normalizeDiagnostics(project.program.getDeclarationDiagnostics(filePath)),
197
+ ].sort((a, b) => a.pos - b.pos)),
198
+ ];
199
+ if (diagnostics.length > 0) {
200
+ EventEmitter.dispatch(["project:error", { diagnostics: Diagnostic.fromDiagnostics(diagnostics) }]);
201
+ }
202
+ }
203
+ openLayer(filePath, fileText) {
204
+ const snapshot = this.#currentSnapshot.update({
205
+ fileSystem: {
206
+ kind: "layer",
207
+ files: { [filePath]: fileText },
208
+ },
209
+ ensurePrograms: true,
210
+ });
211
+ const project = snapshot.getConfiguredProject(this.#tsconfigPath);
212
+ const diagnostics = project.program.getSemanticDiagnostics(filePath);
213
+ snapshot.dispose();
214
+ return diagnostics;
215
+ }
216
+ }
@@ -0,0 +1,8 @@
1
+ import type * as tsAst from "typescript/ast";
2
+ import type * as tsApi from "typescript/sync";
3
+ import type { ResolvedConfig } from "#config";
4
+ export declare class ProjectConfigService {
5
+ #private;
6
+ constructor(api: InstanceType<typeof tsApi.API>, resolvedConfig: ResolvedConfig);
7
+ findUp(filePath: tsAst.RootedFilePath, currentPath?: string): string | undefined;
8
+ }
@@ -0,0 +1,73 @@
1
+ import { existsSync } from "node:fs";
2
+ import { Path } from "#path";
3
+ export class ProjectConfigService {
4
+ #api;
5
+ #configCache = new Map();
6
+ #resolvedConfig;
7
+ constructor(api, resolvedConfig) {
8
+ this.#api = api;
9
+ this.#resolvedConfig = resolvedConfig;
10
+ }
11
+ findUp(filePath, currentPath = Path.dirname(filePath)) {
12
+ const configPath = this.#resolveConfigPath(filePath, currentPath);
13
+ if (configPath) {
14
+ return configPath;
15
+ }
16
+ if (currentPath === this.#resolvedConfig.rootPath) {
17
+ return;
18
+ }
19
+ return this.findUp(filePath, Path.dirname(currentPath));
20
+ }
21
+ #resolveConfigPath(filePath, currentPath) {
22
+ for (const configName of ["tsconfig.json", "jsconfig.json"]) {
23
+ const probePath = Path.join(currentPath, configName);
24
+ const config = this.#getParsedConfig(probePath);
25
+ if (!config) {
26
+ continue;
27
+ }
28
+ if (config.fileNames.includes(filePath)) {
29
+ return probePath;
30
+ }
31
+ const result = this.#resolveInProjectReferences(filePath, config, new Set());
32
+ if (result) {
33
+ return result;
34
+ }
35
+ }
36
+ return;
37
+ }
38
+ #getParsedConfig(filePath) {
39
+ filePath = filePath.endsWith("json") ? filePath : `${filePath}/tsconfig.json`;
40
+ let config = this.#configCache.get(filePath);
41
+ if (!config) {
42
+ if (!existsSync(filePath)) {
43
+ return;
44
+ }
45
+ config = this.#api.parseConfigFile(filePath);
46
+ this.#configCache.set(filePath, config);
47
+ }
48
+ return config;
49
+ }
50
+ #resolveInProjectReferences(filePath, config, visited) {
51
+ if (!config.projectReferences) {
52
+ return;
53
+ }
54
+ for (const projectReference of config.projectReferences) {
55
+ if (visited.has(projectReference.path)) {
56
+ continue;
57
+ }
58
+ const config = this.#getParsedConfig(projectReference.path);
59
+ if (!config) {
60
+ continue;
61
+ }
62
+ if (config.fileNames.includes(filePath)) {
63
+ return projectReference.path;
64
+ }
65
+ visited.add(projectReference.path);
66
+ const configPath = this.#resolveInProjectReferences(filePath, config, visited);
67
+ if (configPath) {
68
+ return configPath;
69
+ }
70
+ }
71
+ return;
72
+ }
73
+ }
@@ -0,0 +1,3 @@
1
+ export { CompatProjectService } from "./CompatProjectService.js";
2
+ export { NativeProjectService } from "./NativeProjectService.js";
3
+ export type { ProjectService } from "./types.js";
@@ -0,0 +1,2 @@
1
+ export { CompatProjectService } from "./CompatProjectService.js";
2
+ export { NativeProjectService } from "./NativeProjectService.js";
@@ -0,0 +1,7 @@
1
+ import type { CompatProjectService } from "./CompatProjectService.js";
2
+ import type { NativeProjectService } from "./NativeProjectService.js";
3
+ export interface FileSystem {
4
+ fileExists?: (path: string) => boolean | undefined;
5
+ readFile?: (path: string) => string | undefined;
6
+ }
7
+ export type ProjectService = CompatProjectService | NativeProjectService;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { Checker } from "#checker";
2
+ import type { ResolvedConfig } from "#config";
3
+ import { Diagnostic, type DiagnosticsHandler } from "#diagnostic";
4
+ import type * as ts from "#typescript";
5
+ export declare class Reject {
6
+ #private;
7
+ constructor(ts: ts.TypeScript, checker: Checker, resolvedConfig: ResolvedConfig);
8
+ argumentType(target: Array<ts.Expression | ts.TypeNode | undefined>, onDiagnostics: DiagnosticsHandler<Array<Diagnostic>>): boolean;
9
+ }
@@ -0,0 +1,43 @@
1
+ import { Diagnostic, DiagnosticOrigin } from "#diagnostic";
2
+ import { capitalize } from "./helpers.js";
3
+ import { RejectDiagnosticText } from "./RejectDiagnosticText.js";
4
+ export class Reject {
5
+ #checker;
6
+ #rejectedArgumentTypes = new Set();
7
+ #ts;
8
+ constructor(ts, checker, resolvedConfig) {
9
+ this.#ts = ts;
10
+ this.#checker = checker;
11
+ if (resolvedConfig.rejectAnyType) {
12
+ this.#rejectedArgumentTypes.add("any");
13
+ }
14
+ if (resolvedConfig.rejectNeverType) {
15
+ this.#rejectedArgumentTypes.add("never");
16
+ }
17
+ }
18
+ argumentType(target, onDiagnostics) {
19
+ for (const rejectedType of this.#rejectedArgumentTypes) {
20
+ const allowedKeyword = this.#ts.SyntaxKind[`${capitalize(rejectedType)}Keyword`];
21
+ if (target.some((node) => node?.kind === allowedKeyword)) {
22
+ continue;
23
+ }
24
+ for (const node of target) {
25
+ if (!node) {
26
+ continue;
27
+ }
28
+ if (this.#checker.getType(node).flags & this.#ts.TypeFlags[capitalize(rejectedType)]) {
29
+ const text = [
30
+ this.#ts.belongsToArgumentList(node)
31
+ ? RejectDiagnosticText.argumentCannotBeOfType(rejectedType)
32
+ : RejectDiagnosticText.typeArgumentCannotBeOfType(rejectedType),
33
+ ...RejectDiagnosticText.typeWasRejected(rejectedType),
34
+ ];
35
+ const origin = DiagnosticOrigin.fromNode(node);
36
+ onDiagnostics([Diagnostic.error(text, origin)]);
37
+ return true;
38
+ }
39
+ }
40
+ }
41
+ return false;
42
+ }
43
+ }
@@ -0,0 +1,5 @@
1
+ export declare class RejectDiagnosticText {
2
+ static argumentCannotBeOfType(typeText: string): string;
3
+ static typeArgumentCannotBeOfType(typeText: string): string;
4
+ static typeWasRejected(typeText: string): Array<string>;
5
+ }
@@ -0,0 +1,16 @@
1
+ import { capitalize } from "./helpers.js";
2
+ export class RejectDiagnosticText {
3
+ static argumentCannotBeOfType(typeText) {
4
+ return `The argument cannot be of the '${typeText}' type.`;
5
+ }
6
+ static typeArgumentCannotBeOfType(typeText) {
7
+ return `The type argument cannot be of the '${typeText}' type.`;
8
+ }
9
+ static typeWasRejected(typeText) {
10
+ const optionNameText = `reject${capitalize(typeText)}Type`;
11
+ return [
12
+ `The '${typeText}' type was rejected because the '${optionNameText}' option is enabled.`,
13
+ `If this check is necessary, pass '${typeText}' as the type argument explicitly.`,
14
+ ];
15
+ }
16
+ }
@@ -0,0 +1 @@
1
+ export declare function capitalize<const T extends string>(text: T): Capitalize<T>;
@@ -0,0 +1,3 @@
1
+ export function capitalize(text) {
2
+ return text.replace(/^./, text.charAt(0).toUpperCase());
3
+ }
@@ -0,0 +1 @@
1
+ export { Reject } from "./Reject.js";
@@ -0,0 +1 @@
1
+ export { Reject } from "./Reject.js";
@@ -0,0 +1,7 @@
1
+ import type { ResolvedConfig } from "#config";
2
+ import type { Reporter, ReporterEvent } from "./types.js";
3
+ export declare abstract class BaseReporter implements Reporter {
4
+ protected resolvedConfig: ResolvedConfig;
5
+ constructor(resolvedConfig: ResolvedConfig);
6
+ abstract on([event, payload]: ReporterEvent): void;
7
+ }
@@ -0,0 +1,6 @@
1
+ export class BaseReporter {
2
+ resolvedConfig;
3
+ constructor(resolvedConfig) {
4
+ this.resolvedConfig = resolvedConfig;
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ import { BaseReporter } from "./BaseReporter.js";
2
+ import type { ReporterEvent } from "./types.js";
3
+ export declare class DotReporter extends BaseReporter {
4
+ #private;
5
+ on([event, payload]: ReporterEvent): void;
6
+ }
@@ -0,0 +1,51 @@
1
+ import { environmentOptions } from "#environment";
2
+ import { addsText, diagnosticText, dotText, OutputService, usesText } from "#output";
3
+ import { BaseReporter } from "./BaseReporter.js";
4
+ export class DotReporter extends BaseReporter {
5
+ #diagnostics = [];
6
+ #hasReportedAdds = false;
7
+ on([event, payload]) {
8
+ switch (event) {
9
+ case "store:adds":
10
+ OutputService.writeMessage(addsText(payload.packageVersion, payload.packagePath, { short: true }));
11
+ this.#hasReportedAdds = true;
12
+ break;
13
+ case "store:error":
14
+ for (const diagnostic of payload.diagnostics) {
15
+ OutputService.writeError(diagnosticText(diagnostic));
16
+ }
17
+ break;
18
+ case "project:uses":
19
+ if (this.#hasReportedAdds) {
20
+ if (!environmentOptions.noInteractive) {
21
+ OutputService.eraseLastLine();
22
+ }
23
+ this.#hasReportedAdds = false;
24
+ }
25
+ if (this.resolvedConfig.target.length > 1) {
26
+ OutputService.writeMessage(usesText(payload.compilerVersion, payload.projectConfig, { short: true }));
27
+ }
28
+ break;
29
+ case "target:end":
30
+ OutputService.writeBlankLine(2);
31
+ for (const diagnostic of this.#diagnostics) {
32
+ OutputService.writeError(diagnosticText(diagnostic));
33
+ }
34
+ this.#diagnostics = [];
35
+ break;
36
+ case "file:end":
37
+ OutputService.writeMessage(dotText(payload.result.status));
38
+ break;
39
+ case "project:error":
40
+ case "file:error":
41
+ case "directive:error":
42
+ case "collect:error":
43
+ case "test:error":
44
+ case "suppressed:error":
45
+ case "expect:error":
46
+ case "expect:fail":
47
+ this.#diagnostics.push(...payload.diagnostics);
48
+ break;
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,13 @@
1
+ import type { ResultStatus, TestResultStatus } from "#result";
2
+ import type { ScribblerJsx } from "#scribbler";
3
+ export declare class FileView {
4
+ #private;
5
+ addMessage(message: ScribblerJsx.Element): void;
6
+ addTest(status: Exclude<TestResultStatus, ResultStatus.Runs>, name: string): void;
7
+ beginDescribe(name: string): void;
8
+ clear(): void;
9
+ endDescribe(): void;
10
+ getMessages(): Array<ScribblerJsx.Element>;
11
+ getView(): Array<ScribblerJsx.Element>;
12
+ hasErrors(): boolean;
13
+ }
@@ -0,0 +1,33 @@
1
+ import { describeNameText, testNameText } from "#output";
2
+ export class FileView {
3
+ #indent = 0;
4
+ #lines = [];
5
+ #messages = [];
6
+ addMessage(message) {
7
+ this.#messages.push(message);
8
+ }
9
+ addTest(status, name) {
10
+ this.#lines.push(testNameText(status, name, this.#indent));
11
+ }
12
+ beginDescribe(name) {
13
+ this.#lines.push(describeNameText(name, this.#indent));
14
+ this.#indent++;
15
+ }
16
+ clear() {
17
+ this.#indent = 0;
18
+ this.#lines = [];
19
+ this.#messages = [];
20
+ }
21
+ endDescribe() {
22
+ this.#indent--;
23
+ }
24
+ getMessages() {
25
+ return this.#messages;
26
+ }
27
+ getView() {
28
+ return this.#lines;
29
+ }
30
+ hasErrors() {
31
+ return this.#messages.length > 0;
32
+ }
33
+ }
@@ -0,0 +1,6 @@
1
+ import { BaseReporter } from "./BaseReporter.js";
2
+ import type { ReporterEvent } from "./types.js";
3
+ export declare class ListReporter extends BaseReporter {
4
+ #private;
5
+ on([event, payload]: ReporterEvent): void;
6
+ }
@@ -0,0 +1,125 @@
1
+ import { environmentOptions } from "#environment";
2
+ import { addsText, diagnosticText, fileStatusText, OutputService, usesText } from "#output";
3
+ import { BaseReporter } from "./BaseReporter.js";
4
+ import { FileView } from "./FileView.js";
5
+ export class ListReporter extends BaseReporter {
6
+ #fileCount = 0;
7
+ #fileView = new FileView();
8
+ #hasReportedAdds = false;
9
+ #hasReportedError = false;
10
+ #hasReportedUses = false;
11
+ #isVerbose = false;
12
+ on([event, payload]) {
13
+ switch (event) {
14
+ case "run:start":
15
+ this.#isVerbose =
16
+ this.resolvedConfig.verbose || (payload.result.files.length === 1 && this.resolvedConfig.watch !== true);
17
+ break;
18
+ case "store:adds":
19
+ OutputService.writeMessage(addsText(payload.packageVersion, payload.packagePath));
20
+ this.#hasReportedAdds = true;
21
+ break;
22
+ case "store:error":
23
+ for (const diagnostic of payload.diagnostics) {
24
+ OutputService.writeError(diagnosticText(diagnostic));
25
+ }
26
+ break;
27
+ case "target:start":
28
+ this.#fileCount = payload.result.files.length;
29
+ this.#hasReportedUses = false;
30
+ break;
31
+ case "project:uses":
32
+ if (this.#hasReportedUses && !(this.#hasReportedAdds || this.#hasReportedError)) {
33
+ OutputService.writeBlankLine();
34
+ }
35
+ OutputService.writeMessage(usesText(payload.compilerVersion, payload.projectConfig));
36
+ this.#hasReportedAdds = false;
37
+ this.#hasReportedUses = true;
38
+ break;
39
+ case "project:error":
40
+ for (const diagnostic of payload.diagnostics) {
41
+ OutputService.writeError(diagnosticText(diagnostic));
42
+ }
43
+ break;
44
+ case "file:start":
45
+ if (!environmentOptions.noInteractive) {
46
+ OutputService.writeMessage(fileStatusText(payload.result.status, payload.result.file));
47
+ }
48
+ this.#fileCount--;
49
+ this.#hasReportedError = false;
50
+ break;
51
+ case "file:error":
52
+ case "directive:error":
53
+ case "collect:error":
54
+ case "suppressed:error":
55
+ for (const diagnostic of payload.diagnostics) {
56
+ this.#fileView.addMessage(diagnosticText(diagnostic));
57
+ }
58
+ break;
59
+ case "file:end":
60
+ if (!environmentOptions.noInteractive) {
61
+ OutputService.eraseLastLine();
62
+ }
63
+ OutputService.writeMessage(fileStatusText(payload.result.status, payload.result.file));
64
+ OutputService.writeMessage(this.#fileView.getView());
65
+ if (this.#isVerbose || this.#fileCount === 0 || this.#fileView.hasErrors()) {
66
+ OutputService.writeBlankLine();
67
+ }
68
+ if (this.#fileView.hasErrors()) {
69
+ OutputService.writeError(this.#fileView.getMessages());
70
+ this.#hasReportedError = true;
71
+ }
72
+ this.#fileView.clear();
73
+ break;
74
+ case "describe:start":
75
+ if (this.#isVerbose) {
76
+ this.#fileView.beginDescribe(payload.result.describe.name);
77
+ }
78
+ break;
79
+ case "describe:end":
80
+ if (this.#isVerbose) {
81
+ this.#fileView.endDescribe();
82
+ }
83
+ break;
84
+ case "test:skip":
85
+ if (this.#isVerbose) {
86
+ this.#fileView.addTest("skipped", payload.result.test.name);
87
+ }
88
+ break;
89
+ case "test:fixme":
90
+ if (this.#isVerbose) {
91
+ this.#fileView.addTest("fixme", payload.result.test.name);
92
+ }
93
+ break;
94
+ case "test:todo":
95
+ if (this.#isVerbose) {
96
+ this.#fileView.addTest("todo", payload.result.test.name);
97
+ }
98
+ break;
99
+ case "test:error":
100
+ if (this.#isVerbose) {
101
+ this.#fileView.addTest("failed", payload.result.test.name);
102
+ }
103
+ for (const diagnostic of payload.diagnostics) {
104
+ this.#fileView.addMessage(diagnosticText(diagnostic));
105
+ }
106
+ break;
107
+ case "test:fail":
108
+ if (this.#isVerbose) {
109
+ this.#fileView.addTest("failed", payload.result.test.name);
110
+ }
111
+ break;
112
+ case "test:pass":
113
+ if (this.#isVerbose) {
114
+ this.#fileView.addTest("passed", payload.result.test.name);
115
+ }
116
+ break;
117
+ case "expect:error":
118
+ case "expect:fail":
119
+ for (const diagnostic of payload.diagnostics) {
120
+ this.#fileView.addMessage(diagnosticText(diagnostic));
121
+ }
122
+ break;
123
+ }
124
+ }
125
+ }