@sprucelabs/spruce-cli 15.4.10 → 16.0.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 (456) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/build/.spruce/errors/spruceCli/actionCancelled.schema.js.map +1 -1
  3. package/build/.spruce/errors/spruceCli/bootError.schema.js.map +1 -1
  4. package/build/.spruce/errors/spruceCli/buildFailed.schema.js.map +1 -1
  5. package/build/.spruce/errors/spruceCli/cacheNotEnabled.schema.js.map +1 -1
  6. package/build/.spruce/errors/spruceCli/commandAborted.schema.js.map +1 -1
  7. package/build/.spruce/errors/spruceCli/commandBlocked.schema.js.map +1 -1
  8. package/build/.spruce/errors/spruceCli/commandNotImplemented.schema.js.map +1 -1
  9. package/build/.spruce/errors/spruceCli/createAutoloaderFailed.schema.js.map +1 -1
  10. package/build/.spruce/errors/spruceCli/dependencyExists.schema.js.map +1 -1
  11. package/build/.spruce/errors/spruceCli/deployFailed.schema.js.map +1 -1
  12. package/build/.spruce/errors/spruceCli/directoryEmpty.schema.js.map +1 -1
  13. package/build/.spruce/errors/spruceCli/directoryNotSkill.schema.js.map +1 -1
  14. package/build/.spruce/errors/spruceCli/dockerNotStarted.schema.js.map +1 -1
  15. package/build/.spruce/errors/spruceCli/executingCommandFailed.schema.js.map +1 -1
  16. package/build/.spruce/errors/spruceCli/failedToImport.schema.js.map +1 -1
  17. package/build/.spruce/errors/spruceCli/featureNotInstalled.schema.js.map +1 -1
  18. package/build/.spruce/errors/spruceCli/fileExists.schema.js.map +1 -1
  19. package/build/.spruce/errors/spruceCli/generic.schema.js.map +1 -1
  20. package/build/.spruce/errors/spruceCli/invalidCommand.schema.js.map +1 -1
  21. package/build/.spruce/errors/spruceCli/invalidEventContract.schema.js.map +1 -1
  22. package/build/.spruce/errors/spruceCli/invalidFeatureCode.schema.js.map +1 -1
  23. package/build/.spruce/errors/spruceCli/invalidTestDirectory.schema.js.map +1 -1
  24. package/build/.spruce/errors/spruceCli/lintFailed.schema.js.map +1 -1
  25. package/build/.spruce/errors/spruceCli/mercuryResponseError.schema.js.map +1 -1
  26. package/build/.spruce/errors/spruceCli/missingDependencies.schema.js.map +1 -1
  27. package/build/.spruce/errors/spruceCli/missingDependenciesDependency.schema.js.map +1 -1
  28. package/build/.spruce/errors/spruceCli/noOrganizationsFound.schema.js.map +1 -1
  29. package/build/.spruce/errors/spruceCli/noSkillsRegistered.schema.js.map +1 -1
  30. package/build/.spruce/errors/spruceCli/notImplemented.schema.js.map +1 -1
  31. package/build/.spruce/errors/spruceCli/notLoggedIn.schema.js.map +1 -1
  32. package/build/.spruce/errors/spruceCli/schemaExists.schema.js.map +1 -1
  33. package/build/.spruce/errors/spruceCli/schemaFailedToImport.schema.js.map +1 -1
  34. package/build/.spruce/errors/spruceCli/schemaTemplateItemBuildingFailed.schema.js.map +1 -1
  35. package/build/.spruce/errors/spruceCli/skillNotFound.schema.js.map +1 -1
  36. package/build/.spruce/errors/spruceCli/skillNotRegistered.schema.js.map +1 -1
  37. package/build/.spruce/errors/spruceCli/skillViewExists.schema.js.map +1 -1
  38. package/build/.spruce/errors/spruceCli/storeExists.schema.js.map +1 -1
  39. package/build/.spruce/errors/spruceCli/testFailed.schema.js.map +1 -1
  40. package/build/.spruce/errors/spruceCli/themeExists.schema.js.map +1 -1
  41. package/build/.spruce/errors/spruceCli/transportAlreadyExists.schema.js.map +1 -1
  42. package/build/.spruce/errors/spruceCli/vscodeNotInstalled.schema.js.map +1 -1
  43. package/build/.spruce/events/heartwood/didRegisterSkillViews.v2021_02_11.contract.js.map +1 -1
  44. package/build/.spruce/events/heartwood/generateUrl.v2021_02_11.contract.js.map +1 -1
  45. package/build/.spruce/events/heartwood/getSkillViews.v2021_02_11.contract.js.map +1 -1
  46. package/build/.spruce/events/heartwood/listViews.v2021_02_11.contract.js.map +1 -1
  47. package/build/.spruce/events/heartwood/registerSkillViews.v2021_02_11.contract.js.map +1 -1
  48. package/build/.spruce/schemas/heartwood/v2021_02_11/didRegisterSkillViewsEmitPayload.schema.js.map +1 -1
  49. package/build/.spruce/schemas/heartwood/v2021_02_11/didRegisterSkillViewsEmitTarget.schema.js.map +1 -1
  50. package/build/.spruce/schemas/heartwood/v2021_02_11/didRegisterSkillViewsEmitTargetAndPayload.schema.js.map +1 -1
  51. package/build/.spruce/schemas/heartwood/v2021_02_11/generateUrlEmitPayload.schema.js.map +1 -1
  52. package/build/.spruce/schemas/heartwood/v2021_02_11/generateUrlEmitTarget.schema.js.map +1 -1
  53. package/build/.spruce/schemas/heartwood/v2021_02_11/generateUrlEmitTargetAndPayload.schema.js.map +1 -1
  54. package/build/.spruce/schemas/heartwood/v2021_02_11/generateUrlResponsePayload.schema.js.map +1 -1
  55. package/build/.spruce/schemas/heartwood/v2021_02_11/getSkillViewsEmitTargetAndPayload.schema.js.map +1 -1
  56. package/build/.spruce/schemas/heartwood/v2021_02_11/getSkillViewsResponsePayload.schema.js.map +1 -1
  57. package/build/.spruce/schemas/heartwood/v2021_02_11/getViewControllersEmitTarget.schema.js.map +1 -1
  58. package/build/.spruce/schemas/heartwood/v2021_02_11/listViewsResponsePayload.schema.js.map +1 -1
  59. package/build/.spruce/schemas/heartwood/v2021_02_11/listViewsResult.schema.js.map +1 -1
  60. package/build/.spruce/schemas/heartwood/v2021_02_11/registerSkillViewsEmitPayload.schema.js.map +1 -1
  61. package/build/.spruce/schemas/heartwood/v2021_02_11/registerSkillViewsEmitTargetAndPayload.schema.js.map +1 -1
  62. package/build/.spruce/schemas/heartwood/v2021_02_11/registerSkillViewsResponsePayload.schema.js.map +1 -1
  63. package/build/.spruce/schemas/spruceCli/v2020_07_22/bootSkillOptions.schema.js.map +1 -1
  64. package/build/.spruce/schemas/spruceCli/v2020_07_22/createConversationTopicOptions.schema.js.map +1 -1
  65. package/build/.spruce/schemas/spruceCli/v2020_07_22/createErrorOptions.schema.js.map +1 -1
  66. package/build/.spruce/schemas/spruceCli/v2020_07_22/createOrganizationOptions.schema.js.map +1 -1
  67. package/build/.spruce/schemas/spruceCli/v2020_07_22/createSchemaOptions.schema.js.map +1 -1
  68. package/build/.spruce/schemas/spruceCli/v2020_07_22/createTestOptions.schema.js.map +1 -1
  69. package/build/.spruce/schemas/spruceCli/v2020_07_22/generatedDir.schema.js.map +1 -1
  70. package/build/.spruce/schemas/spruceCli/v2020_07_22/generatedFile.schema.js.map +1 -1
  71. package/build/.spruce/schemas/spruceCli/v2020_07_22/installSkillAtOrganizationOptions.schema.js.map +1 -1
  72. package/build/.spruce/schemas/spruceCli/v2020_07_22/listenEventOptions.schema.js.map +1 -1
  73. package/build/.spruce/schemas/spruceCli/v2020_07_22/namedTemplateItem.schema.js.map +1 -1
  74. package/build/.spruce/schemas/spruceCli/v2020_07_22/nodeFeatureOptions.schema.js.map +1 -1
  75. package/build/.spruce/schemas/spruceCli/v2020_07_22/onboardOptions.schema.js.map +1 -1
  76. package/build/.spruce/schemas/spruceCli/v2020_07_22/onboarding.schema.js.map +1 -1
  77. package/build/.spruce/schemas/spruceCli/v2020_07_22/personWithToken.schema.js.map +1 -1
  78. package/build/.spruce/schemas/spruceCli/v2020_07_22/registerDashboardWidgetsEmitPayloadSchema.schema.js.map +1 -1
  79. package/build/.spruce/schemas/spruceCli/v2020_07_22/setupTestsOptions.schema.js.map +1 -1
  80. package/build/.spruce/schemas/spruceCli/v2020_07_22/setupVscodeOptions.schema.js.map +1 -1
  81. package/build/.spruce/schemas/spruceCli/v2020_07_22/skillFeature.schema.js.map +1 -1
  82. package/build/.spruce/schemas/spruceCli/v2020_07_22/syncErrorOptions.schema.js.map +1 -1
  83. package/build/.spruce/schemas/spruceCli/v2020_07_22/syncEventOptions.schema.js.map +1 -1
  84. package/build/.spruce/schemas/spruceCli/v2020_07_22/syncSchemaFieldsOptions.schema.js.map +1 -1
  85. package/build/.spruce/schemas/spruceCli/v2020_07_22/syncSchemasOptions.schema.js.map +1 -1
  86. package/build/.spruce/schemas/spruceCli/v2020_07_22/testOptions.schema.js.map +1 -1
  87. package/build/.spruce/schemas/spruceCli/v2020_07_22/upgradeSkillOptions.schema.js.map +1 -1
  88. package/build/.spruce/schemas/spruceCli/v2020_07_22/watcherDidDetectChangesEmitPayload.schema.js.map +1 -1
  89. package/build/GlobalEmitter.js.map +1 -1
  90. package/build/__tests__/behavioral/AddingADependency.test.js.map +1 -1
  91. package/build/__tests__/behavioral/BlockingCommands.test.js.map +1 -1
  92. package/build/__tests__/behavioral/BootingTheCli.test.js.map +1 -1
  93. package/build/__tests__/behavioral/BootingWithBadFiles.test.js.map +1 -1
  94. package/build/__tests__/behavioral/CreatingAConversationTopic.test.js.map +1 -1
  95. package/build/__tests__/behavioral/CreatingSchemasWithGenerics.test.js.map +1 -1
  96. package/build/__tests__/behavioral/DeployingASkill.test.js.map +1 -1
  97. package/build/__tests__/behavioral/DeployingToSandbox.test.js.map +1 -1
  98. package/build/__tests__/behavioral/EnablingAndDisablingCache.test.js.map +1 -1
  99. package/build/__tests__/behavioral/GettingCliVersion.test.js.map +1 -1
  100. package/build/__tests__/behavioral/InstallingASkillAtAnOrg.test.js.map +1 -1
  101. package/build/__tests__/behavioral/ListeningToCoreEvents.test.js.map +1 -1
  102. package/build/__tests__/behavioral/LoggingInAsASkill.test.js.map +1 -1
  103. package/build/__tests__/behavioral/ManagingDependencies.test.js.map +1 -1
  104. package/build/__tests__/behavioral/OverridingCommandsInPackageJson.test.js.map +1 -1
  105. package/build/__tests__/behavioral/RebuildingASkill.test.js.map +1 -1
  106. package/build/__tests__/behavioral/RegisteringConversationsOnBoot.test.js.map +1 -1
  107. package/build/__tests__/behavioral/RegisteringEventsOnBoot.test.js.map +1 -1
  108. package/build/__tests__/behavioral/RegisteringGlobalEvents.test.js.map +1 -1
  109. package/build/__tests__/behavioral/RegisteringSkillViewOnBoot.test.js.map +1 -1
  110. package/build/__tests__/behavioral/RememberingUpgradeSelections.test.js.map +1 -1
  111. package/build/__tests__/behavioral/SettingLogTransportsInASkill.test.js.map +1 -1
  112. package/build/__tests__/behavioral/SettingRemote.test.js.map +1 -1
  113. package/build/__tests__/behavioral/SettingUpASkillForTesting.test.js.map +1 -1
  114. package/build/__tests__/behavioral/SettingUpSchemasForModuleDistribution.test.js.map +1 -1
  115. package/build/__tests__/behavioral/SettingUpVscode.test.js.map +1 -1
  116. package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.js.map +1 -1
  117. package/build/__tests__/behavioral/TestReporterSettingsRemembered.test.js.map +1 -1
  118. package/build/__tests__/behavioral/TestingAConversation.test.js.map +1 -1
  119. package/build/__tests__/behavioral/TestingDataStores.test.js.map +1 -1
  120. package/build/__tests__/behavioral/WatchingSkillViews.test.js.map +1 -1
  121. package/build/__tests__/behavioral/errors/CreatingANewErrorBuilder.test.js.map +1 -1
  122. package/build/__tests__/behavioral/errors/KeepingErrorClassInSync.test.js.map +1 -1
  123. package/build/__tests__/behavioral/errors/KeepingErrorsInSync.test.js.map +1 -1
  124. package/build/__tests__/behavioral/errors/SettingUpErrors.test.js.map +1 -1
  125. package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js.map +1 -1
  126. package/build/__tests__/behavioral/events/CreatingAListener.test.js.map +1 -1
  127. package/build/__tests__/behavioral/events/CreatingAnEvent.test.js.map +1 -1
  128. package/build/__tests__/behavioral/events/KeepingEventsInSync.test.js.map +1 -1
  129. package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js.map +1 -1
  130. package/build/__tests__/behavioral/events/KeepingListenersInSync.test.js.map +1 -1
  131. package/build/__tests__/behavioral/events/ListeningToAnEventYouCreate.test.js.map +1 -1
  132. package/build/__tests__/behavioral/events/SettingUpEvents.test.js.map +1 -1
  133. package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.js.map +1 -1
  134. package/build/__tests__/behavioral/node/CreatingANodeModule.test.js.map +1 -1
  135. package/build/__tests__/behavioral/onboard/StartingOnboarding.test.js.map +1 -1
  136. package/build/__tests__/behavioral/organization/CreatingAnOrg.test.js.map +1 -1
  137. package/build/__tests__/behavioral/person/LoggingInAsPerson.test.js.map +1 -1
  138. package/build/__tests__/behavioral/person/SeeWhoIsLoggedIn.test.js.map +1 -1
  139. package/build/__tests__/behavioral/schemas/CreatingANewSchemaBuilder.test.js.map +1 -1
  140. package/build/__tests__/behavioral/schemas/GeneratingFieldTypesOnly.test.js.map +1 -1
  141. package/build/__tests__/behavioral/schemas/GettingSchemasFromHealthCheck.test.js.map +1 -1
  142. package/build/__tests__/behavioral/schemas/HandlesRelatedSchemas.test.js.map +1 -1
  143. package/build/__tests__/behavioral/schemas/ImportingSchemaImports.test.js.map +1 -1
  144. package/build/__tests__/behavioral/schemas/KeepingSchemasInSync.test.js.map +1 -1
  145. package/build/__tests__/behavioral/schemas/SettingUpSchemas.test.js.map +1 -1
  146. package/build/__tests__/behavioral/schemas/SyncingBadSchemasProvidesHelpfulErrorMessages.test.js.map +1 -1
  147. package/build/__tests__/behavioral/schemas/UsingSchemasInCli.test.js.map +1 -1
  148. package/build/__tests__/behavioral/skill/BootingASkill.test.js.map +1 -1
  149. package/build/__tests__/behavioral/skill/CreatingASkill.test.js.map +1 -1
  150. package/build/__tests__/behavioral/skill/RegisteringASkill.test.js.map +1 -1
  151. package/build/__tests__/behavioral/skill/SettingUpASkill.test.js.map +1 -1
  152. package/build/__tests__/behavioral/stores/CreatingADataStore.test.js.map +1 -1
  153. package/build/__tests__/behavioral/stores/KeepingDataStoresInSync.test.js.map +1 -1
  154. package/build/__tests__/behavioral/tests/CreatingATest.test.js +3 -3
  155. package/build/__tests__/behavioral/tests/CreatingATest.test.js.map +1 -1
  156. package/build/__tests__/behavioral/tests/RunningTests.test.js.map +1 -1
  157. package/build/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.js.map +1 -1
  158. package/build/__tests__/behavioral/tests/SettingUpTests.test.js.map +1 -1
  159. package/build/__tests__/behavioral/upgrading/UpdatingDependencies.test.js.map +1 -1
  160. package/build/__tests__/behavioral/upgrading/UpdatingDependencies2.test.js.map +1 -1
  161. package/build/__tests__/behavioral/upgrading/UpgradingANodeModule.test.js.map +1 -1
  162. package/build/__tests__/behavioral/upgrading/UpgradingASkill.test.js.map +1 -1
  163. package/build/__tests__/behavioral/upgrading/UpgradingASkill2.test.js.map +1 -1
  164. package/build/__tests__/behavioral/upgrading/UpgradingASkill3.test.js.map +1 -1
  165. package/build/__tests__/behavioral/upgrading/UpgradingASkill4.test.js.map +1 -1
  166. package/build/__tests__/behavioral/upgrading/UpgradingASkill5.test.js.map +1 -1
  167. package/build/__tests__/behavioral/upgrading/UpgradingWithListeners.test.js.map +1 -1
  168. package/build/__tests__/behavioral/upgrading/UpgradingWithSandboxFeatureInstalled.test.js.map +1 -1
  169. package/build/__tests__/behavioral/views/CreatingASkillView.test.js +1 -1
  170. package/build/__tests__/behavioral/views/CreatingASkillView.test.js.map +1 -1
  171. package/build/__tests__/behavioral/views/CreatingATheme.test.js.map +1 -1
  172. package/build/__tests__/behavioral/views/KeepingViewsInSync.test.js.map +1 -1
  173. package/build/__tests__/behavioral/views/SettingUpViews.test.js.map +1 -1
  174. package/build/__tests__/behavioral/views/TestingViewControllers.test.js.map +1 -1
  175. package/build/__tests__/behavioral/watchers/WatchingForChanges.test.js.map +1 -1
  176. package/build/__tests__/implementation/ActionExecuter.test.js.map +1 -1
  177. package/build/__tests__/implementation/ActionExecuter2.test.js.map +1 -1
  178. package/build/__tests__/implementation/ActionExecuter3.test.js.map +1 -1
  179. package/build/__tests__/implementation/ActionExecuter4.test.js.map +1 -1
  180. package/build/__tests__/implementation/ArgParser.test.js.map +1 -1
  181. package/build/__tests__/implementation/BuildService.test.js.map +1 -1
  182. package/build/__tests__/implementation/BulkImporting.test.js.map +1 -1
  183. package/build/__tests__/implementation/CachingImports.test.js.map +1 -1
  184. package/build/__tests__/implementation/CommandOptionBuilder.test.js.map +1 -1
  185. package/build/__tests__/implementation/CommanderCommandResultMapper.test.js.map +1 -1
  186. package/build/__tests__/implementation/DataStoreStore.test.js.map +1 -1
  187. package/build/__tests__/implementation/DeletingOrphanedSchemaDefinitions.test.js.map +1 -1
  188. package/build/__tests__/implementation/EventContractCleanerUtil.test.js.map +1 -1
  189. package/build/__tests__/implementation/EventStore.test.js.map +1 -1
  190. package/build/__tests__/implementation/EventTemplateItemBuilder.test.js.map +1 -1
  191. package/build/__tests__/implementation/FeatureCommandAttacher.test.js.map +1 -1
  192. package/build/__tests__/implementation/FeatureFixture.test.js.map +1 -1
  193. package/build/__tests__/implementation/FeatureInstaller.test.js.map +1 -1
  194. package/build/__tests__/implementation/FeaturesUtil.test.js.map +1 -1
  195. package/build/__tests__/implementation/FieldTemplateItemBuilder.test.js.map +1 -1
  196. package/build/__tests__/implementation/GlobalEmitter.js.map +1 -1
  197. package/build/__tests__/implementation/Introspection.test.js.map +1 -1
  198. package/build/__tests__/implementation/JestJsonParser.test.js.map +1 -1
  199. package/build/__tests__/implementation/LintService.test.js.map +1 -1
  200. package/build/__tests__/implementation/ListenerStore.test.js.map +1 -1
  201. package/build/__tests__/implementation/OnboardingScriptLoader.test.js.map +1 -1
  202. package/build/__tests__/implementation/OnboardingScriptPlayer.test.js.map +1 -1
  203. package/build/__tests__/implementation/OnboardingStore.test.js.map +1 -1
  204. package/build/__tests__/implementation/OrganizationStore.test.js.map +1 -1
  205. package/build/__tests__/implementation/ParentTestFinder.test.js.map +1 -1
  206. package/build/__tests__/implementation/PkgService.test.js.map +1 -1
  207. package/build/__tests__/implementation/SchemaStore.test.js.map +1 -1
  208. package/build/__tests__/implementation/SchemaTemplateItemBuilder.test.js.map +1 -1
  209. package/build/__tests__/implementation/SchemaValueTypeWriter.test.js.map +1 -1
  210. package/build/__tests__/implementation/ServiceFactory.test.js.map +1 -1
  211. package/build/__tests__/implementation/SettingUpANodeModule.test.js.map +1 -1
  212. package/build/__tests__/implementation/SkillStore.test.js.map +1 -1
  213. package/build/__tests__/implementation/StoreFeature.test.js.map +1 -1
  214. package/build/__tests__/implementation/TestReporter.test.js.map +1 -1
  215. package/build/__tests__/implementation/TestRunner.test.js.map +1 -1
  216. package/build/__tests__/implementation/ValueTypeMapping.test.js.map +1 -1
  217. package/build/__tests__/implementation/Widgets.test.js.map +1 -1
  218. package/build/__tests__/support/scripts/first.script.js.map +1 -1
  219. package/build/addons/filePrompt.addon.js.map +1 -1
  220. package/build/cli.js.map +1 -1
  221. package/build/components/FormComponent.js.map +1 -1
  222. package/build/components/QuizComponent.js.map +1 -1
  223. package/build/errors/SpruceError.js.map +1 -1
  224. package/build/errors/actionCancelled.builder.js.map +1 -1
  225. package/build/errors/bootError.builder.js.map +1 -1
  226. package/build/errors/buildFailed.builder.js.map +1 -1
  227. package/build/errors/cacheNotEnabled.builder.js.map +1 -1
  228. package/build/errors/commandAborted.builder.js.map +1 -1
  229. package/build/errors/commandBlocked.builder.js.map +1 -1
  230. package/build/errors/commandNotImplemented.builder.js.map +1 -1
  231. package/build/errors/createAutoloaderFailed.builder.js.map +1 -1
  232. package/build/errors/dependencyExists.builder.js.map +1 -1
  233. package/build/errors/deployFailed.builder.js.map +1 -1
  234. package/build/errors/directoryEmpty.builder.js.map +1 -1
  235. package/build/errors/directoryNotSkill.builder.js.map +1 -1
  236. package/build/errors/dockerNotStarted.builder.js.map +1 -1
  237. package/build/errors/executingCommandFailed.builder.js.map +1 -1
  238. package/build/errors/failedToImport.builder.js.map +1 -1
  239. package/build/errors/featureNotInstalled.builder.js.map +1 -1
  240. package/build/errors/fileExists.builder.js.map +1 -1
  241. package/build/errors/generic.builder.js.map +1 -1
  242. package/build/errors/invalidCommand.builder.js.map +1 -1
  243. package/build/errors/invalidEventContract.builder.js.map +1 -1
  244. package/build/errors/invalidFeatureCode.builder.js.map +1 -1
  245. package/build/errors/invalidTestDirectory.builder.js.map +1 -1
  246. package/build/errors/lintFailed.builder.js.map +1 -1
  247. package/build/errors/mercuryResponseError.builder.js.map +1 -1
  248. package/build/errors/missingDependencies.builder.js.map +1 -1
  249. package/build/errors/noOrganizationsFound.builder.js.map +1 -1
  250. package/build/errors/noSkillsRegistered.builder.js.map +1 -1
  251. package/build/errors/notImplemented.builder.js.map +1 -1
  252. package/build/errors/notLoggedIn.builder.js.map +1 -1
  253. package/build/errors/schemaExists.builder.js.map +1 -1
  254. package/build/errors/schemaFailedToImport.builder.js.map +1 -1
  255. package/build/errors/schemaTemplateItemBuildingFailed.builder.js.map +1 -1
  256. package/build/errors/skillNotFound.builder.js.map +1 -1
  257. package/build/errors/skillNotRegistered.builder.js.map +1 -1
  258. package/build/errors/skillViewExists.builder.js.map +1 -1
  259. package/build/errors/storeExists.builder.js.map +1 -1
  260. package/build/errors/testFailed.builder.js.map +1 -1
  261. package/build/errors/themeExists.builder.js.map +1 -1
  262. package/build/errors/transportAlreadyExists.builder.js.map +1 -1
  263. package/build/errors/vscodeNotInstalled.builder.js.map +1 -1
  264. package/build/features/AbstractAction.js.map +1 -1
  265. package/build/features/AbstractFeature.js.map +1 -1
  266. package/build/features/ActionExecuter.js.map +1 -1
  267. package/build/features/ActionFactory.js.map +1 -1
  268. package/build/features/ActionQuestionAsker.js.map +1 -1
  269. package/build/features/FeatureCommandAttacher.js.map +1 -1
  270. package/build/features/FeatureInstaller.js.map +1 -1
  271. package/build/features/OverrideActionDecorator.js.map +1 -1
  272. package/build/features/cache/CacheFeature.js.map +1 -1
  273. package/build/features/cache/actions/DisableAction.js.map +1 -1
  274. package/build/features/cache/actions/EnableAction.js.map +1 -1
  275. package/build/features/conversation/ConversationFeature.js.map +1 -1
  276. package/build/features/conversation/actions/TestAction.js.map +1 -1
  277. package/build/features/conversation/stores/ConversationStore.js.map +1 -1
  278. package/build/features/conversation/writers/ConversationWriter.js.map +1 -1
  279. package/build/features/dependencies/DependencyFeature.js.map +1 -1
  280. package/build/features/dependencies/actions/AddAction.js.map +1 -1
  281. package/build/features/dependencies/actions/ManageAction.js.map +1 -1
  282. package/build/features/deploy/DeployFeature.js.map +1 -1
  283. package/build/features/deploy/actions/HerokuAction.js.map +1 -1
  284. package/build/features/deploy/writers/DeployWriter.js.map +1 -1
  285. package/build/features/error/ErrorFeature.js.map +1 -1
  286. package/build/features/error/ParentTestFinder.js.map +1 -1
  287. package/build/features/error/actions/CreateAction.js.map +1 -1
  288. package/build/features/error/actions/SyncAction.js.map +1 -1
  289. package/build/features/error/writers/ErrorWriter.js.map +1 -1
  290. package/build/features/event/EventFeature.js.map +1 -1
  291. package/build/features/event/actions/CreateAction.js.map +1 -1
  292. package/build/features/event/actions/ListenAction.js.map +1 -1
  293. package/build/features/event/actions/SetRemoteAction.js.map +1 -1
  294. package/build/features/event/actions/SyncAction.js.map +1 -1
  295. package/build/features/event/actions/SyncListenersAction.js.map +1 -1
  296. package/build/features/event/builders/EventContractBuilder.js.map +1 -1
  297. package/build/features/event/builders/ListenerTemplateItemBuilder.js.map +1 -1
  298. package/build/features/event/stores/EventStore.js.map +1 -1
  299. package/build/features/event/stores/ListenerStore.js.map +1 -1
  300. package/build/features/event/writers/EventWriter.js.map +1 -1
  301. package/build/features/eventContract/EventContractFeature.js.map +1 -1
  302. package/build/features/eventContract/actions/PullAction.js.map +1 -1
  303. package/build/features/feature.utilities.js.map +1 -1
  304. package/build/features/features.types.js.map +1 -1
  305. package/build/features/log/LogFeature.js.map +1 -1
  306. package/build/features/log/actions/CreateTransportAction.js.map +1 -1
  307. package/build/features/log/writers/LogWriter.js.map +1 -1
  308. package/build/features/node/NodeFeature.js.map +1 -1
  309. package/build/features/node/actions/UpdateDependenciesAction.js.map +1 -1
  310. package/build/features/node/actions/UpgradeAction.js.map +1 -1
  311. package/build/features/node/writers/NodeWriter.js.map +1 -1
  312. package/build/features/onboard/OnboardFeature.js.map +1 -1
  313. package/build/features/onboard/ScriptLoader.js.map +1 -1
  314. package/build/features/onboard/scripts/onboarding.first.script.js.map +1 -1
  315. package/build/features/onboard/scripts/onboarding.immersive.script.js.map +1 -1
  316. package/build/features/onboard/scripts/onboarding.returning.script.js.map +1 -1
  317. package/build/features/onboard/scripts/onboarding.short.script.js.map +1 -1
  318. package/build/features/onboard/scripts/wrongCommand.script.js.map +1 -1
  319. package/build/features/onboard/stores/OnboardingStore.js.map +1 -1
  320. package/build/features/organization/OrganizationFeature.js.map +1 -1
  321. package/build/features/organization/stores/OrganizationStore.js.map +1 -1
  322. package/build/features/person/PersonFeature.js.map +1 -1
  323. package/build/features/person/actions/LoginAction.js.map +1 -1
  324. package/build/features/person/actions/LogoutAction.js.map +1 -1
  325. package/build/features/person/actions/WhoamiAction.js.map +1 -1
  326. package/build/features/sandbox/SandboxFeature.js.map +1 -1
  327. package/build/features/sandbox/actions/SetupAction.js.map +1 -1
  328. package/build/features/sandbox/writers/SandboxWriter.js.map +1 -1
  329. package/build/features/schema/SchemaFeature.js.map +1 -1
  330. package/build/features/schema/ValueTypeBuilder.js.map +1 -1
  331. package/build/features/schema/actions/CreateAction.js.map +1 -1
  332. package/build/features/schema/actions/SyncAction.js.map +1 -1
  333. package/build/features/schema/actions/SyncFieldsAction.js.map +1 -1
  334. package/build/features/schema/services/SchemaService.js.map +1 -1
  335. package/build/features/schema/stores/SchemaStore.d.ts +2 -1
  336. package/build/features/schema/stores/SchemaStore.js +2 -1
  337. package/build/features/schema/stores/SchemaStore.js.map +1 -1
  338. package/build/features/schema/utilities/schema.utility.js.map +1 -1
  339. package/build/features/schema/utilities/schemaDisk.utility.js.map +1 -1
  340. package/build/features/schema/utilities/schemaGenerator.utility.js.map +1 -1
  341. package/build/features/schema/writers/SchemaWriter.js.map +1 -1
  342. package/build/features/skill/SkillFeature.js.map +1 -1
  343. package/build/features/skill/actions/BootAction.js.map +1 -1
  344. package/build/features/skill/actions/CreateAction.js.map +1 -1
  345. package/build/features/skill/actions/DashboardAction.js.map +1 -1
  346. package/build/features/skill/actions/LoginAction.js.map +1 -1
  347. package/build/features/skill/actions/RebuildAction.js.map +1 -1
  348. package/build/features/skill/actions/RegisterAction.js.map +1 -1
  349. package/build/features/skill/stores/SkillStore.js.map +1 -1
  350. package/build/features/skill/updaters/Updater.js.map +1 -1
  351. package/build/features/skill/writers/SkillWriter.js.map +1 -1
  352. package/build/features/store/StoreFeature.js.map +1 -1
  353. package/build/features/store/actions/CreateAction.js.map +1 -1
  354. package/build/features/store/actions/SyncAction.js.map +1 -1
  355. package/build/features/store/stores/StoreStore.js.map +1 -1
  356. package/build/features/store/templateItemBuilders/StoreTemplateItemBuilder.js.map +1 -1
  357. package/build/features/store/writers/StoreWriter.js.map +1 -1
  358. package/build/features/test/TestFeature.js.map +1 -1
  359. package/build/features/test/TestLogItemGenerator.js.map +1 -1
  360. package/build/features/test/TestReporter.js.map +1 -1
  361. package/build/features/test/TestRunner.js.map +1 -1
  362. package/build/features/test/actions/CreateAction.js.map +1 -1
  363. package/build/features/test/actions/SetupAction.js.map +1 -1
  364. package/build/features/test/actions/TestAction.js.map +1 -1
  365. package/build/features/test/writers/TestWriter.js.map +1 -1
  366. package/build/features/validateAndNormalize.utility.js.map +1 -1
  367. package/build/features/view/ViewFeature.js.map +1 -1
  368. package/build/features/view/actions/CreateAction.js.map +1 -1
  369. package/build/features/view/actions/CreateThemeAction.js.map +1 -1
  370. package/build/features/view/actions/SyncAction.js.map +1 -1
  371. package/build/features/view/actions/WatchAction.js.map +1 -1
  372. package/build/features/view/stores/ViewStore.js.map +1 -1
  373. package/build/features/view/writers/ViewWriter.js.map +1 -1
  374. package/build/features/vscode/VsCodeFeature.js.map +1 -1
  375. package/build/features/vscode/services/VsCodeService.js.map +1 -1
  376. package/build/features/vscode/writers/VsCodeWriter.js.map +1 -1
  377. package/build/features/watch/WatchFeature.js.map +1 -1
  378. package/build/index.js.map +1 -1
  379. package/build/interfaces/SpyInterface.js +0 -1
  380. package/build/interfaces/SpyInterface.js.map +1 -1
  381. package/build/interfaces/TerminalInterface.js.map +1 -1
  382. package/build/schemas/v2020_07_22/bootSkillOptions.builder.js.map +1 -1
  383. package/build/schemas/v2020_07_22/createConversationTopicOptions.builder.js.map +1 -1
  384. package/build/schemas/v2020_07_22/createErrorOptions.builder.js.map +1 -1
  385. package/build/schemas/v2020_07_22/createOrganizationOptions.builder.js.map +1 -1
  386. package/build/schemas/v2020_07_22/createSchemaOptions.builder.js.map +1 -1
  387. package/build/schemas/v2020_07_22/createTestOptions.builder.js.map +1 -1
  388. package/build/schemas/v2020_07_22/installSkillAtOrganizationOptions.builder.js.map +1 -1
  389. package/build/schemas/v2020_07_22/listenEventOptions.builder.js.map +1 -1
  390. package/build/schemas/v2020_07_22/namedTemplateItem.builder.js.map +1 -1
  391. package/build/schemas/v2020_07_22/nodeFeatureOptions.builder.js.map +1 -1
  392. package/build/schemas/v2020_07_22/onboardOptions.builder.js.map +1 -1
  393. package/build/schemas/v2020_07_22/onboarding.builder.js.map +1 -1
  394. package/build/schemas/v2020_07_22/personWithToken.builder.js.map +1 -1
  395. package/build/schemas/v2020_07_22/registerDashboardWidgetsEmitPayloadSchema.builder.js.map +1 -1
  396. package/build/schemas/v2020_07_22/setupTestsOptions.builder.js.map +1 -1
  397. package/build/schemas/v2020_07_22/setupVscodeOptions.builder.js.map +1 -1
  398. package/build/schemas/v2020_07_22/skillFeature.builder.js.map +1 -1
  399. package/build/schemas/v2020_07_22/syncErrorOptions.builder.js.map +1 -1
  400. package/build/schemas/v2020_07_22/syncEventOptions.builder.js.map +1 -1
  401. package/build/schemas/v2020_07_22/syncSchemaFieldsOptions.builder.js.map +1 -1
  402. package/build/schemas/v2020_07_22/syncSchemasOptions.builder.js.map +1 -1
  403. package/build/schemas/v2020_07_22/testOptions.builder.js.map +1 -1
  404. package/build/schemas/v2020_07_22/upgradeSkillOptions.builder.js.map +1 -1
  405. package/build/schemas/v2020_07_22/watcherDidDetectChangesEmitPayload.builder.js.map +1 -1
  406. package/build/services/CommandService.js.map +1 -1
  407. package/build/services/GameService.js.map +1 -1
  408. package/build/services/ImportService.js.map +1 -1
  409. package/build/services/LintService.js.map +1 -1
  410. package/build/services/PkgService.js.map +1 -1
  411. package/build/services/ServiceFactory.js.map +1 -1
  412. package/build/templateItemBuilders/EventTemplateItemBuilder.js.map +1 -1
  413. package/build/templateItemBuilders/FieldTemplateItemBuilder.js.map +1 -1
  414. package/build/templateItemBuilders/SchemaTemplateItemBuilder.js.map +1 -1
  415. package/build/tests/AbstractCliTest.js.map +1 -1
  416. package/build/tests/AbstractEventTest.js.map +1 -1
  417. package/build/tests/AbstractSchemaTest.js.map +1 -1
  418. package/build/tests/AbstractTestTest.js.map +1 -1
  419. package/build/tests/CommandFaker.js.map +1 -1
  420. package/build/tests/JestJsonParser.js.map +1 -1
  421. package/build/tests/buildTestCache.js.map +1 -1
  422. package/build/tests/cleanTestCache.js.map +1 -1
  423. package/build/tests/cleanTestData.js.map +1 -1
  424. package/build/tests/fixtures/FeatureFixture.js.map +1 -1
  425. package/build/tests/fixtures/MercuryFixture.js.map +1 -1
  426. package/build/tests/fixtures/PersonFixture.js.map +1 -1
  427. package/build/tests/fixtures/SkillFixture.js.map +1 -1
  428. package/build/tests/utilities/test.utility.js.map +1 -1
  429. package/build/tests/utilities/uiAssert.utility.js.map +1 -1
  430. package/build/utilities/action.utility.js.map +1 -1
  431. package/build/utilities/commander.utility.js.map +1 -1
  432. package/build/utilities/eventContractCleaner.utility.js.map +1 -1
  433. package/build/utilities/form.utility.js.map +1 -1
  434. package/build/utilities/introspection.utility.js.map +1 -1
  435. package/build/utilities/tsConfig.utility.js.map +1 -1
  436. package/build/widgets/Theme.js.map +1 -1
  437. package/build/widgets/WidgetFactory.js.map +1 -1
  438. package/build/widgets/terminalKit/TKButtonWidget.js.map +1 -1
  439. package/build/widgets/terminalKit/TkInputWidget.js.map +1 -1
  440. package/build/widgets/terminalKit/TkLayoutWidget.js.map +1 -1
  441. package/build/widgets/terminalKit/TkMenuBarWidget.js.map +1 -1
  442. package/build/widgets/terminalKit/TkPopupWidget.js.map +1 -1
  443. package/build/widgets/terminalKit/TkTextWidget.js.map +1 -1
  444. package/build/widgets/terminalKit/termKit.utility.js.map +1 -1
  445. package/build/widgets/types/input.types.js.map +1 -1
  446. package/build/widgets/types/menuBar.types.js.map +1 -1
  447. package/build/widgets/types/text.types.js.map +1 -1
  448. package/build/widgets/types/window.types.js.map +1 -1
  449. package/build/writers/AbstractWriter.js.map +1 -1
  450. package/package.json +35 -35
  451. package/src/__tests__/behavioral/views/CreatingASkillView.test.ts +3 -2
  452. package/src/features/schema/stores/SchemaStore.ts +4 -2
  453. package/build/.spruce/schemas/spruce/v2020_07_22/fullMessageChoices.schema.d.ts +0 -1
  454. package/build/.spruce/schemas/spruce/v2020_07_22/fullMessageChoices.schema.js +0 -14
  455. package/build/.spruce/schemas/spruce/v2020_07_22/fullMessageChoices.schema.js.map +0 -1
  456. package/src/.spruce/schemas/spruce/v2020_07_22/fullMessageChoices.schema.ts +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TestLogItemGenerator.js","names":["TestLogItemGenerator","file","status","testRunnerStatus","logContent","duration","calculateDurationInMsForFile","generateStatusBlock","path","generateDuration","tests","forEach","test","bullet","bulletBasedOnStatus","name","pendingKey","length","calculateDurationInMs","durationColor","colorBasedOnStatus","durationUtil","msToFriendly","reduce","time","key","startTimes","Date","getTime","delta","errorContent","errorMessages","message","cleaned","StackCleaner","clean","chalk","red","replace","errorMessage","bgColor","statusLabel","color","padding","centerStringWithSpaces","text","numberOfSpaces","trim","l","w2","Math","floor","l2","s","Array","join"],"sources":["../../../src/features/test/TestLogItemGenerator.ts"],"sourcesContent":["import { StackCleaner } from '@sprucelabs/test'\nimport chalk from 'chalk'\nimport durationUtil from '../../utilities/duration.utility'\nimport {\n\tSpruceTestFile,\n\tSpruceTestFileTest,\n\tTestRunnerStatus,\n} from './test.types'\n\nexport default class TestLogItemGenerator {\n\tprivate startTimes: Record<string, number> = {}\n\tprivate testRunnerStatus!: TestRunnerStatus\n\n\tpublic generateLogItemForFile(\n\t\tfile: SpruceTestFile,\n\t\tstatus: TestRunnerStatus\n\t): string {\n\t\tthis.testRunnerStatus = status\n\n\t\tlet logContent = ''\n\t\tconst duration = this.calculateDurationInMsForFile(file)\n\n\t\tlogContent += `${this.generateStatusBlock(file.status)} ${file.path}${\n\t\t\tduration ? ` ${this.generateDuration(file.status, duration)}` : ''\n\t\t}\\n`\n\n\t\tif (file.tests) {\n\t\t\tfile.tests.forEach((test) => {\n\t\t\t\tconst bullet = this.bulletBasedOnStatus(test.status)\n\t\t\t\tlogContent += ` ${bullet} ^-${\n\t\t\t\t\ttest.name\n\t\t\t\t}^ ${this.generateDuration(test.status, test.duration)}\\n`\n\t\t\t})\n\t\t}\n\n\t\tif (file.status === 'running') {\n\t\t\tconst pendingKey = `${file.path}-pending-${file.tests?.length ?? 0}`\n\t\t\tlogContent += ` ^-${'Running next test... ⚡️⚡️⚡️'}^ ${this.generateDuration(\n\t\t\t\t'running',\n\t\t\t\tthis.calculateDurationInMs(pendingKey)\n\t\t\t)}\\n`\n\t\t}\n\n\t\treturn logContent\n\t}\n\n\tprivate generateDuration(status: any, duration: number) {\n\t\tif (duration === 0) {\n\t\t\treturn ''\n\t\t}\n\t\tconst durationColor = this.colorBasedOnStatus(status)\n\t\treturn `^${durationColor}(${durationUtil.msToFriendly(duration)})^`\n\t}\n\n\tprivate bulletBasedOnStatus(\n\t\tstatus: SpruceTestFileTest['status'] | 'running'\n\t) {\n\t\tlet bullet = 'y'\n\n\t\tswitch (status) {\n\t\t\tcase 'running':\n\t\t\t\tbullet = '^g(running)^'\n\t\t\t\tbreak\n\t\t\tcase 'passed':\n\t\t\t\tbullet = '^g√^'\n\t\t\t\tbreak\n\t\t\tcase 'failed':\n\t\t\t\tbullet = '^rx^'\n\t\t\t\tbreak\n\t\t\tcase 'pending':\n\t\t\tcase 'skipped':\n\t\t\t\tbullet = '^y(skipped)^'\n\t\t\t\tbreak\n\t\t\tcase 'todo':\n\t\t\t\tbullet = '^y(todo)^'\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tbullet = '??'\n\t\t\t\tbreak\n\t\t}\n\n\t\treturn bullet\n\t}\n\n\tprivate calculateDurationInMsForFile(file: SpruceTestFile): number {\n\t\tif (file.status !== 'running' && file.tests) {\n\t\t\treturn file.tests.reduce((time, test) => {\n\t\t\t\ttime += test.duration\n\t\t\t\treturn time\n\t\t\t}, 0)\n\t\t}\n\n\t\tconst key = file.path\n\t\treturn this.calculateDurationInMs(key)\n\t}\n\n\tprivate calculateDurationInMs(key: string) {\n\t\tif (!this.startTimes[key]) {\n\t\t\tthis.startTimes[key] = new Date().getTime()\n\t\t}\n\n\t\tconst delta = new Date().getTime() - this.startTimes[key]\n\t\treturn delta\n\t}\n\n\tpublic generateErrorLogItemForFile(file: SpruceTestFile): string {\n\t\tlet errorContent = ''\n\n\t\tfile.tests?.forEach((test) => {\n\t\t\ttest.errorMessages?.forEach((message) => {\n\t\t\t\tconst cleaned = message ?? StackCleaner.clean(message)\n\t\t\t\terrorContent += ` ${chalk.red(file.path)}\\n`\n\t\t\t\terrorContent += ` - ${chalk.red(test.name)}\\n\\n`\n\t\t\t\terrorContent += cleaned.replace(/\\n+ {4}at/i, '\\n\\n\\n at') + '\\n\\n\\n'\n\t\t\t})\n\t\t})\n\n\t\tif (!errorContent && file.errorMessage) {\n\t\t\terrorContent += `${chalk.red(file.path)}\\n`\n\t\t\terrorContent += file.errorMessage + '\\n\\n\\n'\n\t\t}\n\n\t\treturn errorContent\n\t}\n\n\tpublic resetStartTimes() {\n\t\tthis.startTimes = {}\n\t}\n\n\tprivate generateStatusBlock(status: SpruceTestFile['status']) {\n\t\tconst bgColor = this.colorBasedOnStatus(status)\n\n\t\tlet statusLabel = status as string\n\t\tlet color = 'k'\n\t\tlet padding = 10\n\t\tswitch (status) {\n\t\t\tcase 'passed':\n\t\t\t\tpadding = 11\n\t\t\t\tcolor = 'w'\n\t\t\t\tbreak\n\t\t\tcase 'failed':\n\t\t\t\tpadding = 11\n\t\t\t\tcolor = 'w'\n\t\t\t\tbreak\n\t\t}\n\n\t\tif (status === 'running' && this.testRunnerStatus === 'stopped') {\n\t\t\tstatusLabel = 'stopped'\n\t\t\tcolor = 'w'\n\t\t}\n\n\t\treturn `^b^#^${bgColor}^${color}^+${this.centerStringWithSpaces(\n\t\t\tstatusLabel,\n\t\t\tpadding\n\t\t)}^`\n\t}\n\n\tprivate colorBasedOnStatus(status: SpruceTestFile['status']) {\n\t\tlet color = 'y'\n\n\t\tswitch (status) {\n\t\t\tcase 'passed':\n\t\t\t\tcolor = 'g'\n\t\t\t\tbreak\n\t\t\tcase 'failed':\n\t\t\t\tcolor = 'r'\n\t\t\t\tbreak\n\t\t}\n\n\t\tif (status === 'running' && this.testRunnerStatus === 'stopped') {\n\t\t\tcolor = 'b'\n\t\t}\n\n\t\treturn color\n\t}\n\n\tprivate centerStringWithSpaces(text: string, numberOfSpaces: number) {\n\t\ttext = text.trim()\n\t\tlet l = text.length\n\t\tlet w2 = Math.floor(numberOfSpaces / 2)\n\t\tlet l2 = Math.floor(l / 2)\n\t\tlet s = new Array(w2 - l2 + 1).join(' ')\n\t\ttext = s + text + s\n\t\tif (text.length < numberOfSpaces) {\n\t\t\ttext += new Array(numberOfSpaces - text.length + 1).join(' ')\n\t\t}\n\t\treturn text\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;IAOqBA,oB;;;yDACyB,E;;;;;;WAG7C,gCACCC,IADD,EAECC,MAFD,EAGU;MAAA;;MACT,KAAKC,gBAAL,GAAwBD,MAAxB;MAEA,IAAIE,UAAU,GAAG,EAAjB;MACA,IAAMC,QAAQ,GAAG,KAAKC,4BAAL,CAAkCL,IAAlC,CAAjB;MAEAG,UAAU,cAAO,KAAKG,mBAAL,CAAyBN,IAAI,CAACC,MAA9B,CAAP,gBAAkDD,IAAI,CAACO,IAAvD,SACTH,QAAQ,cAAO,KAAKI,gBAAL,CAAsBR,IAAI,CAACC,MAA3B,EAAmCG,QAAnC,CAAP,IAAwD,EADvD,OAAV;;MAIA,IAAIJ,IAAI,CAACS,KAAT,EAAgB;QACfT,IAAI,CAACS,KAAL,CAAWC,OAAX,CAAmB,UAACC,IAAD,EAAU;UAC5B,IAAMC,MAAM,GA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EAAqE;MACpED,IAAI,GAAGA,IAAI,CAACE,IAAL,EAAP;MACA,IAAIC,CAAC,GAAGH,IAAI,CAAC5B,MAAb;MACA,IAAIgC,EAAE,GAAGC,IAAI,CAACC,KAAL,CAAWL,cAAc,GAAG,CAA5B,CAAT;MACA,IAAIM,EAAE,GAAGF,IAAI,CAACC,KAAL,CAAWH,CAAC,GAAG,CAAf,CAAT;MACA,IAAIK,CAAC,GAAG,IAAIC,KAAJ,CAAUL,EAAE,GAAGG,EAAL,GAAU,CAApB,EAAuBG,IAAvB,CAA4B,GAA5B,CAAR;MACAV,IAAI,GAAGQ,CAAC,GAAGR,IAAJ,GAAWQ,CAAlB;;MACA,IAAIR,IAAI,CAAC5B,MAAL,GAAc6B,cAAlB,EAAkC;QACjCD,IAAI,IAAI,IAAIS,KAAJ,CAAUR,cAAc,GAAGD,IAAI,CAAC5B,MAAtB,GAA+B,CAAzC,EAA4CsC,IAA5C,CAAiD,GAAjD,CAAR;MACA;;MACD,OAAOV,IAAP;IACA"}
1
+ {"version":3,"file":"TestLogItemGenerator.js","names":["TestLogItemGenerator","file","status","testRunnerStatus","logContent","duration","calculateDurationInMsForFile","generateStatusBlock","path","generateDuration","tests","forEach","test","bullet","bulletBasedOnStatus","name","pendingKey","length","calculateDurationInMs","durationColor","colorBasedOnStatus","durationUtil","msToFriendly","reduce","time","key","startTimes","Date","getTime","delta","errorContent","errorMessages","message","cleaned","StackCleaner","clean","chalk","red","replace","errorMessage","bgColor","statusLabel","color","padding","centerStringWithSpaces","text","numberOfSpaces","trim","l","w2","Math","floor","l2","s","Array","join"],"sources":["../../../src/features/test/TestLogItemGenerator.ts"],"sourcesContent":["import { StackCleaner } from '@sprucelabs/test'\nimport chalk from 'chalk'\nimport durationUtil from '../../utilities/duration.utility'\nimport {\n\tSpruceTestFile,\n\tSpruceTestFileTest,\n\tTestRunnerStatus,\n} from './test.types'\n\nexport default class TestLogItemGenerator {\n\tprivate startTimes: Record<string, number> = {}\n\tprivate testRunnerStatus!: TestRunnerStatus\n\n\tpublic generateLogItemForFile(\n\t\tfile: SpruceTestFile,\n\t\tstatus: TestRunnerStatus\n\t): string {\n\t\tthis.testRunnerStatus = status\n\n\t\tlet logContent = ''\n\t\tconst duration = this.calculateDurationInMsForFile(file)\n\n\t\tlogContent += `${this.generateStatusBlock(file.status)} ${file.path}${\n\t\t\tduration ? ` ${this.generateDuration(file.status, duration)}` : ''\n\t\t}\\n`\n\n\t\tif (file.tests) {\n\t\t\tfile.tests.forEach((test) => {\n\t\t\t\tconst bullet = this.bulletBasedOnStatus(test.status)\n\t\t\t\tlogContent += ` ${bullet} ^-${\n\t\t\t\t\ttest.name\n\t\t\t\t}^ ${this.generateDuration(test.status, test.duration)}\\n`\n\t\t\t})\n\t\t}\n\n\t\tif (file.status === 'running') {\n\t\t\tconst pendingKey = `${file.path}-pending-${file.tests?.length ?? 0}`\n\t\t\tlogContent += ` ^-${'Running next test... ⚡️⚡️⚡️'}^ ${this.generateDuration(\n\t\t\t\t'running',\n\t\t\t\tthis.calculateDurationInMs(pendingKey)\n\t\t\t)}\\n`\n\t\t}\n\n\t\treturn logContent\n\t}\n\n\tprivate generateDuration(status: any, duration: number) {\n\t\tif (duration === 0) {\n\t\t\treturn ''\n\t\t}\n\t\tconst durationColor = this.colorBasedOnStatus(status)\n\t\treturn `^${durationColor}(${durationUtil.msToFriendly(duration)})^`\n\t}\n\n\tprivate bulletBasedOnStatus(\n\t\tstatus: SpruceTestFileTest['status'] | 'running'\n\t) {\n\t\tlet bullet = 'y'\n\n\t\tswitch (status) {\n\t\t\tcase 'running':\n\t\t\t\tbullet = '^g(running)^'\n\t\t\t\tbreak\n\t\t\tcase 'passed':\n\t\t\t\tbullet = '^g√^'\n\t\t\t\tbreak\n\t\t\tcase 'failed':\n\t\t\t\tbullet = '^rx^'\n\t\t\t\tbreak\n\t\t\tcase 'pending':\n\t\t\tcase 'skipped':\n\t\t\t\tbullet = '^y(skipped)^'\n\t\t\t\tbreak\n\t\t\tcase 'todo':\n\t\t\t\tbullet = '^y(todo)^'\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tbullet = '??'\n\t\t\t\tbreak\n\t\t}\n\n\t\treturn bullet\n\t}\n\n\tprivate calculateDurationInMsForFile(file: SpruceTestFile): number {\n\t\tif (file.status !== 'running' && file.tests) {\n\t\t\treturn file.tests.reduce((time, test) => {\n\t\t\t\ttime += test.duration\n\t\t\t\treturn time\n\t\t\t}, 0)\n\t\t}\n\n\t\tconst key = file.path\n\t\treturn this.calculateDurationInMs(key)\n\t}\n\n\tprivate calculateDurationInMs(key: string) {\n\t\tif (!this.startTimes[key]) {\n\t\t\tthis.startTimes[key] = new Date().getTime()\n\t\t}\n\n\t\tconst delta = new Date().getTime() - this.startTimes[key]\n\t\treturn delta\n\t}\n\n\tpublic generateErrorLogItemForFile(file: SpruceTestFile): string {\n\t\tlet errorContent = ''\n\n\t\tfile.tests?.forEach((test) => {\n\t\t\ttest.errorMessages?.forEach((message) => {\n\t\t\t\tconst cleaned = message ?? StackCleaner.clean(message)\n\t\t\t\terrorContent += ` ${chalk.red(file.path)}\\n`\n\t\t\t\terrorContent += ` - ${chalk.red(test.name)}\\n\\n`\n\t\t\t\terrorContent += cleaned.replace(/\\n+ {4}at/i, '\\n\\n\\n at') + '\\n\\n\\n'\n\t\t\t})\n\t\t})\n\n\t\tif (!errorContent && file.errorMessage) {\n\t\t\terrorContent += `${chalk.red(file.path)}\\n`\n\t\t\terrorContent += file.errorMessage + '\\n\\n\\n'\n\t\t}\n\n\t\treturn errorContent\n\t}\n\n\tpublic resetStartTimes() {\n\t\tthis.startTimes = {}\n\t}\n\n\tprivate generateStatusBlock(status: SpruceTestFile['status']) {\n\t\tconst bgColor = this.colorBasedOnStatus(status)\n\n\t\tlet statusLabel = status as string\n\t\tlet color = 'k'\n\t\tlet padding = 10\n\t\tswitch (status) {\n\t\t\tcase 'passed':\n\t\t\t\tpadding = 11\n\t\t\t\tcolor = 'w'\n\t\t\t\tbreak\n\t\t\tcase 'failed':\n\t\t\t\tpadding = 11\n\t\t\t\tcolor = 'w'\n\t\t\t\tbreak\n\t\t}\n\n\t\tif (status === 'running' && this.testRunnerStatus === 'stopped') {\n\t\t\tstatusLabel = 'stopped'\n\t\t\tcolor = 'w'\n\t\t}\n\n\t\treturn `^b^#^${bgColor}^${color}^+${this.centerStringWithSpaces(\n\t\t\tstatusLabel,\n\t\t\tpadding\n\t\t)}^`\n\t}\n\n\tprivate colorBasedOnStatus(status: SpruceTestFile['status']) {\n\t\tlet color = 'y'\n\n\t\tswitch (status) {\n\t\t\tcase 'passed':\n\t\t\t\tcolor = 'g'\n\t\t\t\tbreak\n\t\t\tcase 'failed':\n\t\t\t\tcolor = 'r'\n\t\t\t\tbreak\n\t\t}\n\n\t\tif (status === 'running' && this.testRunnerStatus === 'stopped') {\n\t\t\tcolor = 'b'\n\t\t}\n\n\t\treturn color\n\t}\n\n\tprivate centerStringWithSpaces(text: string, numberOfSpaces: number) {\n\t\ttext = text.trim()\n\t\tlet l = text.length\n\t\tlet w2 = Math.floor(numberOfSpaces / 2)\n\t\tlet l2 = Math.floor(l / 2)\n\t\tlet s = new Array(w2 - l2 + 1).join(' ')\n\t\ttext = s + text + s\n\t\tif (text.length < numberOfSpaces) {\n\t\t\ttext += new Array(numberOfSpaces - text.length + 1).join(' ')\n\t\t}\n\t\treturn text\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;IAOqBA,oB;;;yDACyB,E;;;;;;WAG7C,gCACCC,IADD,EAECC,MAFD,EAGU;MAAA;;MACT,KAAKC,gBAAL,GAAwBD,MAAxB;MAEA,IAAIE,UAAU,GAAG,EAAjB;MACA,IAAMC,QAAQ,GAAG,KAAKC,4BAAL,CAAkCL,IAAlC,CAAjB;MAEAG,UAAU,cAAO,KAAKG,mBAAL,CAAyBN,IAAI,CAACC,MAA9B,CAAP,gBAAkDD,IAAI,CAACO,IAAvD,SACTH,QAAQ,cAAO,KAAKI,gB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R;UACA;;QACD,KAAK,QAAL;UACCA,KAAK,GAAG,GAAR;UACA;MANF;;MASA,IAAIxC,MAAM,KAAK,SAAX,IAAwB,KAAKC,gBAAL,KAA0B,SAAtD,EAAiE;QAChEuC,KAAK,GAAG,GAAR;MACA;;MAED,OAAOA,KAAP;IACA;;;WAED,gCAA+BG,IAA/B,EAA6CC,cAA7C,EAAqE;MACpED,IAAI,GAAGA,IAAI,CAACE,IAAL,EAAP;MACA,IAAIC,CAAC,GAAGH,IAAI,CAAC5B,MAAb;MACA,IAAIgC,EAAE,GAAGC,IAAI,CAACC,KAAL,CAAWL,cAAc,GAAG,CAA5B,CAAT;MACA,IAAIM,EAAE,GAAGF,IAAI,CAACC,KAAL,CAAWH,CAAC,GAAG,CAAf,CAAT;MACA,IAAIK,CAAC,GAAG,IAAIC,KAAJ,CAAUL,EAAE,GAAGG,EAAL,GAAU,CAApB,EAAuBG,IAAvB,CAA4B,GAA5B,CAAR;MACAV,IAAI,GAAGQ,CAAC,GAAGR,IAAJ,GAAWQ,CAAlB;;MACA,IAAIR,IAAI,CAAC5B,MAAL,GAAc6B,cAAlB,EAAkC;QACjCD,IAAI,IAAI,IAAIS,KAAJ,CAAUR,cAAc,GAAGD,IAAI,CAAC5B,MAAtB,GAA+B,CAAzC,EAA4CsC,IAA5C,CAAiD,GAAjD,CAAR;MACA;;MACD,OAAOV,IAAP;IACA"}
@@ -1 +1 @@
1
- {"version":3,"file":"TestReporter.js","names":["TestReporter","options","totalTestFiles","customErrors","cwd","filterPattern","handleRestart","handleStartStop","handleQuit","handleRerunTestFile","handleOpenTestFile","handleFilterChange","handleFilterPatternChange","status","handleToggleDebug","handletoggleStandardWatch","isDebugging","watchMode","handleToggleSmartWatch","errorLogItemGenerator","TestLogItemGenerator","widgetFactory","WidgetFactory","pattern","filterInput","setValue","clearFilterPatternButton","setText","buildPatternButtonText","menu","setTextForItem","durationSec","clearInterval","countDownTimeInterval","undefined","remaining","renderCountdownTime","time","setWatchLabel","setInterval","stopCountdownTimer","setWatchMode","label","isWatching","started","window","Widget","hideCursor","getFrame","width","minWidth","Error","on","handleGlobalKeypress","bind","destroy","handleWindowResize","dropInTopLayout","dropInProgressBar","dropInMenu","dropInBottomLayout","dropInStatusBar","dropInTestLog","dropInFilterControls","updateOrientation","setIsDebugging","setStatus","updateInterval","handleUpdateInterval","frame","height","orientation","parent","left","top","shouldLockWidthWithParent","items","value","handleMenuSelect","updateMenuLabels","closeSelectTestPopup","bottomLayout","updateLayout","setStatusLabel","refreshResults","restartLabel","payload","lastResults","updateLogs","getFocusedWidget","key","process","exit","getChildById","testLog","isScrollEnabled","shouldLockHeightWithParent","handleClickTestLog","testFile","getFileForLine","row","column","dropInSelectTestPopup","selectTestPopup","Math","max","text","open","rerun","cancel","openTestFile","line","getScrollY","testFiles","file","path","c","tests","length","topLayout","bar","progress","buttonWidth","shouldLockRightWithParent","rows","columns","id","statusBar","shouldLockBottomWithParent","backgroundColor","foregroundColor","results","updateProgressBar","percentPassing","generatePercentPassing","percentComplete","generatePercentComplete","setTitle","resultsToLogContents","logContent","errorContent","errorLog","destroyErrorLog","dropInErrorLog","cleanedLog","replace","RegExp","forEach","generateLogItemForFile","generateErrorLogItemForFile","map","err","chalk","red","join","orientationWhenErrorLogWasShown","getRows","addRow","setRowHeight","addColumn","setColumnWidth","rowIdx","columnIdx","cell","shouldAutoScrollWhenAppendingContent","padding","removeColumn","removeRow","totalTestFilesComplete","testsRemaining","generateProgressStats","percent","totalTests","totalPassedTests","totalTime","setLabel","durationUtil","msToFriendly","setProgress","test","duration","floor","isNaN","round","totalPassed","getTotalTestFilesRun","totalSkipped","totalTodo","table","computeCells","draw","resetStartTimes","message","push"],"sources":["../../../src/features/test/TestReporter.ts"],"sourcesContent":["import chalk from 'chalk'\nimport durationUtil from '../../utilities/duration.utility'\nimport { ButtonWidget } from '../../widgets/types/button.types'\nimport { InputWidget } from '../../widgets/types/input.types'\nimport { LayoutWidget } from '../../widgets/types/layout.types'\nimport { MenuBarWidget } from '../../widgets/types/menuBar.types'\nimport { PopupWidget } from '../../widgets/types/popup.types'\nimport { ProgressBarWidget } from '../../widgets/types/progressBar.types'\nimport { TextWidget } from '../../widgets/types/text.types'\nimport { WindowWidget } from '../../widgets/types/window.types'\nimport WidgetFactory from '../../widgets/WidgetFactory'\nimport { SpruceTestResults, TestRunnerStatus } from './test.types'\nimport TestLogItemGenerator from './TestLogItemGenerator'\n\ninterface TestReporterOptions {\n\thandleStartStop?: () => void\n\thandleRestart?: () => void\n\thandleQuit?: () => void\n\tonRequestOpenTestFile?: () => void\n\thandleRerunTestFile?: (fileName: string) => void\n\thandleOpenTestFile?: (fileName: string) => void\n\thandleFilterPatternChange?: (pattern?: string) => void\n\thandleToggleDebug?: () => void\n\thandletoggleStandardWatch?: () => void\n\thandleToggleSmartWatch?: () => void\n\tfilterPattern?: string\n\tisDebugging?: boolean\n\twatchMode?: WatchMode\n\tstatus?: TestRunnerStatus\n\tcwd?: string\n}\n\ntype TestReporterResults = SpruceTestResults & {\n\tcustomErrors: string[]\n}\n\nexport type TestReporterOrientation = 'landscape' | 'portrait'\nexport type WatchMode = 'off' | 'standard' | 'smart'\n\nexport default class TestReporter {\n\tprivate started = false\n\tprivate table?: any\n\tprivate bar!: ProgressBarWidget\n\tprivate bottomLayout!: LayoutWidget\n\tprivate testLog!: TextWidget\n\tprivate errorLog?: TextWidget\n\tprivate errorLogItemGenerator: TestLogItemGenerator\n\tprivate lastResults: TestReporterResults = {\n\t\ttotalTestFiles: 0,\n\t\tcustomErrors: [],\n\t}\n\tprivate updateInterval?: any\n\tprivate menu!: MenuBarWidget\n\tprivate statusBar!: TextWidget\n\tprivate window!: WindowWidget\n\tprivate widgetFactory: WidgetFactory\n\tprivate selectTestPopup?: PopupWidget\n\tprivate topLayout!: LayoutWidget\n\tprivate filterInput!: InputWidget\n\tprivate filterPattern?: string\n\tprivate clearFilterPatternButton!: ButtonWidget\n\tprivate isDebugging = false\n\tprivate watchMode: WatchMode = 'off'\n\tprivate status: TestRunnerStatus = 'ready'\n\tprivate countDownTimeInterval?: any\n\tprivate cwd: string | undefined\n\tprivate orientation: TestReporterOrientation = 'landscape'\n\n\tprivate handleStartStop?: () => void\n\tprivate handleRestart?: () => void\n\tprivate handleQuit?: () => void\n\tprivate handleRerunTestFile?: (fileName: string) => void\n\tprivate handleFilterChange?: (pattern?: string) => void\n\tprivate handleOpenTestFile?: (testFile: string) => void\n\tprivate handleToggleDebug?: () => void\n\tprivate handletoggleStandardWatch?: () => void\n\tprivate handleToggleSmartWatch?: () => any\n\tprivate minWidth = 50\n\tprivate orientationWhenErrorLogWasShown: TestReporterOrientation = 'landscape'\n\n\tpublic constructor(options?: TestReporterOptions) {\n\t\tthis.cwd = options?.cwd\n\t\tthis.filterPattern = options?.filterPattern\n\t\tthis.handleRestart = options?.handleRestart\n\t\tthis.handleStartStop = options?.handleStartStop\n\t\tthis.handleQuit = options?.handleQuit\n\t\tthis.handleRerunTestFile = options?.handleRerunTestFile\n\t\tthis.handleOpenTestFile = options?.handleOpenTestFile\n\t\tthis.handleFilterChange = options?.handleFilterPatternChange\n\t\tthis.status = options?.status ?? 'ready'\n\t\tthis.handleToggleDebug = options?.handleToggleDebug\n\t\tthis.handletoggleStandardWatch = options?.handletoggleStandardWatch\n\t\tthis.isDebugging = options?.isDebugging ?? false\n\t\tthis.watchMode = options?.watchMode ?? 'off'\n\t\tthis.handleToggleSmartWatch = options?.handleToggleSmartWatch\n\n\t\tthis.errorLogItemGenerator = new TestLogItemGenerator()\n\t\tthis.widgetFactory = new WidgetFactory()\n\t}\n\n\tpublic setFilterPattern(pattern: string | undefined) {\n\t\tthis.filterPattern = pattern\n\t\tthis.filterInput.setValue(pattern ?? '')\n\t\tthis.clearFilterPatternButton.setText(buildPatternButtonText(pattern))\n\t}\n\n\tpublic setIsDebugging(isDebugging: boolean) {\n\t\tthis.menu.setTextForItem(\n\t\t\t'toggleDebug',\n\t\t\t`Debug ^${isDebugging ? 'k' : 'w'}^#^${isDebugging ? 'g' : 'r'}${\n\t\t\t\tisDebugging ? ' • ' : ' • '\n\t\t\t}^`\n\t\t)\n\t\tthis.isDebugging = isDebugging\n\t}\n\n\tpublic startCountdownTimer(durationSec: number) {\n\t\tclearInterval(this.countDownTimeInterval)\n\t\tthis.countDownTimeInterval = undefined\n\n\t\tlet remaining = durationSec\n\n\t\tfunction renderCountdownTime(time: number) {\n\t\t\treturn `Starting ${time} `\n\t\t}\n\n\t\tthis.setWatchLabel(renderCountdownTime(remaining))\n\n\t\tthis.countDownTimeInterval = setInterval(() => {\n\t\t\tremaining--\n\n\t\t\tif (remaining < 0) {\n\t\t\t\tthis.stopCountdownTimer()\n\t\t\t} else {\n\t\t\t\tthis.setWatchLabel(renderCountdownTime(remaining))\n\t\t\t}\n\t\t}, 1000) as any\n\t}\n\n\tpublic stopCountdownTimer() {\n\t\tclearInterval(this.countDownTimeInterval)\n\t\tthis.countDownTimeInterval = undefined\n\t\tthis.setWatchMode(this.watchMode)\n\t}\n\n\tpublic setWatchMode(watchMode: WatchMode) {\n\t\tthis.watchMode = watchMode\n\t\tif (!this.countDownTimeInterval) {\n\t\t\tlet label = watchMode === 'smart' ? 'Smart Watch' : 'Standard Watch'\n\t\t\tif (watchMode === 'off') {\n\t\t\t\tlabel = 'Not Watching'\n\t\t\t}\n\t\t\tthis.setWatchLabel(label)\n\t\t}\n\t}\n\n\tprivate setWatchLabel(label: string) {\n\t\tconst isWatching = this.watchMode !== 'off'\n\n\t\tthis.menu.setTextForItem(\n\t\t\t'watchDropdown',\n\t\t\t`${label} ^${isWatching ? 'k' : 'w'}^#^${isWatching ? 'g' : 'r'}${\n\t\t\t\tisWatching ? ' • ' : ' • '\n\t\t\t}^`\n\t\t)\n\n\t\tthis.menu.setTextForItem(\n\t\t\t'toggleStandardWatch',\n\t\t\tthis.watchMode === 'standard' ? '√ Standard' : 'Standard'\n\t\t)\n\n\t\tthis.menu.setTextForItem(\n\t\t\t'toggleSmartWatch',\n\t\t\tthis.watchMode === 'smart' ? '√ Smart' : 'Smart'\n\t\t)\n\t}\n\n\tpublic async start() {\n\t\tthis.started = true\n\n\t\tthis.window = this.widgetFactory.Widget('window', {})\n\t\tthis.window.hideCursor()\n\n\t\tconst { width } = this.window.getFrame()\n\t\tif (width < this.minWidth) {\n\t\t\tthrow new Error(\n\t\t\t\t`Your screen must be at least ${this.minWidth} characters wide.`\n\t\t\t)\n\t\t}\n\n\t\tvoid this.window.on('key', this.handleGlobalKeypress.bind(this))\n\t\tvoid this.window.on('kill', this.destroy.bind(this))\n\t\tvoid this.window.on('resize', this.handleWindowResize.bind(this))\n\n\t\tthis.dropInTopLayout()\n\t\tthis.dropInProgressBar()\n\t\tthis.dropInMenu()\n\t\tthis.dropInBottomLayout()\n\t\tthis.dropInStatusBar()\n\t\tthis.dropInTestLog()\n\t\tthis.dropInFilterControls()\n\n\t\tthis.updateOrientation()\n\n\t\tthis.setIsDebugging(this.isDebugging)\n\t\tthis.setWatchMode(this.watchMode)\n\t\tthis.setStatus(this.status)\n\n\t\tthis.updateInterval = setInterval(\n\t\t\tthis.handleUpdateInterval.bind(this),\n\t\t\t1000\n\t\t)\n\t}\n\n\tprivate handleWindowResize() {\n\t\tthis.updateOrientation()\n\t}\n\n\tprivate updateOrientation() {\n\t\tconst frame = this.window.getFrame()\n\n\t\tif (frame.width * 0.5 > frame.height) {\n\t\t\tthis.orientation = 'landscape'\n\t\t} else {\n\t\t\tthis.orientation = 'portrait'\n\t\t}\n\t}\n\n\tprivate dropInMenu() {\n\t\tthis.menu = this.widgetFactory.Widget('menuBar', {\n\t\t\tparent: this.window,\n\t\t\tleft: 0,\n\t\t\ttop: 0,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\titems: [\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Restart ',\n\t\t\t\t\tvalue: 'restart',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Debug ',\n\t\t\t\t\tvalue: 'toggleDebug',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Not Watching ',\n\t\t\t\t\tvalue: 'watchDropdown',\n\t\t\t\t\titems: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: 'Watch all',\n\t\t\t\t\t\t\tvalue: 'toggleStandardWatch',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: 'Smart watch',\n\t\t\t\t\t\t\tvalue: 'toggleSmartWatch',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Quit',\n\t\t\t\t\tvalue: 'quit',\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\n\t\tvoid this.menu.on('select', this.handleMenuSelect.bind(this))\n\t}\n\n\tpublic setStatus(status: TestRunnerStatus) {\n\t\tthis.status = status\n\n\t\tthis.updateMenuLabels()\n\t\tthis.closeSelectTestPopup()\n\t\tthis.bottomLayout.updateLayout()\n\n\t\tif (status === 'ready') {\n\t\t\tthis.setStatusLabel('Starting...')\n\t\t} else if (this.status === 'stopped') {\n\t\t\tthis.refreshResults()\n\t\t\tthis.setStatusLabel('')\n\t\t} else if (this.status === 'running') {\n\t\t\tthis.setStatusLabel('Running tests...')\n\t\t}\n\t}\n\n\tprivate updateMenuLabels() {\n\t\tlet restartLabel = 'Start ^#^r › ^'\n\t\tswitch (this.status) {\n\t\t\tcase 'running':\n\t\t\t\trestartLabel = 'Stop ^k^#^g › ^'\n\t\t\t\tbreak\n\t\t\tcase 'stopped':\n\t\t\t\trestartLabel = `Start ^w^#^r › ^`\n\t\t\t\tbreak\n\t\t\tcase 'ready':\n\t\t\t\trestartLabel = 'Booting ^#^K › ^'\n\t\t\t\tbreak\n\t\t}\n\n\t\tthis.menu.setTextForItem('restart', restartLabel)\n\t}\n\n\tprivate handleMenuSelect(payload: { value: string }) {\n\t\tswitch (payload.value) {\n\t\t\tcase 'quit':\n\t\t\t\tthis.handleQuit?.()\n\t\t\t\tbreak\n\t\t\tcase 'restart':\n\t\t\t\tthis.handleStartStop?.()\n\t\t\t\tbreak\n\t\t\tcase 'toggleDebug':\n\t\t\t\tthis.handleToggleDebug?.()\n\t\t\t\tbreak\n\t\t\tcase 'toggleStandardWatch':\n\t\t\t\tthis.handletoggleStandardWatch?.()\n\t\t\t\tbreak\n\t\t\tcase 'toggleSmartWatch':\n\t\t\t\tthis.handleToggleSmartWatch?.()\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tprivate handleUpdateInterval() {\n\t\tif (this.status !== 'stopped') {\n\t\t\tthis.refreshResults()\n\t\t}\n\t}\n\n\tprivate refreshResults() {\n\t\tif (this.lastResults) {\n\t\t\tthis.updateLogs()\n\t\t}\n\t}\n\n\tprivate async handleGlobalKeypress(payload: { key: string }) {\n\t\tif (this.window.getFocusedWidget() === this.filterInput) {\n\t\t\treturn\n\t\t}\n\n\t\tswitch (payload.key) {\n\t\t\tcase 'ENTER':\n\t\t\t\tthis.handleRestart?.()\n\t\t\t\tbreak\n\t\t\tcase 'CTRL_C':\n\t\t\t\tthis.handleQuit?.()\n\t\t\t\tprocess.exit()\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tprivate dropInTestLog() {\n\t\tconst parent = this.bottomLayout.getChildById('results')\n\n\t\tif (parent) {\n\t\t\tthis.testLog = this.widgetFactory.Widget('text', {\n\t\t\t\tparent,\n\t\t\t\tisScrollEnabled: true,\n\t\t\t\tleft: 0,\n\t\t\t\ttop: 0,\n\t\t\t\theight: '100%',\n\t\t\t\twidth: '100%',\n\t\t\t\tshouldLockHeightWithParent: true,\n\t\t\t\tshouldLockWidthWithParent: true,\n\t\t\t})\n\n\t\t\tvoid this.testLog.on('click', this.handleClickTestLog.bind(this))\n\t\t}\n\t}\n\n\tprivate async handleClickTestLog(payload: { row: number; column: number }) {\n\t\tconst testFile = this.getFileForLine(payload.row)\n\t\tconst { row, column } = payload\n\n\t\tthis.closeSelectTestPopup()\n\n\t\tif (testFile) {\n\t\t\tthis.dropInSelectTestPopup({ testFile, column, row })\n\t\t}\n\t}\n\n\tprivate closeSelectTestPopup() {\n\t\tif (this.selectTestPopup) {\n\t\t\tvoid this.selectTestPopup.destroy()\n\t\t\tthis.selectTestPopup = undefined\n\t\t}\n\t}\n\n\tprivate dropInSelectTestPopup(options: {\n\t\ttestFile: string\n\t\tcolumn: number\n\t\trow: number\n\t}) {\n\t\tconst { testFile, row, column } = options\n\n\t\tthis.selectTestPopup = this.widgetFactory.Widget('popup', {\n\t\t\tparent: this.window,\n\t\t\tleft: Math.max(1, column - 25),\n\t\t\ttop: Math.max(4, row - 2),\n\t\t\twidth: 50,\n\t\t\theight: 10,\n\t\t})\n\n\t\tthis.widgetFactory.Widget('text', {\n\t\t\tparent: this.selectTestPopup,\n\t\t\tleft: 1,\n\t\t\ttop: 1,\n\t\t\theight: 4,\n\t\t\twidth: this.selectTestPopup.getFrame().width - 2,\n\t\t\ttext: `What do you wanna do with:\\n\\n${testFile}`,\n\t\t})\n\n\t\tconst open = this.widgetFactory.Widget('button', {\n\t\t\tparent: this.selectTestPopup,\n\t\t\tleft: 1,\n\t\t\ttop: 6,\n\t\t\ttext: 'Open',\n\t\t})\n\n\t\tconst rerun = this.widgetFactory.Widget('button', {\n\t\t\tparent: this.selectTestPopup,\n\t\t\tleft: 20,\n\t\t\ttop: 6,\n\t\t\ttext: 'Test',\n\t\t})\n\n\t\tconst cancel = this.widgetFactory.Widget('button', {\n\t\t\tparent: this.selectTestPopup,\n\t\t\tleft: 37,\n\t\t\ttop: 6,\n\t\t\ttext: 'Nevermind',\n\t\t})\n\n\t\tvoid rerun.on('click', () => {\n\t\t\tthis.handleRerunTestFile?.(testFile)\n\t\t\tthis.closeSelectTestPopup()\n\t\t})\n\t\tvoid cancel.on('click', this.closeSelectTestPopup.bind(this))\n\t\tvoid open.on('click', () => {\n\t\t\tthis.openTestFile(testFile)\n\t\t})\n\t}\n\n\tprivate openTestFile(testFile: string) {\n\t\tthis.handleOpenTestFile?.(testFile)\n\t\tthis.closeSelectTestPopup()\n\t}\n\n\tpublic getFileForLine(row: number): string | undefined {\n\t\tlet line = this.testLog.getScrollY()\n\n\t\tfor (let file of this.lastResults.testFiles ?? []) {\n\t\t\tif (line === row) {\n\t\t\t\treturn file.path\n\t\t\t}\n\n\t\t\tline++\n\n\t\t\tfor (let c = 0; c < (file.tests ?? []).length; c++) {\n\t\t\t\tif (line === row) {\n\t\t\t\t\treturn file.path\n\t\t\t\t}\n\n\t\t\t\tline++\n\t\t\t}\n\t\t}\n\n\t\treturn undefined\n\t}\n\n\tprivate dropInProgressBar() {\n\t\tconst parent = this.topLayout.getChildById('progress') ?? this.window\n\t\tthis.bar = this.widgetFactory.Widget('progressBar', {\n\t\t\tparent,\n\t\t\tleft: 0,\n\t\t\ttop: 0,\n\t\t\twidth: parent.getFrame().width,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tlabel: 'Ready and waiting...',\n\t\t\tprogress: 0,\n\t\t})\n\t}\n\n\tprivate dropInFilterControls() {\n\t\tconst parent = this.topLayout.getChildById('filter') ?? this.window\n\n\t\tconst buttonWidth = 3\n\t\tthis.filterInput = this.widgetFactory.Widget('input', {\n\t\t\tparent,\n\t\t\tleft: 0,\n\t\t\tlabel: 'Pattern',\n\t\t\twidth: parent.getFrame().width - buttonWidth,\n\t\t\theight: 1,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tvalue: this.filterPattern,\n\t\t})\n\n\t\tvoid this.filterInput.on('cancel', () => {\n\t\t\tthis.filterInput.setValue(this.filterPattern ?? '')\n\t\t})\n\n\t\tvoid this.filterInput.on('submit', (payload) => {\n\t\t\tthis.handleFilterChange?.(payload.value ?? undefined)\n\t\t})\n\n\t\tthis.clearFilterPatternButton = this.widgetFactory.Widget('button', {\n\t\t\tparent,\n\t\t\tleft: this.filterInput.getFrame().width,\n\t\t\twidth: buttonWidth,\n\t\t\ttop: 0,\n\t\t\ttext: buildPatternButtonText(this.filterPattern),\n\t\t\tshouldLockRightWithParent: true,\n\t\t})\n\n\t\tvoid this.clearFilterPatternButton.on('click', () => {\n\t\t\tif (this.filterPattern || this.filterPattern?.length === 0) {\n\t\t\t\tthis.handleFilterChange?.(undefined)\n\t\t\t} else {\n\t\t\t\tthis.filterInput.setValue('')\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate dropInBottomLayout() {\n\t\tthis.bottomLayout = this.widgetFactory.Widget('layout', {\n\t\t\tparent: this.window,\n\t\t\twidth: '100%',\n\t\t\ttop: 4,\n\t\t\theight: this.window.getFrame().height - 5,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tshouldLockHeightWithParent: true,\n\t\t\trows: [\n\t\t\t\t{\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 'results',\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\t}\n\n\tprivate dropInStatusBar() {\n\t\tthis.statusBar = this.widgetFactory.Widget('text', {\n\t\t\tparent: this.window,\n\t\t\ttop: this.window.getFrame().height - 1,\n\t\t\twidth: '100%',\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tshouldLockBottomWithParent: true,\n\t\t\tbackgroundColor: 'yellow',\n\t\t\tforegroundColor: 'black',\n\t\t\ttext: '...',\n\t\t})\n\t}\n\n\tprivate dropInTopLayout() {\n\t\tthis.topLayout = this.widgetFactory.Widget('layout', {\n\t\t\tparent: this.window,\n\t\t\twidth: '100%',\n\t\t\ttop: 1,\n\t\t\theight: 3,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tshouldLockHeightWithParent: false,\n\t\t\trows: [\n\t\t\t\t{\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 'progress',\n\t\t\t\t\t\t\twidth: 50,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 'filter',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\t}\n\n\tpublic updateResults(results: SpruceTestResults) {\n\t\tif (!this.started) {\n\t\t\tthrow new Error('You must call start() before anything else.')\n\t\t}\n\n\t\tthis.lastResults = {\n\t\t\t...this.lastResults,\n\t\t\t...results,\n\t\t}\n\n\t\tthis.updateProgressBar(results)\n\n\t\tconst percentPassing = this.generatePercentPassing(results)\n\t\tconst percentComplete = this.generatePercentComplete(results)\n\n\t\tthis.window.setTitle(\n\t\t\t`Testing: ${percentComplete}% complete.${\n\t\t\t\tpercentComplete > 0 ? ` ${percentPassing}% passing.` : ''\n\t\t\t}`\n\t\t)\n\n\t\tthis.updateLogs()\n\t}\n\n\tprivate updateLogs() {\n\t\tif (this.selectTestPopup) {\n\t\t\treturn\n\t\t}\n\n\t\tlet { logContent, errorContent } = this.resultsToLogContents(\n\t\t\tthis.lastResults\n\t\t)\n\n\t\tthis.testLog.setText(logContent)\n\n\t\tif (!errorContent) {\n\t\t\tthis.errorLog && this.destroyErrorLog()\n\t\t} else {\n\t\t\t!this.errorLog && this.dropInErrorLog()\n\t\t\tconst cleanedLog = this.cwd\n\t\t\t\t? errorContent.replace(new RegExp(this.cwd + '/', 'gim'), '')\n\t\t\t\t: errorContent\n\n\t\t\tthis.errorLog?.setText(cleanedLog)\n\t\t}\n\t}\n\n\tprivate resultsToLogContents(results: SpruceTestResults) {\n\t\tlet logContent = ''\n\t\tlet errorContent = ''\n\n\t\tresults.testFiles?.forEach((file) => {\n\t\t\tlogContent += this.errorLogItemGenerator.generateLogItemForFile(\n\t\t\t\tfile,\n\t\t\t\tthis.status\n\t\t\t)\n\t\t\terrorContent +=\n\t\t\t\tthis.errorLogItemGenerator.generateErrorLogItemForFile(file)\n\t\t})\n\n\t\tif (this.lastResults.customErrors.length > 0) {\n\t\t\terrorContent =\n\t\t\t\tthis.lastResults.customErrors.map((err) => chalk.red(err)).join(`\\n`) +\n\t\t\t\t`\\n${errorContent}`\n\t\t}\n\n\t\treturn { logContent, errorContent }\n\t}\n\n\tprivate dropInErrorLog() {\n\t\tthis.orientationWhenErrorLogWasShown = this.orientation\n\n\t\tif (this.bottomLayout.getRows().length === 1) {\n\t\t\tif (this.orientation === 'portrait') {\n\t\t\t\tthis.bottomLayout.addRow({\n\t\t\t\t\tid: 'row_2',\n\t\t\t\t\tcolumns: [{ id: 'errors', width: '100%' }],\n\t\t\t\t})\n\n\t\t\t\tthis.bottomLayout.setRowHeight(0, '50%')\n\t\t\t\tthis.bottomLayout.setRowHeight(1, '50%')\n\t\t\t} else {\n\t\t\t\tthis.bottomLayout.addColumn(0, { id: 'errors', width: '50%' })\n\t\t\t\tthis.bottomLayout.setColumnWidth({\n\t\t\t\t\trowIdx: 0,\n\t\t\t\t\tcolumnIdx: 0,\n\t\t\t\t\twidth: '50%',\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tthis.bottomLayout.updateLayout()\n\n\t\t\tconst cell = this.bottomLayout.getChildById('errors')\n\n\t\t\tif (!cell) {\n\t\t\t\tthrow new Error('Pulling child error')\n\t\t\t}\n\n\t\t\tthis.errorLog = this.widgetFactory.Widget('text', {\n\t\t\t\tparent: cell,\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%',\n\t\t\t\tisScrollEnabled: true,\n\t\t\t\tshouldAutoScrollWhenAppendingContent: false,\n\t\t\t\tshouldLockHeightWithParent: true,\n\t\t\t\tshouldLockWidthWithParent: true,\n\t\t\t\tpadding: { left: 1 },\n\t\t\t})\n\t\t}\n\t}\n\n\tprivate destroyErrorLog() {\n\t\tif (this.errorLog) {\n\t\t\tvoid this.errorLog?.destroy()\n\t\t\tthis.errorLog = undefined\n\n\t\t\tif (this.orientationWhenErrorLogWasShown === 'landscape') {\n\t\t\t\tthis.bottomLayout.removeColumn(0, 1)\n\t\t\t\tthis.bottomLayout.setColumnWidth({\n\t\t\t\t\trowIdx: 0,\n\t\t\t\t\tcolumnIdx: 0,\n\t\t\t\t\twidth: '100%',\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tthis.bottomLayout.removeRow(1)\n\t\t\t\tthis.bottomLayout.setRowHeight(0, '100%')\n\t\t\t}\n\t\t\tthis.bottomLayout.updateLayout()\n\t\t}\n\t}\n\n\tprivate updateProgressBar(results: SpruceTestResults) {\n\t\tif (results.totalTestFilesComplete ?? 0 > 0) {\n\t\t\tconst testsRemaining =\n\t\t\t\tresults.totalTestFiles - (results.totalTestFilesComplete ?? 0)\n\n\t\t\tif (testsRemaining === 0) {\n\t\t\t\tconst { percent, totalTests, totalPassedTests, totalTime } =\n\t\t\t\t\tthis.generateProgressStats(results)\n\n\t\t\t\tthis.bar.setLabel(\n\t\t\t\t\t`Finished! ${totalPassedTests} of ${totalTests} (${percent}%) passed in ${durationUtil.msToFriendly(\n\t\t\t\t\t\ttotalTime\n\t\t\t\t\t)}.${percent < 100 ? ` Don't give up! 💪` : ''}`\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tthis.bar.setLabel(\n\t\t\t\t\t`${results.totalTestFilesComplete} of ${\n\t\t\t\t\t\tresults.totalTestFiles\n\t\t\t\t\t} (${this.generatePercentComplete(\n\t\t\t\t\t\tresults\n\t\t\t\t\t)}%) complete. ${testsRemaining} remaining...`\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tthis.bar.setLabel('0%')\n\t\t}\n\n\t\tthis.bar.setProgress(this.generatePercentComplete(results) / 100)\n\t}\n\n\tprivate generateProgressStats(results: SpruceTestResults): {\n\t\tpercent: number\n\t\ttotalTests: number\n\t\ttotalPassedTests: number\n\t\ttotalTime: number\n\t} {\n\t\tlet totalTests = 0\n\t\tlet totalPassedTests = 0\n\t\tlet totalTime = 0\n\n\t\tresults.testFiles?.forEach((file) => {\n\t\t\tfile.tests?.forEach((test) => {\n\t\t\t\ttotalTime += test.duration\n\t\t\t\tif (test.status === 'passed') {\n\t\t\t\t\ttotalPassedTests++\n\t\t\t\t}\n\n\t\t\t\tif (test.status === 'passed' || test.status === 'failed') {\n\t\t\t\t\ttotalTests++\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\n\t\tconst percent = Math.floor((totalPassedTests / totalTests) * 100)\n\t\treturn {\n\t\t\tpercent: percent > 0 ? percent : 0,\n\t\t\ttotalTests,\n\t\t\ttotalPassedTests,\n\t\t\ttotalTime,\n\t\t}\n\t}\n\n\tprivate generatePercentComplete(results: SpruceTestResults): number {\n\t\tconst percent =\n\t\t\t(results.totalTestFilesComplete ?? 0) / results.totalTestFiles\n\t\tif (isNaN(percent)) {\n\t\t\treturn 0\n\t\t}\n\t\treturn Math.round(percent * 100)\n\t}\n\n\tprivate generatePercentPassing(results: SpruceTestResults): number {\n\t\tconst percent =\n\t\t\t(results.totalPassed ?? 0) / this.getTotalTestFilesRun(results)\n\n\t\tif (isNaN(percent)) {\n\t\t\treturn 0\n\t\t}\n\n\t\treturn Math.floor(percent * 100)\n\t}\n\n\tprivate getTotalTestFilesRun(results: SpruceTestResults) {\n\t\treturn (\n\t\t\t(results.totalTests ?? 0) -\n\t\t\t(results.totalSkipped ?? 0) -\n\t\t\t(results.totalTodo ?? 0)\n\t\t)\n\t}\n\n\tpublic render() {\n\t\tthis.table?.computeCells()\n\t\tthis.table?.draw()\n\t}\n\n\tpublic async destroy() {\n\t\tclearInterval(this.updateInterval)\n\t\tawait this.window.destroy()\n\t}\n\n\tpublic reset() {\n\t\tthis.testLog.setText('')\n\t\tthis.lastResults = {\n\t\t\ttotalTestFiles: 0,\n\t\t\tcustomErrors: [],\n\t\t}\n\t\tthis.destroyErrorLog()\n\t\tthis.errorLogItemGenerator.resetStartTimes()\n\t}\n\n\tpublic setStatusLabel(text: string) {\n\t\tthis.statusBar.setText(text)\n\t}\n\n\tpublic appendError(message: string) {\n\t\tthis.lastResults.customErrors.push(message)\n\t}\n}\nfunction buildPatternButtonText(pattern: string | undefined): string {\n\treturn pattern ? ' x ' : ' - '\n}\n"],"mappings":";;;;;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ADzB,2BAECvD,OAAO,CAACwD,SAFT,mEAEsB,CAFtB,CADD;IAKA;;;WAED,kBAAgB;MAAA;;MACf,oBAAKC,KAAL,4DAAYC,YAAZ;MACA,qBAAKD,KAAL,8DAAYE,IAAZ;IACA;;;;mGAED;QAAA;UAAA;YAAA;cAAA;gBACC9J,aAAa,CAAC,KAAKmC,cAAN,CAAb;gBADD;gBAAA,OAEO,KAAKtB,MAAL,CAAYU,OAAZ,EAFP;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;WAKA,iBAAe;MACd,KAAKuC,OAAL,CAAanE,OAAb,CAAqB,EAArB;MACA,KAAK4D,WAAL,GAAmB;QAClBrF,cAAc,EAAE,CADE;QAElBC,YAAY,EAAE;MAFI,CAAnB;MAIA,KAAK2I,eAAL;MACA,KAAK3H,qBAAL,CAA2B4K,eAA3B;IACA;;;WAED,wBAAsBrF,IAAtB,EAAoC;MACnC,KAAKqB,SAAL,CAAepG,OAAf,CAAuB+E,IAAvB;IACA;;;WAED,qBAAmBsF,OAAnB,EAAoC;MACnC,KAAKzG,WAAL,CAAiBpF,YAAjB,CAA8B8L,IAA9B,CAAmCD,OAAnC;IACA;;;;;;;AAEF,SAASpK,sBAAT,CAAgCL,OAAhC,EAAqE;EACpE,OAAOA,OAAO,GAAG,KAAH,GAAW,KAAzB;AACA"}
1
+ {"version":3,"file":"TestReporter.js","names":["TestReporter","options","totalTestFiles","customErrors","cwd","filterPattern","handleRestart","handleStartStop","handleQuit","handleRerunTestFile","handleOpenTestFile","handleFilterChange","handleFilterPatternChange","status","handleToggleDebug","handletoggleStandardWatch","isDebugging","watchMode","handleToggleSmartWatch","errorLogItemGenerator","TestLogItemGenerator","widgetFactory","WidgetFactory","pattern","filterInput","setValue","clearFilterPatternButton","setText","buildPatternButtonText","menu","setTextForItem","durationSec","clearInterval","countDownTimeInterval","undefined","remaining","renderCountdownTime","time","setWatchLabel","setInterval","stopCountdownTimer","setWatchMode","label","isWatching","started","window","Widget","hideCursor","getFrame","width","minWidth","Error","on","handleGlobalKeypress","bind","destroy","handleWindowResize","dropInTopLayout","dropInProgressBar","dropInMenu","dropInBottomLayout","dropInStatusBar","dropInTestLog","dropInFilterControls","updateOrientation","setIsDebugging","setStatus","updateInterval","handleUpdateInterval","frame","height","orientation","parent","left","top","shouldLockWidthWithParent","items","value","handleMenuSelect","updateMenuLabels","closeSelectTestPopup","bottomLayout","updateLayout","setStatusLabel","refreshResults","restartLabel","payload","lastResults","updateLogs","getFocusedWidget","key","process","exit","getChildById","testLog","isScrollEnabled","shouldLockHeightWithParent","handleClickTestLog","testFile","getFileForLine","row","column","dropInSelectTestPopup","selectTestPopup","Math","max","text","open","rerun","cancel","openTestFile","line","getScrollY","testFiles","file","path","c","tests","length","topLayout","bar","progress","buttonWidth","shouldLockRightWithParent","rows","columns","id","statusBar","shouldLockBottomWithParent","backgroundColor","foregroundColor","results","updateProgressBar","percentPassing","generatePercentPassing","percentComplete","generatePercentComplete","setTitle","resultsToLogContents","logContent","errorContent","errorLog","destroyErrorLog","dropInErrorLog","cleanedLog","replace","RegExp","forEach","generateLogItemForFile","generateErrorLogItemForFile","map","err","chalk","red","join","orientationWhenErrorLogWasShown","getRows","addRow","setRowHeight","addColumn","setColumnWidth","rowIdx","columnIdx","cell","shouldAutoScrollWhenAppendingContent","padding","removeColumn","removeRow","totalTestFilesComplete","testsRemaining","generateProgressStats","percent","totalTests","totalPassedTests","totalTime","setLabel","durationUtil","msToFriendly","setProgress","test","duration","floor","isNaN","round","totalPassed","getTotalTestFilesRun","totalSkipped","totalTodo","table","computeCells","draw","resetStartTimes","message","push"],"sources":["../../../src/features/test/TestReporter.ts"],"sourcesContent":["import chalk from 'chalk'\nimport durationUtil from '../../utilities/duration.utility'\nimport { ButtonWidget } from '../../widgets/types/button.types'\nimport { InputWidget } from '../../widgets/types/input.types'\nimport { LayoutWidget } from '../../widgets/types/layout.types'\nimport { MenuBarWidget } from '../../widgets/types/menuBar.types'\nimport { PopupWidget } from '../../widgets/types/popup.types'\nimport { ProgressBarWidget } from '../../widgets/types/progressBar.types'\nimport { TextWidget } from '../../widgets/types/text.types'\nimport { WindowWidget } from '../../widgets/types/window.types'\nimport WidgetFactory from '../../widgets/WidgetFactory'\nimport { SpruceTestResults, TestRunnerStatus } from './test.types'\nimport TestLogItemGenerator from './TestLogItemGenerator'\n\ninterface TestReporterOptions {\n\thandleStartStop?: () => void\n\thandleRestart?: () => void\n\thandleQuit?: () => void\n\tonRequestOpenTestFile?: () => void\n\thandleRerunTestFile?: (fileName: string) => void\n\thandleOpenTestFile?: (fileName: string) => void\n\thandleFilterPatternChange?: (pattern?: string) => void\n\thandleToggleDebug?: () => void\n\thandletoggleStandardWatch?: () => void\n\thandleToggleSmartWatch?: () => void\n\tfilterPattern?: string\n\tisDebugging?: boolean\n\twatchMode?: WatchMode\n\tstatus?: TestRunnerStatus\n\tcwd?: string\n}\n\ntype TestReporterResults = SpruceTestResults & {\n\tcustomErrors: string[]\n}\n\nexport type TestReporterOrientation = 'landscape' | 'portrait'\nexport type WatchMode = 'off' | 'standard' | 'smart'\n\nexport default class TestReporter {\n\tprivate started = false\n\tprivate table?: any\n\tprivate bar!: ProgressBarWidget\n\tprivate bottomLayout!: LayoutWidget\n\tprivate testLog!: TextWidget\n\tprivate errorLog?: TextWidget\n\tprivate errorLogItemGenerator: TestLogItemGenerator\n\tprivate lastResults: TestReporterResults = {\n\t\ttotalTestFiles: 0,\n\t\tcustomErrors: [],\n\t}\n\tprivate updateInterval?: any\n\tprivate menu!: MenuBarWidget\n\tprivate statusBar!: TextWidget\n\tprivate window!: WindowWidget\n\tprivate widgetFactory: WidgetFactory\n\tprivate selectTestPopup?: PopupWidget\n\tprivate topLayout!: LayoutWidget\n\tprivate filterInput!: InputWidget\n\tprivate filterPattern?: string\n\tprivate clearFilterPatternButton!: ButtonWidget\n\tprivate isDebugging = false\n\tprivate watchMode: WatchMode = 'off'\n\tprivate status: TestRunnerStatus = 'ready'\n\tprivate countDownTimeInterval?: any\n\tprivate cwd: string | undefined\n\tprivate orientation: TestReporterOrientation = 'landscape'\n\n\tprivate handleStartStop?: () => void\n\tprivate handleRestart?: () => void\n\tprivate handleQuit?: () => void\n\tprivate handleRerunTestFile?: (fileName: string) => void\n\tprivate handleFilterChange?: (pattern?: string) => void\n\tprivate handleOpenTestFile?: (testFile: string) => void\n\tprivate handleToggleDebug?: () => void\n\tprivate handletoggleStandardWatch?: () => void\n\tprivate handleToggleSmartWatch?: () => any\n\tprivate minWidth = 50\n\tprivate orientationWhenErrorLogWasShown: TestReporterOrientation = 'landscape'\n\n\tpublic constructor(options?: TestReporterOptions) {\n\t\tthis.cwd = options?.cwd\n\t\tthis.filterPattern = options?.filterPattern\n\t\tthis.handleRestart = options?.handleRestart\n\t\tthis.handleStartStop = options?.handleStartStop\n\t\tthis.handleQuit = options?.handleQuit\n\t\tthis.handleRerunTestFile = options?.handleRerunTestFile\n\t\tthis.handleOpenTestFile = options?.handleOpenTestFile\n\t\tthis.handleFilterChange = options?.handleFilterPatternChange\n\t\tthis.status = options?.status ?? 'ready'\n\t\tthis.handleToggleDebug = options?.handleToggleDebug\n\t\tthis.handletoggleStandardWatch = options?.handletoggleStandardWatch\n\t\tthis.isDebugging = options?.isDebugging ?? false\n\t\tthis.watchMode = options?.watchMode ?? 'off'\n\t\tthis.handleToggleSmartWatch = options?.handleToggleSmartWatch\n\n\t\tthis.errorLogItemGenerator = new TestLogItemGenerator()\n\t\tthis.widgetFactory = new WidgetFactory()\n\t}\n\n\tpublic setFilterPattern(pattern: string | undefined) {\n\t\tthis.filterPattern = pattern\n\t\tthis.filterInput.setValue(pattern ?? '')\n\t\tthis.clearFilterPatternButton.setText(buildPatternButtonText(pattern))\n\t}\n\n\tpublic setIsDebugging(isDebugging: boolean) {\n\t\tthis.menu.setTextForItem(\n\t\t\t'toggleDebug',\n\t\t\t`Debug ^${isDebugging ? 'k' : 'w'}^#^${isDebugging ? 'g' : 'r'}${\n\t\t\t\tisDebugging ? ' • ' : ' • '\n\t\t\t}^`\n\t\t)\n\t\tthis.isDebugging = isDebugging\n\t}\n\n\tpublic startCountdownTimer(durationSec: number) {\n\t\tclearInterval(this.countDownTimeInterval)\n\t\tthis.countDownTimeInterval = undefined\n\n\t\tlet remaining = durationSec\n\n\t\tfunction renderCountdownTime(time: number) {\n\t\t\treturn `Starting ${time} `\n\t\t}\n\n\t\tthis.setWatchLabel(renderCountdownTime(remaining))\n\n\t\tthis.countDownTimeInterval = setInterval(() => {\n\t\t\tremaining--\n\n\t\t\tif (remaining < 0) {\n\t\t\t\tthis.stopCountdownTimer()\n\t\t\t} else {\n\t\t\t\tthis.setWatchLabel(renderCountdownTime(remaining))\n\t\t\t}\n\t\t}, 1000) as any\n\t}\n\n\tpublic stopCountdownTimer() {\n\t\tclearInterval(this.countDownTimeInterval)\n\t\tthis.countDownTimeInterval = undefined\n\t\tthis.setWatchMode(this.watchMode)\n\t}\n\n\tpublic setWatchMode(watchMode: WatchMode) {\n\t\tthis.watchMode = watchMode\n\t\tif (!this.countDownTimeInterval) {\n\t\t\tlet label = watchMode === 'smart' ? 'Smart Watch' : 'Standard Watch'\n\t\t\tif (watchMode === 'off') {\n\t\t\t\tlabel = 'Not Watching'\n\t\t\t}\n\t\t\tthis.setWatchLabel(label)\n\t\t}\n\t}\n\n\tprivate setWatchLabel(label: string) {\n\t\tconst isWatching = this.watchMode !== 'off'\n\n\t\tthis.menu.setTextForItem(\n\t\t\t'watchDropdown',\n\t\t\t`${label} ^${isWatching ? 'k' : 'w'}^#^${isWatching ? 'g' : 'r'}${\n\t\t\t\tisWatching ? ' • ' : ' • '\n\t\t\t}^`\n\t\t)\n\n\t\tthis.menu.setTextForItem(\n\t\t\t'toggleStandardWatch',\n\t\t\tthis.watchMode === 'standard' ? '√ Standard' : 'Standard'\n\t\t)\n\n\t\tthis.menu.setTextForItem(\n\t\t\t'toggleSmartWatch',\n\t\t\tthis.watchMode === 'smart' ? '√ Smart' : 'Smart'\n\t\t)\n\t}\n\n\tpublic async start() {\n\t\tthis.started = true\n\n\t\tthis.window = this.widgetFactory.Widget('window', {})\n\t\tthis.window.hideCursor()\n\n\t\tconst { width } = this.window.getFrame()\n\t\tif (width < this.minWidth) {\n\t\t\tthrow new Error(\n\t\t\t\t`Your screen must be at least ${this.minWidth} characters wide.`\n\t\t\t)\n\t\t}\n\n\t\tvoid this.window.on('key', this.handleGlobalKeypress.bind(this))\n\t\tvoid this.window.on('kill', this.destroy.bind(this))\n\t\tvoid this.window.on('resize', this.handleWindowResize.bind(this))\n\n\t\tthis.dropInTopLayout()\n\t\tthis.dropInProgressBar()\n\t\tthis.dropInMenu()\n\t\tthis.dropInBottomLayout()\n\t\tthis.dropInStatusBar()\n\t\tthis.dropInTestLog()\n\t\tthis.dropInFilterControls()\n\n\t\tthis.updateOrientation()\n\n\t\tthis.setIsDebugging(this.isDebugging)\n\t\tthis.setWatchMode(this.watchMode)\n\t\tthis.setStatus(this.status)\n\n\t\tthis.updateInterval = setInterval(\n\t\t\tthis.handleUpdateInterval.bind(this),\n\t\t\t1000\n\t\t)\n\t}\n\n\tprivate handleWindowResize() {\n\t\tthis.updateOrientation()\n\t}\n\n\tprivate updateOrientation() {\n\t\tconst frame = this.window.getFrame()\n\n\t\tif (frame.width * 0.5 > frame.height) {\n\t\t\tthis.orientation = 'landscape'\n\t\t} else {\n\t\t\tthis.orientation = 'portrait'\n\t\t}\n\t}\n\n\tprivate dropInMenu() {\n\t\tthis.menu = this.widgetFactory.Widget('menuBar', {\n\t\t\tparent: this.window,\n\t\t\tleft: 0,\n\t\t\ttop: 0,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\titems: [\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Restart ',\n\t\t\t\t\tvalue: 'restart',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Debug ',\n\t\t\t\t\tvalue: 'toggleDebug',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Not Watching ',\n\t\t\t\t\tvalue: 'watchDropdown',\n\t\t\t\t\titems: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: 'Watch all',\n\t\t\t\t\t\t\tvalue: 'toggleStandardWatch',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: 'Smart watch',\n\t\t\t\t\t\t\tvalue: 'toggleSmartWatch',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Quit',\n\t\t\t\t\tvalue: 'quit',\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\n\t\tvoid this.menu.on('select', this.handleMenuSelect.bind(this))\n\t}\n\n\tpublic setStatus(status: TestRunnerStatus) {\n\t\tthis.status = status\n\n\t\tthis.updateMenuLabels()\n\t\tthis.closeSelectTestPopup()\n\t\tthis.bottomLayout.updateLayout()\n\n\t\tif (status === 'ready') {\n\t\t\tthis.setStatusLabel('Starting...')\n\t\t} else if (this.status === 'stopped') {\n\t\t\tthis.refreshResults()\n\t\t\tthis.setStatusLabel('')\n\t\t} else if (this.status === 'running') {\n\t\t\tthis.setStatusLabel('Running tests...')\n\t\t}\n\t}\n\n\tprivate updateMenuLabels() {\n\t\tlet restartLabel = 'Start ^#^r › ^'\n\t\tswitch (this.status) {\n\t\t\tcase 'running':\n\t\t\t\trestartLabel = 'Stop ^k^#^g › ^'\n\t\t\t\tbreak\n\t\t\tcase 'stopped':\n\t\t\t\trestartLabel = `Start ^w^#^r › ^`\n\t\t\t\tbreak\n\t\t\tcase 'ready':\n\t\t\t\trestartLabel = 'Booting ^#^K › ^'\n\t\t\t\tbreak\n\t\t}\n\n\t\tthis.menu.setTextForItem('restart', restartLabel)\n\t}\n\n\tprivate handleMenuSelect(payload: { value: string }) {\n\t\tswitch (payload.value) {\n\t\t\tcase 'quit':\n\t\t\t\tthis.handleQuit?.()\n\t\t\t\tbreak\n\t\t\tcase 'restart':\n\t\t\t\tthis.handleStartStop?.()\n\t\t\t\tbreak\n\t\t\tcase 'toggleDebug':\n\t\t\t\tthis.handleToggleDebug?.()\n\t\t\t\tbreak\n\t\t\tcase 'toggleStandardWatch':\n\t\t\t\tthis.handletoggleStandardWatch?.()\n\t\t\t\tbreak\n\t\t\tcase 'toggleSmartWatch':\n\t\t\t\tthis.handleToggleSmartWatch?.()\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tprivate handleUpdateInterval() {\n\t\tif (this.status !== 'stopped') {\n\t\t\tthis.refreshResults()\n\t\t}\n\t}\n\n\tprivate refreshResults() {\n\t\tif (this.lastResults) {\n\t\t\tthis.updateLogs()\n\t\t}\n\t}\n\n\tprivate async handleGlobalKeypress(payload: { key: string }) {\n\t\tif (this.window.getFocusedWidget() === this.filterInput) {\n\t\t\treturn\n\t\t}\n\n\t\tswitch (payload.key) {\n\t\t\tcase 'ENTER':\n\t\t\t\tthis.handleRestart?.()\n\t\t\t\tbreak\n\t\t\tcase 'CTRL_C':\n\t\t\t\tthis.handleQuit?.()\n\t\t\t\tprocess.exit()\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tprivate dropInTestLog() {\n\t\tconst parent = this.bottomLayout.getChildById('results')\n\n\t\tif (parent) {\n\t\t\tthis.testLog = this.widgetFactory.Widget('text', {\n\t\t\t\tparent,\n\t\t\t\tisScrollEnabled: true,\n\t\t\t\tleft: 0,\n\t\t\t\ttop: 0,\n\t\t\t\theight: '100%',\n\t\t\t\twidth: '100%',\n\t\t\t\tshouldLockHeightWithParent: true,\n\t\t\t\tshouldLockWidthWithParent: true,\n\t\t\t})\n\n\t\t\tvoid this.testLog.on('click', this.handleClickTestLog.bind(this))\n\t\t}\n\t}\n\n\tprivate async handleClickTestLog(payload: { row: number; column: number }) {\n\t\tconst testFile = this.getFileForLine(payload.row)\n\t\tconst { row, column } = payload\n\n\t\tthis.closeSelectTestPopup()\n\n\t\tif (testFile) {\n\t\t\tthis.dropInSelectTestPopup({ testFile, column, row })\n\t\t}\n\t}\n\n\tprivate closeSelectTestPopup() {\n\t\tif (this.selectTestPopup) {\n\t\t\tvoid this.selectTestPopup.destroy()\n\t\t\tthis.selectTestPopup = undefined\n\t\t}\n\t}\n\n\tprivate dropInSelectTestPopup(options: {\n\t\ttestFile: string\n\t\tcolumn: number\n\t\trow: number\n\t}) {\n\t\tconst { testFile, row, column } = options\n\n\t\tthis.selectTestPopup = this.widgetFactory.Widget('popup', {\n\t\t\tparent: this.window,\n\t\t\tleft: Math.max(1, column - 25),\n\t\t\ttop: Math.max(4, row - 2),\n\t\t\twidth: 50,\n\t\t\theight: 10,\n\t\t})\n\n\t\tthis.widgetFactory.Widget('text', {\n\t\t\tparent: this.selectTestPopup,\n\t\t\tleft: 1,\n\t\t\ttop: 1,\n\t\t\theight: 4,\n\t\t\twidth: this.selectTestPopup.getFrame().width - 2,\n\t\t\ttext: `What do you wanna do with:\\n\\n${testFile}`,\n\t\t})\n\n\t\tconst open = this.widgetFactory.Widget('button', {\n\t\t\tparent: this.selectTestPopup,\n\t\t\tleft: 1,\n\t\t\ttop: 6,\n\t\t\ttext: 'Open',\n\t\t})\n\n\t\tconst rerun = this.widgetFactory.Widget('button', {\n\t\t\tparent: this.selectTestPopup,\n\t\t\tleft: 20,\n\t\t\ttop: 6,\n\t\t\ttext: 'Test',\n\t\t})\n\n\t\tconst cancel = this.widgetFactory.Widget('button', {\n\t\t\tparent: this.selectTestPopup,\n\t\t\tleft: 37,\n\t\t\ttop: 6,\n\t\t\ttext: 'Nevermind',\n\t\t})\n\n\t\tvoid rerun.on('click', () => {\n\t\t\tthis.handleRerunTestFile?.(testFile)\n\t\t\tthis.closeSelectTestPopup()\n\t\t})\n\t\tvoid cancel.on('click', this.closeSelectTestPopup.bind(this))\n\t\tvoid open.on('click', () => {\n\t\t\tthis.openTestFile(testFile)\n\t\t})\n\t}\n\n\tprivate openTestFile(testFile: string) {\n\t\tthis.handleOpenTestFile?.(testFile)\n\t\tthis.closeSelectTestPopup()\n\t}\n\n\tpublic getFileForLine(row: number): string | undefined {\n\t\tlet line = this.testLog.getScrollY()\n\n\t\tfor (let file of this.lastResults.testFiles ?? []) {\n\t\t\tif (line === row) {\n\t\t\t\treturn file.path\n\t\t\t}\n\n\t\t\tline++\n\n\t\t\tfor (let c = 0; c < (file.tests ?? []).length; c++) {\n\t\t\t\tif (line === row) {\n\t\t\t\t\treturn file.path\n\t\t\t\t}\n\n\t\t\t\tline++\n\t\t\t}\n\t\t}\n\n\t\treturn undefined\n\t}\n\n\tprivate dropInProgressBar() {\n\t\tconst parent = this.topLayout.getChildById('progress') ?? this.window\n\t\tthis.bar = this.widgetFactory.Widget('progressBar', {\n\t\t\tparent,\n\t\t\tleft: 0,\n\t\t\ttop: 0,\n\t\t\twidth: parent.getFrame().width,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tlabel: 'Ready and waiting...',\n\t\t\tprogress: 0,\n\t\t})\n\t}\n\n\tprivate dropInFilterControls() {\n\t\tconst parent = this.topLayout.getChildById('filter') ?? this.window\n\n\t\tconst buttonWidth = 3\n\t\tthis.filterInput = this.widgetFactory.Widget('input', {\n\t\t\tparent,\n\t\t\tleft: 0,\n\t\t\tlabel: 'Pattern',\n\t\t\twidth: parent.getFrame().width - buttonWidth,\n\t\t\theight: 1,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tvalue: this.filterPattern,\n\t\t})\n\n\t\tvoid this.filterInput.on('cancel', () => {\n\t\t\tthis.filterInput.setValue(this.filterPattern ?? '')\n\t\t})\n\n\t\tvoid this.filterInput.on('submit', (payload) => {\n\t\t\tthis.handleFilterChange?.(payload.value ?? undefined)\n\t\t})\n\n\t\tthis.clearFilterPatternButton = this.widgetFactory.Widget('button', {\n\t\t\tparent,\n\t\t\tleft: this.filterInput.getFrame().width,\n\t\t\twidth: buttonWidth,\n\t\t\ttop: 0,\n\t\t\ttext: buildPatternButtonText(this.filterPattern),\n\t\t\tshouldLockRightWithParent: true,\n\t\t})\n\n\t\tvoid this.clearFilterPatternButton.on('click', () => {\n\t\t\tif (this.filterPattern || this.filterPattern?.length === 0) {\n\t\t\t\tthis.handleFilterChange?.(undefined)\n\t\t\t} else {\n\t\t\t\tthis.filterInput.setValue('')\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate dropInBottomLayout() {\n\t\tthis.bottomLayout = this.widgetFactory.Widget('layout', {\n\t\t\tparent: this.window,\n\t\t\twidth: '100%',\n\t\t\ttop: 4,\n\t\t\theight: this.window.getFrame().height - 5,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tshouldLockHeightWithParent: true,\n\t\t\trows: [\n\t\t\t\t{\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 'results',\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\t}\n\n\tprivate dropInStatusBar() {\n\t\tthis.statusBar = this.widgetFactory.Widget('text', {\n\t\t\tparent: this.window,\n\t\t\ttop: this.window.getFrame().height - 1,\n\t\t\twidth: '100%',\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tshouldLockBottomWithParent: true,\n\t\t\tbackgroundColor: 'yellow',\n\t\t\tforegroundColor: 'black',\n\t\t\ttext: '...',\n\t\t})\n\t}\n\n\tprivate dropInTopLayout() {\n\t\tthis.topLayout = this.widgetFactory.Widget('layout', {\n\t\t\tparent: this.window,\n\t\t\twidth: '100%',\n\t\t\ttop: 1,\n\t\t\theight: 3,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tshouldLockHeightWithParent: false,\n\t\t\trows: [\n\t\t\t\t{\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 'progress',\n\t\t\t\t\t\t\twidth: 50,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 'filter',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\t}\n\n\tpublic updateResults(results: SpruceTestResults) {\n\t\tif (!this.started) {\n\t\t\tthrow new Error('You must call start() before anything else.')\n\t\t}\n\n\t\tthis.lastResults = {\n\t\t\t...this.lastResults,\n\t\t\t...results,\n\t\t}\n\n\t\tthis.updateProgressBar(results)\n\n\t\tconst percentPassing = this.generatePercentPassing(results)\n\t\tconst percentComplete = this.generatePercentComplete(results)\n\n\t\tthis.window.setTitle(\n\t\t\t`Testing: ${percentComplete}% complete.${\n\t\t\t\tpercentComplete > 0 ? ` ${percentPassing}% passing.` : ''\n\t\t\t}`\n\t\t)\n\n\t\tthis.updateLogs()\n\t}\n\n\tprivate updateLogs() {\n\t\tif (this.selectTestPopup) {\n\t\t\treturn\n\t\t}\n\n\t\tlet { logContent, errorContent } = this.resultsToLogContents(\n\t\t\tthis.lastResults\n\t\t)\n\n\t\tthis.testLog.setText(logContent)\n\n\t\tif (!errorContent) {\n\t\t\tthis.errorLog && this.destroyErrorLog()\n\t\t} else {\n\t\t\t!this.errorLog && this.dropInErrorLog()\n\t\t\tconst cleanedLog = this.cwd\n\t\t\t\t? errorContent.replace(new RegExp(this.cwd + '/', 'gim'), '')\n\t\t\t\t: errorContent\n\n\t\t\tthis.errorLog?.setText(cleanedLog)\n\t\t}\n\t}\n\n\tprivate resultsToLogContents(results: SpruceTestResults) {\n\t\tlet logContent = ''\n\t\tlet errorContent = ''\n\n\t\tresults.testFiles?.forEach((file) => {\n\t\t\tlogContent += this.errorLogItemGenerator.generateLogItemForFile(\n\t\t\t\tfile,\n\t\t\t\tthis.status\n\t\t\t)\n\t\t\terrorContent +=\n\t\t\t\tthis.errorLogItemGenerator.generateErrorLogItemForFile(file)\n\t\t})\n\n\t\tif (this.lastResults.customErrors.length > 0) {\n\t\t\terrorContent =\n\t\t\t\tthis.lastResults.customErrors.map((err) => chalk.red(err)).join(`\\n`) +\n\t\t\t\t`\\n${errorContent}`\n\t\t}\n\n\t\treturn { logContent, errorContent }\n\t}\n\n\tprivate dropInErrorLog() {\n\t\tthis.orientationWhenErrorLogWasShown = this.orientation\n\n\t\tif (this.bottomLayout.getRows().length === 1) {\n\t\t\tif (this.orientation === 'portrait') {\n\t\t\t\tthis.bottomLayout.addRow({\n\t\t\t\t\tid: 'row_2',\n\t\t\t\t\tcolumns: [{ id: 'errors', width: '100%' }],\n\t\t\t\t})\n\n\t\t\t\tthis.bottomLayout.setRowHeight(0, '50%')\n\t\t\t\tthis.bottomLayout.setRowHeight(1, '50%')\n\t\t\t} else {\n\t\t\t\tthis.bottomLayout.addColumn(0, { id: 'errors', width: '50%' })\n\t\t\t\tthis.bottomLayout.setColumnWidth({\n\t\t\t\t\trowIdx: 0,\n\t\t\t\t\tcolumnIdx: 0,\n\t\t\t\t\twidth: '50%',\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tthis.bottomLayout.updateLayout()\n\n\t\t\tconst cell = this.bottomLayout.getChildById('errors')\n\n\t\t\tif (!cell) {\n\t\t\t\tthrow new Error('Pulling child error')\n\t\t\t}\n\n\t\t\tthis.errorLog = this.widgetFactory.Widget('text', {\n\t\t\t\tparent: cell,\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%',\n\t\t\t\tisScrollEnabled: true,\n\t\t\t\tshouldAutoScrollWhenAppendingContent: false,\n\t\t\t\tshouldLockHeightWithParent: true,\n\t\t\t\tshouldLockWidthWithParent: true,\n\t\t\t\tpadding: { left: 1 },\n\t\t\t})\n\t\t}\n\t}\n\n\tprivate destroyErrorLog() {\n\t\tif (this.errorLog) {\n\t\t\tvoid this.errorLog?.destroy()\n\t\t\tthis.errorLog = undefined\n\n\t\t\tif (this.orientationWhenErrorLogWasShown === 'landscape') {\n\t\t\t\tthis.bottomLayout.removeColumn(0, 1)\n\t\t\t\tthis.bottomLayout.setColumnWidth({\n\t\t\t\t\trowIdx: 0,\n\t\t\t\t\tcolumnIdx: 0,\n\t\t\t\t\twidth: '100%',\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tthis.bottomLayout.removeRow(1)\n\t\t\t\tthis.bottomLayout.setRowHeight(0, '100%')\n\t\t\t}\n\t\t\tthis.bottomLayout.updateLayout()\n\t\t}\n\t}\n\n\tprivate updateProgressBar(results: SpruceTestResults) {\n\t\tif (results.totalTestFilesComplete ?? 0 > 0) {\n\t\t\tconst testsRemaining =\n\t\t\t\tresults.totalTestFiles - (results.totalTestFilesComplete ?? 0)\n\n\t\t\tif (testsRemaining === 0) {\n\t\t\t\tconst { percent, totalTests, totalPassedTests, totalTime } =\n\t\t\t\t\tthis.generateProgressStats(results)\n\n\t\t\t\tthis.bar.setLabel(\n\t\t\t\t\t`Finished! ${totalPassedTests} of ${totalTests} (${percent}%) passed in ${durationUtil.msToFriendly(\n\t\t\t\t\t\ttotalTime\n\t\t\t\t\t)}.${percent < 100 ? ` Don't give up! 💪` : ''}`\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tthis.bar.setLabel(\n\t\t\t\t\t`${results.totalTestFilesComplete} of ${\n\t\t\t\t\t\tresults.totalTestFiles\n\t\t\t\t\t} (${this.generatePercentComplete(\n\t\t\t\t\t\tresults\n\t\t\t\t\t)}%) complete. ${testsRemaining} remaining...`\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tthis.bar.setLabel('0%')\n\t\t}\n\n\t\tthis.bar.setProgress(this.generatePercentComplete(results) / 100)\n\t}\n\n\tprivate generateProgressStats(results: SpruceTestResults): {\n\t\tpercent: number\n\t\ttotalTests: number\n\t\ttotalPassedTests: number\n\t\ttotalTime: number\n\t} {\n\t\tlet totalTests = 0\n\t\tlet totalPassedTests = 0\n\t\tlet totalTime = 0\n\n\t\tresults.testFiles?.forEach((file) => {\n\t\t\tfile.tests?.forEach((test) => {\n\t\t\t\ttotalTime += test.duration\n\t\t\t\tif (test.status === 'passed') {\n\t\t\t\t\ttotalPassedTests++\n\t\t\t\t}\n\n\t\t\t\tif (test.status === 'passed' || test.status === 'failed') {\n\t\t\t\t\ttotalTests++\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\n\t\tconst percent = Math.floor((totalPassedTests / totalTests) * 100)\n\t\treturn {\n\t\t\tpercent: percent > 0 ? percent : 0,\n\t\t\ttotalTests,\n\t\t\ttotalPassedTests,\n\t\t\ttotalTime,\n\t\t}\n\t}\n\n\tprivate generatePercentComplete(results: SpruceTestResults): number {\n\t\tconst percent =\n\t\t\t(results.totalTestFilesComplete ?? 0) / results.totalTestFiles\n\t\tif (isNaN(percent)) {\n\t\t\treturn 0\n\t\t}\n\t\treturn Math.round(percent * 100)\n\t}\n\n\tprivate generatePercentPassing(results: SpruceTestResults): number {\n\t\tconst percent =\n\t\t\t(results.totalPassed ?? 0) / this.getTotalTestFilesRun(results)\n\n\t\tif (isNaN(percent)) {\n\t\t\treturn 0\n\t\t}\n\n\t\treturn Math.floor(percent * 100)\n\t}\n\n\tprivate getTotalTestFilesRun(results: SpruceTestResults) {\n\t\treturn (\n\t\t\t(results.totalTests ?? 0) -\n\t\t\t(results.totalSkipped ?? 0) -\n\t\t\t(results.totalTodo ?? 0)\n\t\t)\n\t}\n\n\tpublic render() {\n\t\tthis.table?.computeCells()\n\t\tthis.table?.draw()\n\t}\n\n\tpublic async destroy() {\n\t\tclearInterval(this.updateInterval)\n\t\tawait this.window.destroy()\n\t}\n\n\tpublic reset() {\n\t\tthis.testLog.setText('')\n\t\tthis.lastResults = {\n\t\t\ttotalTestFiles: 0,\n\t\t\tcustomErrors: [],\n\t\t}\n\t\tthis.destroyErrorLog()\n\t\tthis.errorLogItemGenerator.resetStartTimes()\n\t}\n\n\tpublic setStatusLabel(text: string) {\n\t\tthis.statusBar.setText(text)\n\t}\n\n\tpublic appendError(message: string) {\n\t\tthis.lastResults.customErrors.push(message)\n\t}\n}\nfunction buildPatternButtonText(pattern: string | undefined): string {\n\treturn pattern ? ' x ' : ' - '\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;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;WAED,kBAAgB;MAAA;;MACf,oBAAKC,KAAL,4DAAYC,YAAZ;MACA,qBAAKD,KAAL,8DAAYE,IAAZ;IACA;;;;mGAED;QAAA;UAAA;YAAA;cAAA;gBACC9J,aAAa,CAAC,KAAKmC,cAAN,CAAb;gBADD;gBAAA,OAEO,KAAKtB,MAAL,CAAYU,OAAZ,EAFP;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;WAKA,iBAAe;MACd,KAAKuC,OAAL,CAAanE,OAAb,CAAqB,EAArB;MACA,KAAK4D,WAAL,GAAmB;QAClBrF,cAAc,EAAE,CADE;QAElBC,YAAY,EAAE;MAFI,CAAnB;MAIA,KAAK2I,eAAL;MACA,KAAK3H,qBAAL,CAA2B4K,eAA3B;IACA;;;WAED,wBAAsBrF,IAAtB,EAAoC;MACnC,KAAKqB,SAAL,CAAepG,OAAf,CAAuB+E,IAAvB;IACA;;;WAED,qBAAmBsF,OAAnB,EAAoC;MACnC,KAAKzG,WAAL,CAAiBpF,YAAjB,CAA8B8L,IAA9B,CAAmCD,OAAnC;IACA;;;;;;;AAEF,SAASpK,sBAAT,CAAgCL,OAAhC,EAAqE;EACpE,OAAOA,OAAO,GAAG,KAAH,GAAW,KAAzB;AACA"}
@@ -1 +1 @@
1
- {"version":3,"file":"TestRunner.js","names":["testRunnerContract","eventSignatures","emitPayloadSchema","id","fields","message","type","isRequired","results","options","valueType","TestRunner","totalTestFiles","cwd","commandService","wasKilled","jestPath","resolvePathToJest","debugArgs","debugPort","pattern","escapeShell","cmd","replace","command","parser","JestJsonParser","testResults","execute","forceColor","onError","data","isDebugMessaging","isDebugMessage","emit","onData","write","getResults","search","totalFailed","totalSkipped","kill","fullPath","diskUtil","resolvePath","pathParts","split","pathUtil","sep","length","path","join","doesFileExist","pop","SpruceError","code","dir","AbstractEventEmitter"],"sources":["../../../src/features/test/TestRunner.ts"],"sourcesContent":["import pathUtil from 'path'\nimport { AbstractEventEmitter } from '@sprucelabs/mercury-event-emitter'\nimport {\n\tbuildEventContract,\n\tMercuryEventEmitter,\n} from '@sprucelabs/mercury-types'\nimport { buildSchema } from '@sprucelabs/schema'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport SpruceError from '../../errors/SpruceError'\nimport CommandService from '../../services/CommandService'\nimport JestJsonParser from '../../tests/JestJsonParser'\nimport { SpruceTestResults } from './test.types'\n\nconst testRunnerContract = buildEventContract({\n\teventSignatures: {\n\t\t'did-error': {\n\t\t\temitPayloadSchema: buildSchema({\n\t\t\t\tid: 'testRunnerDidErrorEmitPayload',\n\t\t\t\tfields: {\n\t\t\t\t\tmessage: {\n\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\tisRequired: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t},\n\t\t'did-update': {\n\t\t\temitPayloadSchema: buildSchema({\n\t\t\t\tid: 'testRunnerDidUpdateEmitPayload',\n\t\t\t\tfields: {\n\t\t\t\t\tresults: {\n\t\t\t\t\t\ttype: 'raw',\n\t\t\t\t\t\tisRequired: true,\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tvalueType: 'SpruceTestResults',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t},\n\t},\n})\ntype TestRunnerContract = typeof testRunnerContract\n\nexport default class TestRunner extends AbstractEventEmitter<TestRunnerContract> {\n\tprivate cwd: string\n\tprivate commandService: CommandService\n\tprivate wasKilled = false\n\tprivate testResults: SpruceTestResults = { totalTestFiles: 0 }\n\n\tpublic constructor(options: { cwd: string; commandService: CommandService }) {\n\t\tsuper(testRunnerContract)\n\t\tthis.cwd = options.cwd\n\t\tthis.commandService = options.commandService\n\t}\n\n\tpublic async run(options?: {\n\t\tpattern?: string | null\n\t\tdebugPort?: number | null\n\t}): Promise<SpruceTestResults & { wasKilled: boolean }> {\n\t\tthis.wasKilled = false\n\n\t\tconst jestPath = this.resolvePathToJest()\n\t\tconst debugArgs =\n\t\t\t(options?.debugPort ?? 0) > 0 ? `--inspect=${options?.debugPort}` : ``\n\t\tconst pattern = options?.pattern ?? ''\n\t\tlet escapeShell = function (cmd: string) {\n\t\t\treturn '--testPathPattern=\"' + cmd.replace(/([\"\\s'$`\\\\])/g, '\\\\$1') + '\"'\n\t\t}\n\t\tconst command = `node --unhandled-rejections=strict ${debugArgs} ${jestPath} --reporters=\"@sprucelabs/jest-json-reporter\" --testRunner=\"jest-circus/runner\" --passWithNoTests ${\n\t\t\tpattern ? escapeShell(pattern) : ''\n\t\t}`\n\n\t\tconst parser = new JestJsonParser()\n\n\t\tthis.testResults = {\n\t\t\ttotalTestFiles: 0,\n\t\t}\n\n\t\ttry {\n\t\t\tawait this.commandService.execute(command, {\n\t\t\t\tforceColor: true,\n\t\t\t\tonError: async (data) => {\n\t\t\t\t\tconst isDebugMessaging = this.isDebugMessage(data)\n\n\t\t\t\t\tif (!isDebugMessaging) {\n\t\t\t\t\t\tawait (this as MercuryEventEmitter<TestRunnerContract>).emit(\n\t\t\t\t\t\t\t'did-error',\n\t\t\t\t\t\t\t{ message: data }\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tonData: async (data) => {\n\t\t\t\t\tparser.write(data)\n\t\t\t\t\tthis.testResults = parser.getResults()\n\t\t\t\t\tawait (this as MercuryEventEmitter<TestRunnerContract>).emit(\n\t\t\t\t\t\t'did-update',\n\t\t\t\t\t\t{ results: this.testResults }\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t})\n\t\t} catch (err) {\n\t\t\tif (!this.testResults.totalTestFiles) {\n\t\t\t\tthrow err\n\t\t\t}\n\t\t}\n\n\t\treturn { ...this.testResults, wasKilled: this.wasKilled }\n\t}\n\n\tprivate isDebugMessage(data: string) {\n\t\treturn (\n\t\t\tdata.search(/^ attached/i) === 0 ||\n\t\t\tdata.search(/^ listening/i) === 0 ||\n\t\t\tdata.search(/^waiting for the /i) === 0\n\t\t)\n\t}\n\n\tpublic hasFailedTests() {\n\t\treturn (this.testResults.totalFailed ?? 0) > 0\n\t}\n\n\tpublic hasSkippedTests() {\n\t\treturn (this.testResults.totalSkipped ?? 0) > 0\n\t}\n\n\tpublic kill() {\n\t\tthis.wasKilled = true\n\t\tthis.commandService.kill()\n\t}\n\n\tprivate resolvePathToJest() {\n\t\tconst jestPath = 'node_modules/.bin/jest'\n\t\tconst fullPath = diskUtil.resolvePath(this.cwd)\n\t\tconst pathParts = fullPath.split(pathUtil.sep)\n\n\t\twhile (pathParts.length > 0) {\n\t\t\tconst path =\n\t\t\t\tpathUtil.sep + pathUtil.join(...pathParts) + pathUtil.sep + jestPath\n\n\t\t\tif (diskUtil.doesFileExist(path)) {\n\t\t\t\treturn path\n\t\t\t}\n\n\t\t\tpathParts.pop()\n\t\t}\n\n\t\tthrow new SpruceError({ code: 'INVALID_TEST_DIRECTORY', dir: this.cwd })\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AAEA;;;;;;;;;;AAGA,IAAMA,kBAAkB,GAAG,sCAAmB;EAC7CC,eAAe,EAAE;IAChB,aAAa;MACZC,iBAAiB,EAAE,yBAAY;QAC9BC,EAAE,EAAE,+BAD0B;QAE9BC,MAAM,EAAE;UACPC,OAAO,EAAE;YACRC,IAAI,EAAE,MADE;YAERC,UAAU,EAAE;UAFJ;QADF;MAFsB,CAAZ;IADP,CADG;IAYhB,cAAc;MACbL,iBAAiB,EAAE,yBAAY;QAC9BC,EAAE,EAAE,gCAD0B;QAE9BC,MAAM,EAAE;UACPI,OAAO,EAAE;YACRF,IAAI,EAAE,KADE;YAERC,UAAU,EAAE,IAFJ;YAGRE,OAAO,EAAE;cACRC,SAAS,EAAE;YADH;UAHD;QADF;MAFsB,CAAZ;IADN;EAZE;AAD4B,CAAnB,CAA3B;;IA+BqBC,U;;;;;EAMpB,oBAAmBF,OAAnB,EAA6E;IAAA;;IAAA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;;;WAED,2BAAyB;MAAA;;MACxB,OAAO,2BAAC,KAAKZ,WAAL,CAAiBa,YAAlB,2EAAkC,CAAlC,IAAuC,CAA9C;IACA;;;WAED,gBAAc;MACb,KAAKzB,SAAL,GAAiB,IAAjB;MACA,KAAKD,cAAL,CAAoB2B,IAApB;IACA;;;WAED,6BAA4B;MAC3B,IAAMzB,QAAQ,GAAG,wBAAjB;;MACA,IAAM0B,QAAQ,GAAGC,2BAASC,WAAT,CAAqB,KAAK/B,GAA1B,CAAjB;;MACA,IAAMgC,SAAS,GAAGH,QAAQ,CAACI,KAAT,CAAeC,iBAASC,GAAxB,CAAlB;;MAEA,OAAOH,SAAS,CAACI,MAAV,GAAmB,CAA1B,EAA6B;QAC5B,IAAMC,IAAI,GACTH,iBAASC,GAAT,GAAeD,iBAASI,IAAT,6DAAiBN,SAAjB,EAAf,GAA6CE,iBAASC,GAAtD,GAA4DhC,QAD7D;;QAGA,IAAI2B,2BAASS,aAAT,CAAuBF,IAAvB,CAAJ,EAAkC;UACjC,OAAOA,IAAP;QACA;;QAEDL,SAAS,CAACQ,GAAV;MACA;;MAED,MAAM,IAAIC,uBAAJ,CAAgB;QAAEC,IAAI,EAAE,wBAAR;QAAkCC,GAAG,EAAE,KAAK3C;MAA5C,CAAhB,CAAN;IACA;;;EAxGsC4C,yC"}
1
+ {"version":3,"file":"TestRunner.js","names":["testRunnerContract","buildEventContract","eventSignatures","emitPayloadSchema","buildSchema","id","fields","message","type","isRequired","results","options","valueType","TestRunner","totalTestFiles","cwd","commandService","wasKilled","jestPath","resolvePathToJest","debugArgs","debugPort","pattern","escapeShell","cmd","replace","command","parser","JestJsonParser","testResults","execute","forceColor","onError","data","isDebugMessaging","isDebugMessage","emit","onData","write","getResults","search","totalFailed","totalSkipped","kill","fullPath","diskUtil","resolvePath","pathParts","split","pathUtil","sep","length","path","join","doesFileExist","pop","SpruceError","code","dir","AbstractEventEmitter"],"sources":["../../../src/features/test/TestRunner.ts"],"sourcesContent":["import pathUtil from 'path'\nimport { AbstractEventEmitter } from '@sprucelabs/mercury-event-emitter'\nimport {\n\tbuildEventContract,\n\tMercuryEventEmitter,\n} from '@sprucelabs/mercury-types'\nimport { buildSchema } from '@sprucelabs/schema'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport SpruceError from '../../errors/SpruceError'\nimport CommandService from '../../services/CommandService'\nimport JestJsonParser from '../../tests/JestJsonParser'\nimport { SpruceTestResults } from './test.types'\n\nconst testRunnerContract = buildEventContract({\n\teventSignatures: {\n\t\t'did-error': {\n\t\t\temitPayloadSchema: buildSchema({\n\t\t\t\tid: 'testRunnerDidErrorEmitPayload',\n\t\t\t\tfields: {\n\t\t\t\t\tmessage: {\n\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\tisRequired: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t},\n\t\t'did-update': {\n\t\t\temitPayloadSchema: buildSchema({\n\t\t\t\tid: 'testRunnerDidUpdateEmitPayload',\n\t\t\t\tfields: {\n\t\t\t\t\tresults: {\n\t\t\t\t\t\ttype: 'raw',\n\t\t\t\t\t\tisRequired: true,\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tvalueType: 'SpruceTestResults',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t},\n\t},\n})\ntype TestRunnerContract = typeof testRunnerContract\n\nexport default class TestRunner extends AbstractEventEmitter<TestRunnerContract> {\n\tprivate cwd: string\n\tprivate commandService: CommandService\n\tprivate wasKilled = false\n\tprivate testResults: SpruceTestResults = { totalTestFiles: 0 }\n\n\tpublic constructor(options: { cwd: string; commandService: CommandService }) {\n\t\tsuper(testRunnerContract)\n\t\tthis.cwd = options.cwd\n\t\tthis.commandService = options.commandService\n\t}\n\n\tpublic async run(options?: {\n\t\tpattern?: string | null\n\t\tdebugPort?: number | null\n\t}): Promise<SpruceTestResults & { wasKilled: boolean }> {\n\t\tthis.wasKilled = false\n\n\t\tconst jestPath = this.resolvePathToJest()\n\t\tconst debugArgs =\n\t\t\t(options?.debugPort ?? 0) > 0 ? `--inspect=${options?.debugPort}` : ``\n\t\tconst pattern = options?.pattern ?? ''\n\t\tlet escapeShell = function (cmd: string) {\n\t\t\treturn '--testPathPattern=\"' + cmd.replace(/([\"\\s'$`\\\\])/g, '\\\\$1') + '\"'\n\t\t}\n\t\tconst command = `node --unhandled-rejections=strict ${debugArgs} ${jestPath} --reporters=\"@sprucelabs/jest-json-reporter\" --testRunner=\"jest-circus/runner\" --passWithNoTests ${\n\t\t\tpattern ? escapeShell(pattern) : ''\n\t\t}`\n\n\t\tconst parser = new JestJsonParser()\n\n\t\tthis.testResults = {\n\t\t\ttotalTestFiles: 0,\n\t\t}\n\n\t\ttry {\n\t\t\tawait this.commandService.execute(command, {\n\t\t\t\tforceColor: true,\n\t\t\t\tonError: async (data) => {\n\t\t\t\t\tconst isDebugMessaging = this.isDebugMessage(data)\n\n\t\t\t\t\tif (!isDebugMessaging) {\n\t\t\t\t\t\tawait (this as MercuryEventEmitter<TestRunnerContract>).emit(\n\t\t\t\t\t\t\t'did-error',\n\t\t\t\t\t\t\t{ message: data }\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tonData: async (data) => {\n\t\t\t\t\tparser.write(data)\n\t\t\t\t\tthis.testResults = parser.getResults()\n\t\t\t\t\tawait (this as MercuryEventEmitter<TestRunnerContract>).emit(\n\t\t\t\t\t\t'did-update',\n\t\t\t\t\t\t{ results: this.testResults }\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t})\n\t\t} catch (err) {\n\t\t\tif (!this.testResults.totalTestFiles) {\n\t\t\t\tthrow err\n\t\t\t}\n\t\t}\n\n\t\treturn { ...this.testResults, wasKilled: this.wasKilled }\n\t}\n\n\tprivate isDebugMessage(data: string) {\n\t\treturn (\n\t\t\tdata.search(/^ attached/i) === 0 ||\n\t\t\tdata.search(/^ listening/i) === 0 ||\n\t\t\tdata.search(/^waiting for the /i) === 0\n\t\t)\n\t}\n\n\tpublic hasFailedTests() {\n\t\treturn (this.testResults.totalFailed ?? 0) > 0\n\t}\n\n\tpublic hasSkippedTests() {\n\t\treturn (this.testResults.totalSkipped ?? 0) > 0\n\t}\n\n\tpublic kill() {\n\t\tthis.wasKilled = true\n\t\tthis.commandService.kill()\n\t}\n\n\tprivate resolvePathToJest() {\n\t\tconst jestPath = 'node_modules/.bin/jest'\n\t\tconst fullPath = diskUtil.resolvePath(this.cwd)\n\t\tconst pathParts = fullPath.split(pathUtil.sep)\n\n\t\twhile (pathParts.length > 0) {\n\t\t\tconst path =\n\t\t\t\tpathUtil.sep + pathUtil.join(...pathParts) + pathUtil.sep + jestPath\n\n\t\t\tif (diskUtil.doesFileExist(path)) {\n\t\t\t\treturn path\n\t\t\t}\n\n\t\t\tpathParts.pop()\n\t\t}\n\n\t\tthrow new SpruceError({ code: 'INVALID_TEST_DIRECTORY', dir: this.cwd })\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AAEA;;;;;;;;;;AAGA,IAAMA,kBAAkB,GAAG,IAAAC,gCAAA,EAAmB;EAC7CC,eAAe,EAAE;IAChB,aAAa;MACZC,iBAAiB,EAAE,IAAAC,mBAAA,EAAY;QAC9BC,EAAE,EAAE,+BAD0B;QAE9BC,MAAM,EAAE;UACPC,OAAO,EAAE;YACRC,IAAI,EAAE,MADE;YAERC,UAAU,EAAE;UAFJ;QADF;MAFsB,CAAZ;IADP,CADG;IAYhB,cAAc;MACbN,iBAAiB,EAAE,IAAAC,mBAAA,EAAY;QAC9BC,EAAE,EAAE,gCAD0B;QAE9BC,MAAM,EAAE;UACPI,OAAO,EAAE;YACRF,IAAI,EAAE,KADE;YAERC,UAAU,EAAE,IAFJ;YAGRE,OAAO,EAAE;cACRC,SAAS,EAAE;YADH;UAHD;QADF;MAFsB,CAAZ;IADN;EAZE;AAD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vB,OAAO,0BAAC,KAAKX,WAAL,CAAiBY,WAAlB,yEAAiC,CAAjC,IAAsC,CAA7C;IACA;;;WAED,2BAAyB;MAAA;;MACxB,OAAO,2BAAC,KAAKZ,WAAL,CAAiBa,YAAlB,2EAAkC,CAAlC,IAAuC,CAA9C;IACA;;;WAED,gBAAc;MACb,KAAKzB,SAAL,GAAiB,IAAjB;MACA,KAAKD,cAAL,CAAoB2B,IAApB;IACA;;;WAED,6BAA4B;MAC3B,IAAMzB,QAAQ,GAAG,wBAAjB;;MACA,IAAM0B,QAAQ,GAAGC,0BAAA,CAASC,WAAT,CAAqB,KAAK/B,GAA1B,CAAjB;;MACA,IAAMgC,SAAS,GAAGH,QAAQ,CAACI,KAAT,CAAeC,gBAAA,CAASC,GAAxB,CAAlB;;MAEA,OAAOH,SAAS,CAACI,MAAV,GAAmB,CAA1B,EAA6B;QAC5B,IAAMC,IAAI,GACTH,gBAAA,CAASC,GAAT,GAAeD,gBAAA,CAASI,IAAT,OAAAJ,gBAAA,sCAAiBF,SAAjB,EAAf,GAA6CE,gBAAA,CAASC,GAAtD,GAA4DhC,QAD7D;;QAGA,IAAI2B,0BAAA,CAASS,aAAT,CAAuBF,IAAvB,CAAJ,EAAkC;UACjC,OAAOA,IAAP;QACA;;QAEDL,SAAS,CAACQ,GAAV;MACA;;MAED,MAAM,IAAIC,uBAAJ,CAAgB;QAAEC,IAAI,EAAE,wBAAR;QAAkCC,GAAG,EAAE,KAAK3C;MAA5C,CAAhB,CAAN;IACA;;;EAxGsC4C,yC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CreateAction.js","names":["CreateAction","createTestActionSchema","options","normalizedOptions","validateAndNormalizeOptions","testDestinationDir","namePascal","nameCamel","type","resolvedDestination","diskUtil","resolvePath","cwd","ui","startLoading","testFeature","parent","stopLoading","buildParentClassCandidates","candidates","doesDirExist","promptForSubDir","length","promptForParentTestClassAndOptionallyInstallDependencies","parentTestClass","writer","Writer","generateTest","namesUtil","toPascal","results","files","hints","subdirs","readDir","filter","d","isDir","prompt","label","isRequired","choices","value","map","dir","match","candidate","idx","optionallyInstallFeatureBasedOnSelection","buildParentClassFromCandidate","featureCode","featureInstaller","isInstalled","name","install","features","code","isDefaultExport","importPath","resolveRelativePath","path","replace","pathUtil","extname","AbstractAction"],"sources":["../../../../src/features/test/actions/CreateAction.ts"],"sourcesContent":["import pathUtil from 'path'\nimport { namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { SpruceSchemas } from '#spruce/schemas/schemas.types'\nimport createTestActionSchema from '#spruce/schemas/spruceCli/v2020_07_22/createTestOptions.schema'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\nimport TestFeature, { ParentClassCandidate } from '../TestFeature'\n\ntype OptionsSchema = SpruceSchemas.SpruceCli.v2020_07_22.CreateTestOptionsSchema\ntype Options = SpruceSchemas.SpruceCli.v2020_07_22.CreateTestOptions\n\nexport default class CreateAction extends AbstractAction<OptionsSchema> {\n\tpublic optionsSchema = createTestActionSchema\n\tpublic invocationMessage = 'Creating a test... 🛡'\n\n\tpublic async execute(options: Options): Promise<FeatureActionResponse> {\n\t\tconst normalizedOptions = this.validateAndNormalizeOptions(options)\n\t\tconst { testDestinationDir, namePascal, nameCamel, type } =\n\t\t\tnormalizedOptions\n\n\t\tlet resolvedDestination = diskUtil.resolvePath(\n\t\t\tthis.cwd,\n\t\t\ttestDestinationDir,\n\t\t\ttype\n\t\t)\n\n\t\tthis.ui.startLoading('Checking potential parent test classes')\n\n\t\tconst testFeature = this.parent as TestFeature\n\n\t\tthis.ui.stopLoading()\n\n\t\tlet parentTestClass:\n\t\t\t| undefined\n\t\t\t| { name: string; importPath: string; isDefaultExport: boolean }\n\n\t\tconst candidates = await testFeature.buildParentClassCandidates()\n\n\t\tif (diskUtil.doesDirExist(resolvedDestination)) {\n\t\t\tresolvedDestination = await this.promptForSubDir(\n\t\t\t\tresolvedDestination,\n\t\t\t\ttype\n\t\t\t)\n\t\t}\n\n\t\tif (candidates.length > 0) {\n\t\t\tparentTestClass =\n\t\t\t\tawait this.promptForParentTestClassAndOptionallyInstallDependencies(\n\t\t\t\t\tcandidates,\n\t\t\t\t\tparentTestClass,\n\t\t\t\t\tresolvedDestination\n\t\t\t\t)\n\t\t}\n\n\t\tthis.ui.startLoading('Generating test file...')\n\n\t\tconst writer = this.Writer('test')\n\n\t\tconst results = await writer.generateTest(resolvedDestination, {\n\t\t\t...normalizedOptions,\n\t\t\ttype,\n\t\t\tnameCamel,\n\t\t\tparentTestClass,\n\t\t\tnamePascal: namePascal ?? namesUtil.toPascal(nameCamel),\n\t\t})\n\n\t\treturn {\n\t\t\tfiles: results,\n\t\t\thints: [\"run `spruce test` in your skill when you're ready!\"],\n\t\t}\n\t}\n\tprivate async promptForSubDir(resolvedDestination: string, type: string) {\n\t\tconst subdirs = diskUtil\n\t\t\t.readDir(resolvedDestination)\n\t\t\t.filter((d) =>\n\t\t\t\tdiskUtil.isDir(diskUtil.resolvePath(resolvedDestination, d))\n\t\t\t)\n\n\t\tif (subdirs.length > 0) {\n\t\t\tconst match = await this.ui.prompt({\n\t\t\t\ttype: 'select',\n\t\t\t\tlabel: 'Where should I write this test?',\n\t\t\t\tisRequired: true,\n\t\t\t\toptions: {\n\t\t\t\t\tchoices: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvalue: '.',\n\t\t\t\t\t\t\tlabel: `${type}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t...subdirs.map((dir) => ({\n\t\t\t\t\t\t\tvalue: `${dir}`,\n\t\t\t\t\t\t\tlabel: `${type}/${dir}`,\n\t\t\t\t\t\t})),\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tresolvedDestination = diskUtil.resolvePath(resolvedDestination, match)\n\t\t}\n\t\treturn resolvedDestination\n\t}\n\n\tprivate async promptForParentTestClassAndOptionallyInstallDependencies(\n\t\tcandidates: ParentClassCandidate[],\n\t\tparentTestClass:\n\t\t\t| { name: string; importPath: string; isDefaultExport: boolean }\n\t\t\t| undefined,\n\t\tresolvedDestination: string\n\t) {\n\t\tconst idx = await this.ui.prompt({\n\t\t\ttype: 'select',\n\t\t\tisRequired: true,\n\t\t\tlabel: 'Which abstract test class do you want to extend?',\n\t\t\toptions: {\n\t\t\t\tchoices: [\n\t\t\t\t\t{ value: '', label: 'AbstractSpruceTest (default)' },\n\t\t\t\t\t...candidates.map((candidate, idx) => ({\n\t\t\t\t\t\tvalue: `${idx}`,\n\t\t\t\t\t\tlabel: candidate.label,\n\t\t\t\t\t})),\n\t\t\t\t],\n\t\t\t},\n\t\t})\n\n\t\tif (idx !== '' && candidates[+idx]) {\n\t\t\tconst match = candidates[+idx]\n\n\t\t\tif (match) {\n\t\t\t\tawait this.optionallyInstallFeatureBasedOnSelection(match)\n\n\t\t\t\tparentTestClass = this.buildParentClassFromCandidate(\n\t\t\t\t\tmatch,\n\t\t\t\t\tresolvedDestination\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\treturn parentTestClass\n\t}\n\n\tprivate async optionallyInstallFeatureBasedOnSelection(\n\t\tmatch: ParentClassCandidate\n\t) {\n\t\tif (match.featureCode) {\n\t\t\tconst isInstalled = await this.featureInstaller.isInstalled(\n\t\t\t\tmatch.featureCode\n\t\t\t)\n\n\t\t\tif (!isInstalled) {\n\t\t\t\tthis.ui.startLoading(`Installing ${match.name}...`)\n\t\t\t\tawait this.featureInstaller.install({\n\t\t\t\t\tfeatures: [{ code: match.featureCode as any }],\n\t\t\t\t})\n\t\t\t\tthis.ui.stopLoading()\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate buildParentClassFromCandidate(\n\t\tmatch: ParentClassCandidate,\n\t\tresolvedDestination: string\n\t): {\n\t\tname: string\n\t\tlabel: string\n\t\timportPath: string\n\t\tisDefaultExport: boolean\n\t} {\n\t\treturn {\n\t\t\tname: match.name,\n\t\t\tlabel: match.label,\n\t\t\tisDefaultExport: match.isDefaultExport,\n\t\t\timportPath:\n\t\t\t\tmatch.import ??\n\t\t\t\tdiskUtil.resolveRelativePath(\n\t\t\t\t\tresolvedDestination,\n\t\t\t\t\t//@ts-ignore\n\t\t\t\t\tmatch.path.replace(pathUtil.extname(match.path), '')\n\t\t\t\t),\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAGA;;AACA;;;;;;;;;;IAOqBA,Y;;;;;;;;;;;;;;;sGACGC,6B;0GACI,uB;;;;;;;mGAE3B,iBAAqBC,OAArB;QAAA;QAAA;UAAA;YAAA;cAAA;gBACOC,iBADP,GAC2B,KAAKC,2BAAL,CAAiCF,OAAjC,CAD3B;gBAESG,kBAFT,GAGEF,iBAHF,CAESE,kBAFT,EAE6BC,UAF7B,GAGEH,iBAHF,CAE6BG,UAF7B,EAEyCC,SAFzC,GAGEJ,iBAHF,CAEyCI,SAFzC,EAEoDC,IAFpD,GAGEL,iBAHF,CAEoDK,IAFpD;gBAKKC,mBALL,GAK2BC,2BAASC,WAAT,CACzB,KAAKC,GADoB,EAEzBP,kBAFyB,EAGzBG,IAHyB,CAL3B;gBAWC,KAAKK,EAAL,CAAQC,YAAR,CAAqB,wCAArB;gBAEMC,WAbP,GAaqB,KAAKC,MAb1B;gBAeC,KAAKH,EAAL,CAAQI,WAAR;gBAfD;gBAAA,OAqB0BF,WAAW,CAACG,0BAAZ,EArB1B;;cAAA;gBAqBOC,UArBP;;gBAAA,KAuBKT,2BAASU,YAAT,CAAsBX,mBAAtB,CAvBL;kBAAA;kBAAA;gBAAA;;gBAAA;gBAAA,OAwB8B,KAAKY,eAAL,CAC3BZ,mBAD2B,EAE3BD,IAF2B,CAxB9B;;cAAA;gBAwBEC,mBAxBF;;cAAA;gBAAA,MA8BKU,UAAU,CAACG,MAAX,GAAoB,CA9BzB;kBAAA;kBAAA;gBAAA;;gBAAA;gBAAA,OAgCS,KAAKC,wDAAL,CACLJ,UADK,EAELK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,KADiB,EAEjBpC,mBAFiB,CAAlB;;cA5BH;gBAAA,kCAkCQe,eAlCR;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;;oIAqCA,kBACCqB,KADD;QAAA;QAAA;UAAA;YAAA;cAAA;gBAAA,KAGKA,KAAK,CAACK,WAHX;kBAAA;kBAAA;gBAAA;;gBAAA;gBAAA,OAI4B,KAAKC,gBAAL,CAAsBC,WAAtB,CACzBP,KAAK,CAACK,WADmB,CAJ5B;;cAAA;gBAIQE,WAJR;;gBAAA,IAQOA,WARP;kBAAA;kBAAA;gBAAA;;gBASG,KAAKvC,EAAL,CAAQC,YAAR,sBAAmC+B,KAAK,CAACQ,IAAzC;gBATH;gBAAA,OAUS,KAAKF,gBAAL,CAAsBG,OAAtB,CAA8B;kBACnCC,QAAQ,EAAE,CAAC;oBAAEC,IAAI,EAAEX,KAAK,CAACK;kBAAd,CAAD;gBADyB,CAA9B,CAVT;;cAAA;gBAaG,KAAKrC,EAAL,CAAQI,WAAR;;cAbH;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;WAkBA,uCACC4B,KADD,EAECpC,mBAFD,EAQE;MAAA;;MACD,OAAO;QACN4C,IAAI,EAAER,KAAK,CAACQ,IADN;QAENd,KAAK,EAAEM,KAAK,CAACN,KAFP;QAGNkB,eAAe,EAAEZ,KAAK,CAACY,eAHjB;QAINC,UAAU,mBACTb,KAAK,UADI,yDAETnC,2BAASiD,mBAAT,CACClD,mBADD,EAEC;QACAoC,KAAK,CAACe,IAAN,CAAWC,OAAX,CAAmBC,iBAASC,OAAT,CAAiBlB,KAAK,CAACe,IAAvB,CAAnB,EAAiD,EAAjD,CAHD;MANK,CAAP;IAYA;;;EAvKwCI,2B"}
1
+ {"version":3,"file":"CreateAction.js","names":["CreateAction","createTestActionSchema","options","normalizedOptions","validateAndNormalizeOptions","testDestinationDir","namePascal","nameCamel","type","resolvedDestination","diskUtil","resolvePath","cwd","ui","startLoading","testFeature","parent","stopLoading","buildParentClassCandidates","candidates","doesDirExist","promptForSubDir","length","promptForParentTestClassAndOptionallyInstallDependencies","parentTestClass","writer","Writer","generateTest","namesUtil","toPascal","results","files","hints","subdirs","readDir","filter","d","isDir","prompt","label","isRequired","choices","value","map","dir","match","candidate","idx","optionallyInstallFeatureBasedOnSelection","buildParentClassFromCandidate","featureCode","featureInstaller","isInstalled","name","install","features","code","isDefaultExport","importPath","resolveRelativePath","path","replace","pathUtil","extname","AbstractAction"],"sources":["../../../../src/features/test/actions/CreateAction.ts"],"sourcesContent":["import pathUtil from 'path'\nimport { namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { SpruceSchemas } from '#spruce/schemas/schemas.types'\nimport createTestActionSchema from '#spruce/schemas/spruceCli/v2020_07_22/createTestOptions.schema'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\nimport TestFeature, { ParentClassCandidate } from '../TestFeature'\n\ntype OptionsSchema = SpruceSchemas.SpruceCli.v2020_07_22.CreateTestOptionsSchema\ntype Options = SpruceSchemas.SpruceCli.v2020_07_22.CreateTestOptions\n\nexport default class CreateAction extends AbstractAction<OptionsSchema> {\n\tpublic optionsSchema = createTestActionSchema\n\tpublic invocationMessage = 'Creating a test... 🛡'\n\n\tpublic async execute(options: Options): Promise<FeatureActionResponse> {\n\t\tconst normalizedOptions = this.validateAndNormalizeOptions(options)\n\t\tconst { testDestinationDir, namePascal, nameCamel, type } =\n\t\t\tnormalizedOptions\n\n\t\tlet resolvedDestination = diskUtil.resolvePath(\n\t\t\tthis.cwd,\n\t\t\ttestDestinationDir,\n\t\t\ttype\n\t\t)\n\n\t\tthis.ui.startLoading('Checking potential parent test classes')\n\n\t\tconst testFeature = this.parent as TestFeature\n\n\t\tthis.ui.stopLoading()\n\n\t\tlet parentTestClass:\n\t\t\t| undefined\n\t\t\t| { name: string; importPath: string; isDefaultExport: boolean }\n\n\t\tconst candidates = await testFeature.buildParentClassCandidates()\n\n\t\tif (diskUtil.doesDirExist(resolvedDestination)) {\n\t\t\tresolvedDestination = await this.promptForSubDir(\n\t\t\t\tresolvedDestination,\n\t\t\t\ttype\n\t\t\t)\n\t\t}\n\n\t\tif (candidates.length > 0) {\n\t\t\tparentTestClass =\n\t\t\t\tawait this.promptForParentTestClassAndOptionallyInstallDependencies(\n\t\t\t\t\tcandidates,\n\t\t\t\t\tparentTestClass,\n\t\t\t\t\tresolvedDestination\n\t\t\t\t)\n\t\t}\n\n\t\tthis.ui.startLoading('Generating test file...')\n\n\t\tconst writer = this.Writer('test')\n\n\t\tconst results = await writer.generateTest(resolvedDestination, {\n\t\t\t...normalizedOptions,\n\t\t\ttype,\n\t\t\tnameCamel,\n\t\t\tparentTestClass,\n\t\t\tnamePascal: namePascal ?? namesUtil.toPascal(nameCamel),\n\t\t})\n\n\t\treturn {\n\t\t\tfiles: results,\n\t\t\thints: [\"run `spruce test` in your skill when you're ready!\"],\n\t\t}\n\t}\n\tprivate async promptForSubDir(resolvedDestination: string, type: string) {\n\t\tconst subdirs = diskUtil\n\t\t\t.readDir(resolvedDestination)\n\t\t\t.filter((d) =>\n\t\t\t\tdiskUtil.isDir(diskUtil.resolvePath(resolvedDestination, d))\n\t\t\t)\n\n\t\tif (subdirs.length > 0) {\n\t\t\tconst match = await this.ui.prompt({\n\t\t\t\ttype: 'select',\n\t\t\t\tlabel: 'Where should I write this test?',\n\t\t\t\tisRequired: true,\n\t\t\t\toptions: {\n\t\t\t\t\tchoices: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvalue: '.',\n\t\t\t\t\t\t\tlabel: `${type}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t...subdirs.map((dir) => ({\n\t\t\t\t\t\t\tvalue: `${dir}`,\n\t\t\t\t\t\t\tlabel: `${type}/${dir}`,\n\t\t\t\t\t\t})),\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tresolvedDestination = diskUtil.resolvePath(resolvedDestination, match)\n\t\t}\n\t\treturn resolvedDestination\n\t}\n\n\tprivate async promptForParentTestClassAndOptionallyInstallDependencies(\n\t\tcandidates: ParentClassCandidate[],\n\t\tparentTestClass:\n\t\t\t| { name: string; importPath: string; isDefaultExport: boolean }\n\t\t\t| undefined,\n\t\tresolvedDestination: string\n\t) {\n\t\tconst idx = await this.ui.prompt({\n\t\t\ttype: 'select',\n\t\t\tisRequired: true,\n\t\t\tlabel: 'Which abstract test class do you want to extend?',\n\t\t\toptions: {\n\t\t\t\tchoices: [\n\t\t\t\t\t{ value: '', label: 'AbstractSpruceTest (default)' },\n\t\t\t\t\t...candidates.map((candidate, idx) => ({\n\t\t\t\t\t\tvalue: `${idx}`,\n\t\t\t\t\t\tlabel: candidate.label,\n\t\t\t\t\t})),\n\t\t\t\t],\n\t\t\t},\n\t\t})\n\n\t\tif (idx !== '' && candidates[+idx]) {\n\t\t\tconst match = candidates[+idx]\n\n\t\t\tif (match) {\n\t\t\t\tawait this.optionallyInstallFeatureBasedOnSelection(match)\n\n\t\t\t\tparentTestClass = this.buildParentClassFromCandidate(\n\t\t\t\t\tmatch,\n\t\t\t\t\tresolvedDestination\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\treturn parentTestClass\n\t}\n\n\tprivate async optionallyInstallFeatureBasedOnSelection(\n\t\tmatch: ParentClassCandidate\n\t) {\n\t\tif (match.featureCode) {\n\t\t\tconst isInstalled = await this.featureInstaller.isInstalled(\n\t\t\t\tmatch.featureCode\n\t\t\t)\n\n\t\t\tif (!isInstalled) {\n\t\t\t\tthis.ui.startLoading(`Installing ${match.name}...`)\n\t\t\t\tawait this.featureInstaller.install({\n\t\t\t\t\tfeatures: [{ code: match.featureCode as any }],\n\t\t\t\t})\n\t\t\t\tthis.ui.stopLoading()\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate buildParentClassFromCandidate(\n\t\tmatch: ParentClassCandidate,\n\t\tresolvedDestination: string\n\t): {\n\t\tname: string\n\t\tlabel: string\n\t\timportPath: string\n\t\tisDefaultExport: boolean\n\t} {\n\t\treturn {\n\t\t\tname: match.name,\n\t\t\tlabel: match.label,\n\t\t\tisDefaultExport: match.isDefaultExport,\n\t\t\timportPath:\n\t\t\t\tmatch.import ??\n\t\t\t\tdiskUtil.resolveRelativePath(\n\t\t\t\t\tresolvedDestination,\n\t\t\t\t\t//@ts-ignore\n\t\t\t\t\tmatch.path.replace(pathUtil.extname(match.path), '')\n\t\t\t\t),\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAGA;;AACA;;;;;;;;;;IAOqBA,Y;;;;;;;;;;;;;;;sGACGC,6B;0GACI,uB;;;;;;;mGAE3B,iBAAqBC,OAArB;QAAA;QAAA;UAAA;YAAA;cAAA;gBACOC,iBADP,GAC2B,KAAKC,2BAAL,CAAiCF,OAAjC,CAD3B;gBAESG,kBAFT,GAGEF,iBAHF,CAESE,kBAFT,EAE6BC,UAF7B,GAGEH,iBAHF,CAE6BG,UAF7B,EAEyCC,SAFzC,GAGEJ,iBAHF,CAEyCI,SAFzC,EAEoDC,IAFpD,GAGEL,iBAHF,CAEoDK,IAFpD;gBAKKC,mBALL,GAK2BC,0BAAA,CAASC,WAAT,CACzB,KAAKC,GADoB,EAEzBP,kBAFyB,EAGzBG,IAHyB,CAL3B;gBAWC,KAAKK,EAAL,CAAQC,YAAR,CAAqB,wCAArB;gBAEMC,WAbP,GAaqB,KAAKC,MAb1B;gBAeC,KAAKH,EAAL,CAAQI,WAAR;gBAfD;gBAAA,OAqB0BF,WAAW,CAACG,0BAAZ,EArB1B;;cAAA;gBAqBOC,UArBP;;gBAAA,KAuBKT,0BAAA,CAASU,YAAT,CAAsBX,mBAAtB,CAvBL;kBAAA;kBAAA;gBAAA;;gBAAA;gBAAA,OAwB8B,KAAKY,eAAL,CAC3BZ,mBAD2B,EAE3BD,IAF2B,CAxB9B;;cAAA;gBAwBEC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,EAAjD,CAHD;MANK,CAAP;IAYA;;;EAvKwCI,2B"}
@@ -1 +1 @@
1
- {"version":3,"file":"SetupAction.js","names":["SetupAction","setupTestsOptionsSchema","options","normalizedOptions","validateAndNormalizeOptions","demoNumber","skillSlug","Action","execute","phone","pin","substr","length","loginResponse","nameReadable","nameKebab","registerResponse","err","errors","isDuplicateSlugError","responseErrors","code","loginAsSkillResponse","actionUtil","mergeActionResults","AbstractAction"],"sources":["../../../../src/features/test/actions/SetupAction.ts"],"sourcesContent":["import { SpruceSchemas } from '#spruce/schemas/schemas.types'\nimport setupTestsOptionsSchema from '#spruce/schemas/spruceCli/v2020_07_22/setupTestsOptions.schema'\nimport actionUtil from '../../../utilities/action.utility'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\n\ntype OptionsSchema = SpruceSchemas.SpruceCli.v2020_07_22.SetupTestsOptionsSchema\ntype Options = SpruceSchemas.SpruceCli.v2020_07_22.SetupTestsOptions\n\nexport default class SetupAction extends AbstractAction<OptionsSchema> {\n\tpublic optionsSchema = setupTestsOptionsSchema\n\tpublic commandAliases = ['setup.testing']\n\tpublic invocationMessage = 'Setting up for testing... 🛡'\n\n\tpublic async execute(options: Options): Promise<FeatureActionResponse> {\n\t\tconst normalizedOptions = this.validateAndNormalizeOptions(options)\n\t\tconst { demoNumber, skillSlug } = normalizedOptions\n\n\t\tconst loginResponse = await this.Action('person', 'login').execute({\n\t\t\tphone: demoNumber,\n\t\t\tpin: demoNumber.substr(demoNumber.length - 4),\n\t\t})\n\n\t\tconst registerResponse = await this.Action('skill', 'register').execute({\n\t\t\tnameReadable: skillSlug,\n\t\t\tnameKebab: skillSlug,\n\t\t})\n\n\t\tconst err = registerResponse.errors?.[0]\n\n\t\tconst isDuplicateSlugError =\n\t\t\terr?.options?.responseErrors?.length === 1 &&\n\t\t\terr?.options?.responseErrors?.[0]?.options?.code === 'DUPLICATE_SLUG'\n\n\t\tlet loginAsSkillResponse: any = {}\n\n\t\tif (isDuplicateSlugError) {\n\t\t\tdelete registerResponse.errors\n\n\t\t\tloginAsSkillResponse = await this.Action('skill', 'login').execute({\n\t\t\t\tskillSlug,\n\t\t\t})\n\t\t}\n\n\t\treturn actionUtil.mergeActionResults(\n\t\t\t{},\n\t\t\tloginResponse,\n\t\t\tregisterResponse,\n\t\t\tloginAsSkillResponse\n\t\t)\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;;;;;IAMqBA,W;;;;;;;;;;;;;;;sGACGC,6B;uGACC,CAAC,eAAD,C;0GACG,8B;;;;;;;mGAE3B,iBAAqBC,OAArB;QAAA;;QAAA;QAAA;UAAA;YAAA;cAAA;gBACOC,iBADP,GAC2B,KAAKC,2BAAL,CAAiCF,OAAjC,CAD3B;gBAESG,UAFT,GAEmCF,iBAFnC,CAESE,UAFT,EAEqBC,SAFrB,GAEmCH,iBAFnC,CAEqBG,SAFrB;gBAAA;gBAAA,OAI6B,KAAKC,MAAL,CAAY,QAAZ,EAAsB,OAAtB,EAA+BC,OAA/B,CAAuC;kBAClEC,KAAK,EAAEJ,UAD2D;kBAElEK,GAAG,EAAEL,UAAU,CAACM,MAAX,CAAkBN,UAAU,CAACO,MAAX,GAAoB,CAAtC;gBAF6D,CAAvC,CAJ7B;;cAAA;gBAIOC,aAJP;gBAAA;gBAAA,OASgC,KAAKN,MAAL,CAAY,OAAZ,EAAqB,UAArB,EAAiCC,OAAjC,CAAyC;kBACvEM,YAAY,EAAER,SADyD;kBAEvES,SAAS,EAAET;gBAF4D,CAAzC,CAThC;;cAAA;gBASOU,gBATP;gBAcOC,GAdP,4BAcaD,gBAAgB,CAACE,MAd9B,0DAca,sBAA0B,CAA1B,CAdb;gBAgBOC,oBAhBP,GAiBE,CAAAF,GAAG,SAAH,IAAAA,GAAG,WAAH,4BAAAA,GAAG,CAAEf,OAAL,uFAAckB,cAAd,gFAA8BR,MAA9B,MAAyC,CAAzC,IACA,CAAAK,GAAG,SAAH,IAAAA,GAAG,WAAH,6BAAAA,GAAG,CAAEf,OAAL,yFAAckB,cAAd,0GAA+B,CAA/B,6GAAmClB,OAAnC,kFAA4CmB,IAA5C,MAAqD,gBAlBvD;gBAoBKC,oBApBL,GAoBiC,EApBjC;;gBAAA,KAsBKH,oBAtBL;kBAAA;kBAAA;gBAAA;;gBAuBE,OAAOH,gBAAgB,CAACE,MAAxB;gBAvBF;gBAAA,OAyB+B,KAAKX,MAAL,CAAY,OAAZ,EAAqB,OAArB,EAA8BC,OAA9B,CAAsC;kBAClEF,SAAS,EAATA;gBADkE,CAAtC,CAzB/B;;cAAA;gBAyBEgB,oBAzBF;;cAAA;gBAAA,iCA8BQC,mBAAWC,kBAAX,CACN,EADM,EAENX,aAFM,EAGNG,gBAHM,EAINM,oBAJM,CA9BR;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;EALwCG,2B"}
1
+ {"version":3,"file":"SetupAction.js","names":["SetupAction","setupTestsOptionsSchema","options","normalizedOptions","validateAndNormalizeOptions","demoNumber","skillSlug","Action","execute","phone","pin","substr","length","loginResponse","nameReadable","nameKebab","registerResponse","err","errors","isDuplicateSlugError","responseErrors","code","loginAsSkillResponse","actionUtil","mergeActionResults","AbstractAction"],"sources":["../../../../src/features/test/actions/SetupAction.ts"],"sourcesContent":["import { SpruceSchemas } from '#spruce/schemas/schemas.types'\nimport setupTestsOptionsSchema from '#spruce/schemas/spruceCli/v2020_07_22/setupTestsOptions.schema'\nimport actionUtil from '../../../utilities/action.utility'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\n\ntype OptionsSchema = SpruceSchemas.SpruceCli.v2020_07_22.SetupTestsOptionsSchema\ntype Options = SpruceSchemas.SpruceCli.v2020_07_22.SetupTestsOptions\n\nexport default class SetupAction extends AbstractAction<OptionsSchema> {\n\tpublic optionsSchema = setupTestsOptionsSchema\n\tpublic commandAliases = ['setup.testing']\n\tpublic invocationMessage = 'Setting up for testing... 🛡'\n\n\tpublic async execute(options: Options): Promise<FeatureActionResponse> {\n\t\tconst normalizedOptions = this.validateAndNormalizeOptions(options)\n\t\tconst { demoNumber, skillSlug } = normalizedOptions\n\n\t\tconst loginResponse = await this.Action('person', 'login').execute({\n\t\t\tphone: demoNumber,\n\t\t\tpin: demoNumber.substr(demoNumber.length - 4),\n\t\t})\n\n\t\tconst registerResponse = await this.Action('skill', 'register').execute({\n\t\t\tnameReadable: skillSlug,\n\t\t\tnameKebab: skillSlug,\n\t\t})\n\n\t\tconst err = registerResponse.errors?.[0]\n\n\t\tconst isDuplicateSlugError =\n\t\t\terr?.options?.responseErrors?.length === 1 &&\n\t\t\terr?.options?.responseErrors?.[0]?.options?.code === 'DUPLICATE_SLUG'\n\n\t\tlet loginAsSkillResponse: any = {}\n\n\t\tif (isDuplicateSlugError) {\n\t\t\tdelete registerResponse.errors\n\n\t\t\tloginAsSkillResponse = await this.Action('skill', 'login').execute({\n\t\t\t\tskillSlug,\n\t\t\t})\n\t\t}\n\n\t\treturn actionUtil.mergeActionResults(\n\t\t\t{},\n\t\t\tloginResponse,\n\t\t\tregisterResponse,\n\t\t\tloginAsSkillResponse\n\t\t)\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;;;;;IAMqBA,W;;;;;;;;;;;;;;;sGACGC,6B;uGACC,CAAC,eAAD,C;0GACG,8B;;;;;;;mGAE3B,iBAAqBC,OAArB;QAAA;;QAAA;QAAA;UAAA;YAAA;cAAA;gBACOC,iBADP,GAC2B,KAAKC,2BAAL,CAAiCF,OAAjC,CAD3B;gBAESG,UAFT,GAEmCF,iBAFnC,CAESE,UAFT,EAEqBC,SAFrB,GAEmCH,iBAFnC,CAEqBG,SAFrB;gBAAA;gBAAA,OAI6B,KAAKC,MAAL,CAAY,QAAZ,EAAsB,OAAtB,EAA+BC,OAA/B,CAAuC;kBAClEC,KAAK,EAAEJ,UAD2D;kBAElEK,GAAG,EAAEL,UAAU,CAACM,MAAX,CAAkBN,UAAU,CAACO,MAAX,GAAoB,CAAtC;gBAF6D,CAAvC,CAJ7B;;cAAA;gBAIOC,aAJP;gBAAA;gBAAA,OASgC,KAAKN,MAAL,CAAY,OAAZ,EAAqB,UAArB,EAAiCC,OAAjC,CAAyC;kBACvEM,YAAY,EAAER,SADyD;kBAEvES,SAAS,EAAET;gBAF4D,CAAzC,CAThC;;cAAA;gBASOU,gBATP;gBAcOC,GAdP,4BAcaD,gBAAgB,CAACE,MAd9B,0DAca,sBAA0B,CAA1B,CAdb;gBAgBOC,oBAhBP,GAiBE,CAAAF,GAAG,SAAH,IAAAA,GAAG,WAAH,4BAAAA,GAAG,CAAEf,OAAL,uFAAckB,cAAd,gFAA8BR,MAA9B,MAAyC,CAAzC,IACA,CAAAK,GAAG,SAAH,IAAAA,GAAG,WAAH,6BAAAA,GAAG,CAAEf,OAAL,yFAAckB,cAAd,0GAA+B,CAA/B,6GAAmClB,OAAnC,kFAA4CmB,IAA5C,MAAqD,gBAlBvD;gBAoBKC,oBApBL,GAoBiC,EApBjC;;gBAAA,KAsBKH,oBAtBL;kBAAA;kBAAA;gBAAA;;gBAuBE,OAAOH,gBAAgB,CAACE,MAAxB;gBAvBF;gBAAA,OAyB+B,KAAKX,MAAL,CAAY,OAAZ,EAAqB,OAArB,EAA8BC,OAA9B,CAAsC;kBAClEF,SAAS,EAATA;gBADkE,CAAtC,CAzB/B;;cAAA;gBAyBEgB,oBAzBF;;cAAA;gBAAA,iCA8BQC,kBAAA,CAAWC,kBAAX,CACN,EADM,EAENX,aAFM,EAGNG,gBAHM,EAINM,oBAJM,CA9BR;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;EALwCG,2B"}
@@ -1 +1 @@
1
- {"version":3,"file":"TestAction.js","names":["optionsSchema","testOptionsSchema","TestAction","options","totalTestFiles","watchMode","settings","Service","get","normalizedOptions","validateAndNormalizeOptions","pattern","shouldReportWhileRunning","inspect","shouldHoldAtStart","shouldReturnImmediately","originalInspect","hasWatchEverBeenEnabled","testReporter","TestReporter","cwd","status","isDebugging","filterPattern","undefined","handleRestart","bind","handleStartStop","handleQuit","handleRerunTestFile","handleOpenTestFile","handleFilterPatternChange","handleToggleDebug","handletoggleStandardWatch","handleToggleSmartWatch","start","watcher","getFeature","startWatching","delay","emitter","on","handleFileChange","runnerStatus","promise","startTestRunner","meta","test","emit","reporter","testResults","stopWatching","destroy","actionResponse","summaryLines","totalTests","totalPassed","totalFailed","totalSkipped","totalTodo","errors","generateErrorsFromTestResults","payload","changes","shouldRestart","filesWeCareAbout","change","values","path","name","doWeCareAboutThisFileChanging","setStatusLabel","push","fileChangeTimeout","clearTimeout","startCountdownTimer","watchDelaySec","setTimeout","smartFilter","generateFilterFromChangedFiles","length","restart","filter","file","search","map","fileToFilterPattern","join","ext","pathUtil","extname","setIsDebugging","setWatchMode","mode","kill","setFilterPattern","filename","basename","replace","dirname","split","sep","pop","holdPromiseResolve","testRunner","fileName","openTestFile","waitForStart","lastTestResults","setStatus","stopCountdownTimer","TestRunner","commandService","firstUpdate","reset","results","failed","testFiles","find","updateResults","render","appendError","message","run","debugPort","hasFailedTests","hasSkippedTests","Promise","resolve","diskUtil","resolvePath","forEach","tests","errorMessages","err","mapErrorResultToSpruceError","SpruceError","code","testName","errorMessage","AbstractAction"],"sources":["../../../../src/features/test/actions/TestAction.ts"],"sourcesContent":["import pathUtil from 'path'\nimport { SpruceSchemas } from '@sprucelabs/mercury-types'\nimport { SchemaValues } from '@sprucelabs/schema'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport open from 'open'\nimport testOptionsSchema from '#spruce/schemas/spruceCli/v2020_07_22/testOptions.schema'\nimport SpruceError from '../../../errors/SpruceError'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse, ActionOptions } from '../../features.types'\nimport WatchFeature from '../../watch/WatchFeature'\nimport {\n\tSpruceTestFile,\n\tSpruceTestFileTest,\n\tSpruceTestResults,\n} from '../test.types'\nimport TestReporter, { WatchMode } from '../TestReporter'\nimport TestRunner from '../TestRunner'\n\nexport const optionsSchema = testOptionsSchema\n\nexport type OptionsSchema = typeof optionsSchema\n\ntype DidChangePayload =\n\tSchemaValues<SpruceSchemas.SpruceCli.v2020_07_22.WatcherDidDetectChangesEmitPayloadSchema>\n\nexport default class TestAction extends AbstractAction<OptionsSchema> {\n\tpublic optionsSchema = optionsSchema\n\tpublic invocationMessage = 'Starting tests... 🛡'\n\n\tprivate testReporter?: TestReporter | undefined\n\tprivate testRunner?: TestRunner\n\tprivate runnerStatus: 'hold' | 'quit' | 'run' | 'restart' = 'hold'\n\tprivate pattern: string | undefined\n\tprivate inspect?: number | null\n\tprivate holdPromiseResolve?: () => void\n\tprivate lastTestResults: SpruceTestResults = { totalTestFiles: 0 }\n\tprivate originalInspect!: number\n\tprivate watcher?: WatchFeature\n\tprivate watchMode: WatchMode = 'off'\n\tprivate fileChangeTimeout?: any\n\tprivate hasWatchEverBeenEnabled = false\n\n\tprivate readonly watchDelaySec = 2\n\n\tpublic constructor(options: ActionOptions) {\n\t\tsuper(options)\n\t}\n\n\tpublic async execute(\n\t\toptions: SchemaValues<OptionsSchema>\n\t): Promise<FeatureActionResponse> {\n\t\tif (!options.watchMode) {\n\t\t\tconst settings = this.Service('settings')\n\t\t\toptions.watchMode = settings.get('test.watchMode') ?? 'off'\n\t\t}\n\n\t\tconst normalizedOptions = this.validateAndNormalizeOptions(options)\n\n\t\tconst {\n\t\t\tpattern,\n\t\t\tshouldReportWhileRunning,\n\t\t\tinspect,\n\t\t\tshouldHoldAtStart,\n\t\t\twatchMode,\n\t\t\tshouldReturnImmediately,\n\t\t} = normalizedOptions\n\n\t\tthis.originalInspect = inspect ?? 5200\n\t\tthis.inspect = inspect\n\t\tthis.pattern = pattern\n\t\tthis.hasWatchEverBeenEnabled = watchMode !== 'off'\n\t\tthis.watchMode = watchMode as WatchMode\n\n\t\tif (shouldReportWhileRunning) {\n\t\t\tthis.testReporter = new TestReporter({\n\t\t\t\tcwd: this.cwd,\n\t\t\t\twatchMode: this.watchMode,\n\t\t\t\tstatus: shouldHoldAtStart ? 'stopped' : 'ready',\n\t\t\t\tisDebugging: !!inspect,\n\t\t\t\tfilterPattern: pattern ?? undefined,\n\t\t\t\thandleRestart: this.handleRestart.bind(this),\n\t\t\t\thandleStartStop: this.handleStartStop.bind(this),\n\t\t\t\thandleQuit: this.handleQuit.bind(this),\n\t\t\t\thandleRerunTestFile: this.handleRerunTestFile.bind(this),\n\t\t\t\thandleOpenTestFile: this.handleOpenTestFile.bind(this),\n\t\t\t\thandleFilterPatternChange: this.handleFilterPatternChange.bind(this),\n\t\t\t\thandleToggleDebug: this.handleToggleDebug.bind(this),\n\t\t\t\thandletoggleStandardWatch: this.handletoggleStandardWatch.bind(this),\n\t\t\t\thandleToggleSmartWatch: this.handleToggleSmartWatch?.bind(this),\n\t\t\t})\n\n\t\t\tawait this.testReporter.start()\n\t\t}\n\n\t\tthis.watcher = this.getFeature('watch') as WatchFeature\n\t\tvoid this.watcher.startWatching({ delay: 0 })\n\n\t\tawait this.emitter.on(\n\t\t\t'watcher.did-detect-change',\n\t\t\tthis.handleFileChange.bind(this)\n\t\t)\n\n\t\tthis.runnerStatus = shouldHoldAtStart ? 'hold' : 'run'\n\n\t\tconst promise = this.startTestRunner(normalizedOptions)\n\n\t\tif (shouldReturnImmediately) {\n\t\t\treturn {\n\t\t\t\tmeta: {\n\t\t\t\t\tpromise,\n\t\t\t\t\ttest: this,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\t\tvoid this.emitter.emit('test.reporter-did-boot', {\n\t\t\treporter: this,\n\t\t})\n\n\t\tconst testResults = await promise\n\n\t\tawait this.watcher?.stopWatching()\n\t\tawait this.testReporter?.destroy()\n\n\t\tconst actionResponse: FeatureActionResponse = {\n\t\t\tmeta: { testResults },\n\t\t\tsummaryLines: [\n\t\t\t\t`Test files: ${testResults.totalTestFiles}`,\n\t\t\t\t`Tests: ${testResults.totalTests ?? '0'}`,\n\t\t\t\t`Passed: ${testResults.totalPassed ?? '0'}`,\n\t\t\t\t`Failed: ${testResults.totalFailed ?? '0'}`,\n\t\t\t\t`Skipped: ${testResults.totalSkipped ?? '0'}`,\n\t\t\t\t`Todo: ${testResults.totalTodo ?? '0'}`,\n\t\t\t],\n\t\t}\n\n\t\tif (testResults.totalFailed ?? 0 > 0) {\n\t\t\tactionResponse.errors = this.generateErrorsFromTestResults(testResults)\n\t\t}\n\n\t\treturn actionResponse\n\t}\n\n\tprivate handleFileChange(payload: DidChangePayload) {\n\t\tif (\n\t\t\tthis.watchMode === 'off' ||\n\t\t\t!(this.runnerStatus === 'run' || this.runnerStatus == 'hold')\n\t\t) {\n\t\t\treturn\n\t\t}\n\n\t\tconst { changes } = payload\n\n\t\tlet shouldRestart = false\n\t\tconst filesWeCareAbout: string[] = []\n\n\t\tfor (const change of changes) {\n\t\t\tconst { path, name } = change.values\n\n\t\t\tif (this.doWeCareAboutThisFileChanging(path)) {\n\t\t\t\tthis.testReporter?.setStatusLabel(`Built file: ${name}`)\n\t\t\t\tshouldRestart = true\n\t\t\t\tfilesWeCareAbout.push(path)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif (shouldRestart) {\n\t\t\tif (this.fileChangeTimeout) {\n\t\t\t\tclearTimeout(this.fileChangeTimeout)\n\t\t\t}\n\n\t\t\tthis.testReporter?.startCountdownTimer(this.watchDelaySec)\n\t\t\tthis.fileChangeTimeout = setTimeout(() => {\n\t\t\t\tif (this.watchMode === 'smart') {\n\t\t\t\t\tconst smartFilter =\n\t\t\t\t\t\tthis.generateFilterFromChangedFiles(filesWeCareAbout)\n\t\t\t\t\tif (smartFilter.length > 0) {\n\t\t\t\t\t\tthis.handleFilterPatternChange(smartFilter)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.restart()\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.restart()\n\t\t\t\t}\n\t\t\t}, this.watchDelaySec * 1000) as any\n\t\t}\n\t}\n\n\tprivate generateFilterFromChangedFiles(filesWeCareAbout: string[]): string {\n\t\tconst filter = filesWeCareAbout\n\t\t\t.filter((file) => file.search('test.js') > -1)\n\t\t\t.map((file) => this.fileToFilterPattern(file))\n\t\t\t.join(' ')\n\n\t\treturn filter\n\t}\n\n\tprivate doWeCareAboutThisFileChanging(path: string) {\n\t\tconst ext = pathUtil.extname(path)\n\n\t\tif (\n\t\t\tpath.search('testDirsAndFiles') > -1 ||\n\t\t\tpath.search('.change_cache') > -1\n\t\t) {\n\t\t\treturn false\n\t\t}\n\n\t\tif (ext === '.js') {\n\t\t\treturn true\n\t\t}\n\n\t\treturn false\n\t}\n\n\tprivate handleToggleDebug() {\n\t\tif (this.inspect) {\n\t\t\tthis.inspect = undefined\n\t\t} else {\n\t\t\tthis.inspect = this.originalInspect\n\t\t}\n\n\t\tthis.testReporter?.setIsDebugging(!!this.inspect)\n\t\tthis.restart()\n\t}\n\n\tprivate handletoggleStandardWatch() {\n\t\tif (this.watchMode === 'standard') {\n\t\t\tthis.testReporter?.setWatchMode('off')\n\t\t} else {\n\t\t\tthis.setWatchMode('standard')\n\t\t}\n\t}\n\n\tprivate handleToggleSmartWatch() {\n\t\tif (this.watchMode === 'smart') {\n\t\t\tthis.setWatchMode('off')\n\t\t} else {\n\t\t\tthis.setWatchMode('smart')\n\t\t}\n\t}\n\n\tpublic setWatchMode(mode: WatchMode) {\n\t\tthis.watchMode = mode\n\t\tthis.testReporter?.setWatchMode(mode)\n\t\tthis.hasWatchEverBeenEnabled = true\n\t}\n\n\tprivate restart() {\n\t\tthis.runnerStatus = 'restart'\n\t\tthis.kill()\n\t}\n\n\tprivate handleQuit() {\n\t\tthis.runnerStatus = 'quit'\n\t\tthis.kill()\n\t}\n\n\tprivate handleRerunTestFile(file: string) {\n\t\tconst name = this.fileToFilterPattern(file)\n\n\t\tthis.testReporter?.setFilterPattern(name)\n\t\tthis.handleFilterPatternChange(name)\n\t}\n\n\tprivate fileToFilterPattern(file: string) {\n\t\tconst filename = pathUtil\n\t\t\t.basename(file, '.ts')\n\t\t\t.replace('.tsx', '')\n\t\t\t.replace('.js', '')\n\t\tconst dirname = pathUtil.dirname(file).split(pathUtil.sep).pop() ?? ''\n\n\t\tconst name = pathUtil.join(dirname, filename)\n\t\treturn name\n\t}\n\n\tprivate handleFilterPatternChange(filterPattern?: string) {\n\t\tthis.pattern = filterPattern\n\t\tthis.testReporter?.setFilterPattern(filterPattern)\n\n\t\tthis.restart()\n\t}\n\n\tprivate handleStartStop() {\n\t\tif (this.runnerStatus === 'hold') {\n\t\t\tthis.runnerStatus = 'run'\n\t\t\tthis.holdPromiseResolve?.()\n\t\t\tthis.holdPromiseResolve = undefined\n\t\t} else if (this.runnerStatus === 'run') {\n\t\t\tthis.runnerStatus = 'hold'\n\t\t\tthis.kill()\n\t\t}\n\t}\n\n\tprivate handleRestart() {\n\t\tthis.restart()\n\t}\n\n\tpublic kill() {\n\t\tthis.testRunner?.kill()\n\t\tthis.holdPromiseResolve?.()\n\t\tthis.holdPromiseResolve = undefined\n\t}\n\n\tprivate async handleOpenTestFile(fileName: string) {\n\t\tawait this.openTestFile(fileName)\n\t}\n\n\tprivate async startTestRunner(\n\t\toptions: SchemaValues<OptionsSchema>\n\t): Promise<SpruceTestResults> {\n\t\tif (this.runnerStatus === 'hold') {\n\t\t\tawait this.waitForStart()\n\t\t}\n\n\t\tif (this.runnerStatus === 'quit') {\n\t\t\treturn this.lastTestResults\n\t\t}\n\n\t\tthis.testReporter?.setStatus('ready')\n\t\tthis.testReporter?.stopCountdownTimer()\n\n\t\tthis.testRunner = new TestRunner({\n\t\t\tcwd: this.cwd,\n\t\t\tcommandService: this.Service('command'),\n\t\t})\n\n\t\tlet firstUpdate = true\n\n\t\tif (this.testReporter) {\n\t\t\tawait this.testRunner.on('did-update', (payload) => {\n\t\t\t\tif (firstUpdate) {\n\t\t\t\t\tfirstUpdate = false\n\t\t\t\t\tthis.testReporter?.setStatus('running')\n\t\t\t\t\tthis.testReporter?.reset()\n\t\t\t\t}\n\n\t\t\t\tif (this.watchMode === 'smart' && payload.results.totalFailed > 0) {\n\t\t\t\t\tconst failed = payload.results.testFiles.find(\n\t\t\t\t\t\t(file: any) => file.status === 'failed'\n\t\t\t\t\t)\n\n\t\t\t\t\tif (failed) {\n\t\t\t\t\t\tconst pattern = this.fileToFilterPattern(failed.path)\n\t\t\t\t\t\tif (this.pattern !== pattern) {\n\t\t\t\t\t\t\tthis.handleFilterPatternChange(pattern)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.testReporter?.updateResults(payload.results)\n\t\t\t\tthis.testReporter?.render()\n\t\t\t})\n\n\t\t\tawait this.testRunner.on('did-error', (payload) => {\n\t\t\t\tthis.testReporter?.appendError(payload.message)\n\t\t\t\tthis.testReporter?.render()\n\t\t\t})\n\t\t}\n\n\t\tthis.runnerStatus = 'run'\n\n\t\tlet testResults: SpruceTestResults = await this.testRunner.run({\n\t\t\tpattern: this.pattern,\n\t\t\tdebugPort: this.inspect,\n\t\t})\n\n\t\tif (\n\t\t\t//@ts-ignore\n\t\t\tthis.runnerStatus !== 'restart' &&\n\t\t\t(!options.shouldReportWhileRunning ||\n\t\t\t\t!this.hasWatchEverBeenEnabled ||\n\t\t\t\t(this.runnerStatus as any) === 'quit')\n\t\t) {\n\t\t\treturn testResults\n\t\t}\n\n\t\tif (\n\t\t\tthis.runnerStatus === 'run' &&\n\t\t\tthis.watchMode === 'smart' &&\n\t\t\tthis.testRunner?.hasFailedTests() === false &&\n\t\t\t!this.testRunner?.hasSkippedTests() &&\n\t\t\t(this.pattern ?? []).length > 0\n\t\t) {\n\t\t\tthis.testReporter?.setStatusLabel('Restarting...')\n\t\t\tthis.runnerStatus = 'restart'\n\t\t\tthis.testReporter?.startCountdownTimer(3)\n\n\t\t\treturn await new Promise((resolve) => {\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tthis.pattern = ''\n\t\t\t\t\tthis.testReporter?.setFilterPattern('')\n\t\t\t\t\tresolve(this.startTestRunner(options))\n\t\t\t\t}, 3000)\n\t\t\t})\n\t\t}\n\n\t\tif (this.runnerStatus === 'run') {\n\t\t\tthis.runnerStatus = 'hold'\n\t\t}\n\n\t\tthis.testReporter?.setStatus('stopped')\n\n\t\tthis.lastTestResults = testResults\n\n\t\treturn this.startTestRunner(options)\n\t}\n\n\tpublic async waitForStart() {\n\t\tawait new Promise((resolve: any) => {\n\t\t\tthis.runnerStatus = 'hold'\n\t\t\tthis.holdPromiseResolve = resolve\n\t\t})\n\t}\n\n\tprivate async openTestFile(fileName: string): Promise<void> {\n\t\tconst path = diskUtil.resolvePath(this.cwd, 'src', '__tests__', fileName)\n\t\tawait open(path)\n\t}\n\n\tprivate generateErrorsFromTestResults(testResults: SpruceTestResults) {\n\t\tconst errors: SpruceError[] = []\n\t\ttestResults.testFiles?.forEach((file) => {\n\t\t\tfile.tests?.forEach((test) => {\n\t\t\t\ttest.errorMessages?.forEach((message) => {\n\t\t\t\t\tconst err = this.mapErrorResultToSpruceError(test, file, message)\n\t\t\t\t\terrors.push(err)\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t\tif (errors.length > 0) {\n\t\t\treturn errors\n\t\t}\n\n\t\treturn undefined\n\t}\n\n\tprivate mapErrorResultToSpruceError(\n\t\ttest: SpruceTestFileTest,\n\t\tfile: SpruceTestFile,\n\t\tmessage: string\n\t) {\n\t\treturn new SpruceError({\n\t\t\tcode: 'TEST_FAILED',\n\t\t\ttestName: test.name,\n\t\t\tfileName: file.path,\n\t\t\terrorMessage: message,\n\t\t})\n\t}\n\n\tpublic getWatchMode() {\n\t\treturn this.watchMode\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAQA;;AACA;;;;;;;;;;;;AAEO,IAAMA,aAAa,GAAGC,uBAA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CAHD;QAIA,CALD;MAMA,CAPD;;MAQA,IAAI1E,MAAM,CAACoB,MAAP,GAAgB,CAApB,EAAuB;QACtB,OAAOpB,MAAP;MACA;;MAED,OAAOpC,SAAP;IACA;;;WAED,qCACCuB,IADD,EAECoC,IAFD,EAGCuC,OAHD,EAIE;MACD,OAAO,IAAIc,uBAAJ,CAAgB;QACtBC,IAAI,EAAE,aADgB;QAEtBC,QAAQ,EAAE3F,IAAI,CAACsB,IAFO;QAGtBoC,QAAQ,EAAEtB,IAAI,CAACf,IAHO;QAItBuE,YAAY,EAAEjB;MAJQ,CAAhB,CAAP;IAMA;;;WAED,wBAAsB;MACrB,OAAO,KAAKrH,SAAZ;IACA;;;EA5asCuI,2B"}
1
+ {"version":3,"file":"TestAction.js","names":["optionsSchema","testOptionsSchema","TestAction","options","totalTestFiles","watchMode","settings","Service","get","normalizedOptions","validateAndNormalizeOptions","pattern","shouldReportWhileRunning","inspect","shouldHoldAtStart","shouldReturnImmediately","originalInspect","hasWatchEverBeenEnabled","testReporter","TestReporter","cwd","status","isDebugging","filterPattern","undefined","handleRestart","bind","handleStartStop","handleQuit","handleRerunTestFile","handleOpenTestFile","handleFilterPatternChange","handleToggleDebug","handletoggleStandardWatch","handleToggleSmartWatch","start","watcher","getFeature","startWatching","delay","emitter","on","handleFileChange","runnerStatus","promise","startTestRunner","meta","test","emit","reporter","testResults","stopWatching","destroy","actionResponse","summaryLines","totalTests","totalPassed","totalFailed","totalSkipped","totalTodo","errors","generateErrorsFromTestResults","payload","changes","shouldRestart","filesWeCareAbout","change","values","path","name","doWeCareAboutThisFileChanging","setStatusLabel","push","fileChangeTimeout","clearTimeout","startCountdownTimer","watchDelaySec","setTimeout","smartFilter","generateFilterFromChangedFiles","length","restart","filter","file","search","map","fileToFilterPattern","join","ext","pathUtil","extname","setIsDebugging","setWatchMode","mode","kill","setFilterPattern","filename","basename","replace","dirname","split","sep","pop","holdPromiseResolve","testRunner","fileName","openTestFile","waitForStart","lastTestResults","setStatus","stopCountdownTimer","TestRunner","commandService","firstUpdate","reset","results","failed","testFiles","find","updateResults","render","appendError","message","run","debugPort","hasFailedTests","hasSkippedTests","Promise","resolve","diskUtil","resolvePath","open","forEach","tests","errorMessages","err","mapErrorResultToSpruceError","SpruceError","code","testName","errorMessage","AbstractAction"],"sources":["../../../../src/features/test/actions/TestAction.ts"],"sourcesContent":["import pathUtil from 'path'\nimport { SpruceSchemas } from '@sprucelabs/mercury-types'\nimport { SchemaValues } from '@sprucelabs/schema'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport open from 'open'\nimport testOptionsSchema from '#spruce/schemas/spruceCli/v2020_07_22/testOptions.schema'\nimport SpruceError from '../../../errors/SpruceError'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse, ActionOptions } from '../../features.types'\nimport WatchFeature from '../../watch/WatchFeature'\nimport {\n\tSpruceTestFile,\n\tSpruceTestFileTest,\n\tSpruceTestResults,\n} from '../test.types'\nimport TestReporter, { WatchMode } from '../TestReporter'\nimport TestRunner from '../TestRunner'\n\nexport const optionsSchema = testOptionsSchema\n\nexport type OptionsSchema = typeof optionsSchema\n\ntype DidChangePayload =\n\tSchemaValues<SpruceSchemas.SpruceCli.v2020_07_22.WatcherDidDetectChangesEmitPayloadSchema>\n\nexport default class TestAction extends AbstractAction<OptionsSchema> {\n\tpublic optionsSchema = optionsSchema\n\tpublic invocationMessage = 'Starting tests... 🛡'\n\n\tprivate testReporter?: TestReporter | undefined\n\tprivate testRunner?: TestRunner\n\tprivate runnerStatus: 'hold' | 'quit' | 'run' | 'restart' = 'hold'\n\tprivate pattern: string | undefined\n\tprivate inspect?: number | null\n\tprivate holdPromiseResolve?: () => void\n\tprivate lastTestResults: SpruceTestResults = { totalTestFiles: 0 }\n\tprivate originalInspect!: number\n\tprivate watcher?: WatchFeature\n\tprivate watchMode: WatchMode = 'off'\n\tprivate fileChangeTimeout?: any\n\tprivate hasWatchEverBeenEnabled = false\n\n\tprivate readonly watchDelaySec = 2\n\n\tpublic constructor(options: ActionOptions) {\n\t\tsuper(options)\n\t}\n\n\tpublic async execute(\n\t\toptions: SchemaValues<OptionsSchema>\n\t): Promise<FeatureActionResponse> {\n\t\tif (!options.watchMode) {\n\t\t\tconst settings = this.Service('settings')\n\t\t\toptions.watchMode = settings.get('test.watchMode') ?? 'off'\n\t\t}\n\n\t\tconst normalizedOptions = this.validateAndNormalizeOptions(options)\n\n\t\tconst {\n\t\t\tpattern,\n\t\t\tshouldReportWhileRunning,\n\t\t\tinspect,\n\t\t\tshouldHoldAtStart,\n\t\t\twatchMode,\n\t\t\tshouldReturnImmediately,\n\t\t} = normalizedOptions\n\n\t\tthis.originalInspect = inspect ?? 5200\n\t\tthis.inspect = inspect\n\t\tthis.pattern = pattern\n\t\tthis.hasWatchEverBeenEnabled = watchMode !== 'off'\n\t\tthis.watchMode = watchMode as WatchMode\n\n\t\tif (shouldReportWhileRunning) {\n\t\t\tthis.testReporter = new TestReporter({\n\t\t\t\tcwd: this.cwd,\n\t\t\t\twatchMode: this.watchMode,\n\t\t\t\tstatus: shouldHoldAtStart ? 'stopped' : 'ready',\n\t\t\t\tisDebugging: !!inspect,\n\t\t\t\tfilterPattern: pattern ?? undefined,\n\t\t\t\thandleRestart: this.handleRestart.bind(this),\n\t\t\t\thandleStartStop: this.handleStartStop.bind(this),\n\t\t\t\thandleQuit: this.handleQuit.bind(this),\n\t\t\t\thandleRerunTestFile: this.handleRerunTestFile.bind(this),\n\t\t\t\thandleOpenTestFile: this.handleOpenTestFile.bind(this),\n\t\t\t\thandleFilterPatternChange: this.handleFilterPatternChange.bind(this),\n\t\t\t\thandleToggleDebug: this.handleToggleDebug.bind(this),\n\t\t\t\thandletoggleStandardWatch: this.handletoggleStandardWatch.bind(this),\n\t\t\t\thandleToggleSmartWatch: this.handleToggleSmartWatch?.bind(this),\n\t\t\t})\n\n\t\t\tawait this.testReporter.start()\n\t\t}\n\n\t\tthis.watcher = this.getFeature('watch') as WatchFeature\n\t\tvoid this.watcher.startWatching({ delay: 0 })\n\n\t\tawait this.emitter.on(\n\t\t\t'watcher.did-detect-change',\n\t\t\tthis.handleFileChange.bind(this)\n\t\t)\n\n\t\tthis.runnerStatus = shouldHoldAtStart ? 'hold' : 'run'\n\n\t\tconst promise = this.startTestRunner(normalizedOptions)\n\n\t\tif (shouldReturnImmediately) {\n\t\t\treturn {\n\t\t\t\tmeta: {\n\t\t\t\t\tpromise,\n\t\t\t\t\ttest: this,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\t\tvoid this.emitter.emit('test.reporter-did-boot', {\n\t\t\treporter: this,\n\t\t})\n\n\t\tconst testResults = await promise\n\n\t\tawait this.watcher?.stopWatching()\n\t\tawait this.testReporter?.destroy()\n\n\t\tconst actionResponse: FeatureActionResponse = {\n\t\t\tmeta: { testResults },\n\t\t\tsummaryLines: [\n\t\t\t\t`Test files: ${testResults.totalTestFiles}`,\n\t\t\t\t`Tests: ${testResults.totalTests ?? '0'}`,\n\t\t\t\t`Passed: ${testResults.totalPassed ?? '0'}`,\n\t\t\t\t`Failed: ${testResults.totalFailed ?? '0'}`,\n\t\t\t\t`Skipped: ${testResults.totalSkipped ?? '0'}`,\n\t\t\t\t`Todo: ${testResults.totalTodo ?? '0'}`,\n\t\t\t],\n\t\t}\n\n\t\tif (testResults.totalFailed ?? 0 > 0) {\n\t\t\tactionResponse.errors = this.generateErrorsFromTestResults(testResults)\n\t\t}\n\n\t\treturn actionResponse\n\t}\n\n\tprivate handleFileChange(payload: DidChangePayload) {\n\t\tif (\n\t\t\tthis.watchMode === 'off' ||\n\t\t\t!(this.runnerStatus === 'run' || this.runnerStatus == 'hold')\n\t\t) {\n\t\t\treturn\n\t\t}\n\n\t\tconst { changes } = payload\n\n\t\tlet shouldRestart = false\n\t\tconst filesWeCareAbout: string[] = []\n\n\t\tfor (const change of changes) {\n\t\t\tconst { path, name } = change.values\n\n\t\t\tif (this.doWeCareAboutThisFileChanging(path)) {\n\t\t\t\tthis.testReporter?.setStatusLabel(`Built file: ${name}`)\n\t\t\t\tshouldRestart = true\n\t\t\t\tfilesWeCareAbout.push(path)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif (shouldRestart) {\n\t\t\tif (this.fileChangeTimeout) {\n\t\t\t\tclearTimeout(this.fileChangeTimeout)\n\t\t\t}\n\n\t\t\tthis.testReporter?.startCountdownTimer(this.watchDelaySec)\n\t\t\tthis.fileChangeTimeout = setTimeout(() => {\n\t\t\t\tif (this.watchMode === 'smart') {\n\t\t\t\t\tconst smartFilter =\n\t\t\t\t\t\tthis.generateFilterFromChangedFiles(filesWeCareAbout)\n\t\t\t\t\tif (smartFilter.length > 0) {\n\t\t\t\t\t\tthis.handleFilterPatternChange(smartFilter)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.restart()\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.restart()\n\t\t\t\t}\n\t\t\t}, this.watchDelaySec * 1000) as any\n\t\t}\n\t}\n\n\tprivate generateFilterFromChangedFiles(filesWeCareAbout: string[]): string {\n\t\tconst filter = filesWeCareAbout\n\t\t\t.filter((file) => file.search('test.js') > -1)\n\t\t\t.map((file) => this.fileToFilterPattern(file))\n\t\t\t.join(' ')\n\n\t\treturn filter\n\t}\n\n\tprivate doWeCareAboutThisFileChanging(path: string) {\n\t\tconst ext = pathUtil.extname(path)\n\n\t\tif (\n\t\t\tpath.search('testDirsAndFiles') > -1 ||\n\t\t\tpath.search('.change_cache') > -1\n\t\t) {\n\t\t\treturn false\n\t\t}\n\n\t\tif (ext === '.js') {\n\t\t\treturn true\n\t\t}\n\n\t\treturn false\n\t}\n\n\tprivate handleToggleDebug() {\n\t\tif (this.inspect) {\n\t\t\tthis.inspect = undefined\n\t\t} else {\n\t\t\tthis.inspect = this.originalInspect\n\t\t}\n\n\t\tthis.testReporter?.setIsDebugging(!!this.inspect)\n\t\tthis.restart()\n\t}\n\n\tprivate handletoggleStandardWatch() {\n\t\tif (this.watchMode === 'standard') {\n\t\t\tthis.testReporter?.setWatchMode('off')\n\t\t} else {\n\t\t\tthis.setWatchMode('standard')\n\t\t}\n\t}\n\n\tprivate handleToggleSmartWatch() {\n\t\tif (this.watchMode === 'smart') {\n\t\t\tthis.setWatchMode('off')\n\t\t} else {\n\t\t\tthis.setWatchMode('smart')\n\t\t}\n\t}\n\n\tpublic setWatchMode(mode: WatchMode) {\n\t\tthis.watchMode = mode\n\t\tthis.testReporter?.setWatchMode(mode)\n\t\tthis.hasWatchEverBeenEnabled = true\n\t}\n\n\tprivate restart() {\n\t\tthis.runnerStatus = 'restart'\n\t\tthis.kill()\n\t}\n\n\tprivate handleQuit() {\n\t\tthis.runnerStatus = 'quit'\n\t\tthis.kill()\n\t}\n\n\tprivate handleRerunTestFile(file: string) {\n\t\tconst name = this.fileToFilterPattern(file)\n\n\t\tthis.testReporter?.setFilterPattern(name)\n\t\tthis.handleFilterPatternChange(name)\n\t}\n\n\tprivate fileToFilterPattern(file: string) {\n\t\tconst filename = pathUtil\n\t\t\t.basename(file, '.ts')\n\t\t\t.replace('.tsx', '')\n\t\t\t.replace('.js', '')\n\t\tconst dirname = pathUtil.dirname(file).split(pathUtil.sep).pop() ?? ''\n\n\t\tconst name = pathUtil.join(dirname, filename)\n\t\treturn name\n\t}\n\n\tprivate handleFilterPatternChange(filterPattern?: string) {\n\t\tthis.pattern = filterPattern\n\t\tthis.testReporter?.setFilterPattern(filterPattern)\n\n\t\tthis.restart()\n\t}\n\n\tprivate handleStartStop() {\n\t\tif (this.runnerStatus === 'hold') {\n\t\t\tthis.runnerStatus = 'run'\n\t\t\tthis.holdPromiseResolve?.()\n\t\t\tthis.holdPromiseResolve = undefined\n\t\t} else if (this.runnerStatus === 'run') {\n\t\t\tthis.runnerStatus = 'hold'\n\t\t\tthis.kill()\n\t\t}\n\t}\n\n\tprivate handleRestart() {\n\t\tthis.restart()\n\t}\n\n\tpublic kill() {\n\t\tthis.testRunner?.kill()\n\t\tthis.holdPromiseResolve?.()\n\t\tthis.holdPromiseResolve = undefined\n\t}\n\n\tprivate async handleOpenTestFile(fileName: string) {\n\t\tawait this.openTestFile(fileName)\n\t}\n\n\tprivate async startTestRunner(\n\t\toptions: SchemaValues<OptionsSchema>\n\t): Promise<SpruceTestResults> {\n\t\tif (this.runnerStatus === 'hold') {\n\t\t\tawait this.waitForStart()\n\t\t}\n\n\t\tif (this.runnerStatus === 'quit') {\n\t\t\treturn this.lastTestResults\n\t\t}\n\n\t\tthis.testReporter?.setStatus('ready')\n\t\tthis.testReporter?.stopCountdownTimer()\n\n\t\tthis.testRunner = new TestRunner({\n\t\t\tcwd: this.cwd,\n\t\t\tcommandService: this.Service('command'),\n\t\t})\n\n\t\tlet firstUpdate = true\n\n\t\tif (this.testReporter) {\n\t\t\tawait this.testRunner.on('did-update', (payload) => {\n\t\t\t\tif (firstUpdate) {\n\t\t\t\t\tfirstUpdate = false\n\t\t\t\t\tthis.testReporter?.setStatus('running')\n\t\t\t\t\tthis.testReporter?.reset()\n\t\t\t\t}\n\n\t\t\t\tif (this.watchMode === 'smart' && payload.results.totalFailed > 0) {\n\t\t\t\t\tconst failed = payload.results.testFiles.find(\n\t\t\t\t\t\t(file: any) => file.status === 'failed'\n\t\t\t\t\t)\n\n\t\t\t\t\tif (failed) {\n\t\t\t\t\t\tconst pattern = this.fileToFilterPattern(failed.path)\n\t\t\t\t\t\tif (this.pattern !== pattern) {\n\t\t\t\t\t\t\tthis.handleFilterPatternChange(pattern)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.testReporter?.updateResults(payload.results)\n\t\t\t\tthis.testReporter?.render()\n\t\t\t})\n\n\t\t\tawait this.testRunner.on('did-error', (payload) => {\n\t\t\t\tthis.testReporter?.appendError(payload.message)\n\t\t\t\tthis.testReporter?.render()\n\t\t\t})\n\t\t}\n\n\t\tthis.runnerStatus = 'run'\n\n\t\tlet testResults: SpruceTestResults = await this.testRunner.run({\n\t\t\tpattern: this.pattern,\n\t\t\tdebugPort: this.inspect,\n\t\t})\n\n\t\tif (\n\t\t\t//@ts-ignore\n\t\t\tthis.runnerStatus !== 'restart' &&\n\t\t\t(!options.shouldReportWhileRunning ||\n\t\t\t\t!this.hasWatchEverBeenEnabled ||\n\t\t\t\t(this.runnerStatus as any) === 'quit')\n\t\t) {\n\t\t\treturn testResults\n\t\t}\n\n\t\tif (\n\t\t\tthis.runnerStatus === 'run' &&\n\t\t\tthis.watchMode === 'smart' &&\n\t\t\tthis.testRunner?.hasFailedTests() === false &&\n\t\t\t!this.testRunner?.hasSkippedTests() &&\n\t\t\t(this.pattern ?? []).length > 0\n\t\t) {\n\t\t\tthis.testReporter?.setStatusLabel('Restarting...')\n\t\t\tthis.runnerStatus = 'restart'\n\t\t\tthis.testReporter?.startCountdownTimer(3)\n\n\t\t\treturn await new Promise((resolve) => {\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tthis.pattern = ''\n\t\t\t\t\tthis.testReporter?.setFilterPattern('')\n\t\t\t\t\tresolve(this.startTestRunner(options))\n\t\t\t\t}, 3000)\n\t\t\t})\n\t\t}\n\n\t\tif (this.runnerStatus === 'run') {\n\t\t\tthis.runnerStatus = 'hold'\n\t\t}\n\n\t\tthis.testReporter?.setStatus('stopped')\n\n\t\tthis.lastTestResults = testResults\n\n\t\treturn this.startTestRunner(options)\n\t}\n\n\tpublic async waitForStart() {\n\t\tawait new Promise((resolve: any) => {\n\t\t\tthis.runnerStatus = 'hold'\n\t\t\tthis.holdPromiseResolve = resolve\n\t\t})\n\t}\n\n\tprivate async openTestFile(fileName: string): Promise<void> {\n\t\tconst path = diskUtil.resolvePath(this.cwd, 'src', '__tests__', fileName)\n\t\tawait open(path)\n\t}\n\n\tprivate generateErrorsFromTestResults(testResults: SpruceTestResults) {\n\t\tconst errors: SpruceError[] = []\n\t\ttestResults.testFiles?.forEach((file) => {\n\t\t\tfile.tests?.forEach((test) => {\n\t\t\t\ttest.errorMessages?.forEach((message) => {\n\t\t\t\t\tconst err = this.mapErrorResultToSpruceError(test, file, message)\n\t\t\t\t\terrors.push(err)\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t\tif (errors.length > 0) {\n\t\t\treturn errors\n\t\t}\n\n\t\treturn undefined\n\t}\n\n\tprivate mapErrorResultToSpruceError(\n\t\ttest: SpruceTestFileTest,\n\t\tfile: SpruceTestFile,\n\t\tmessage: string\n\t) {\n\t\treturn new SpruceError({\n\t\t\tcode: 'TEST_FAILED',\n\t\t\ttestName: test.name,\n\t\t\tfileName: file.path,\n\t\t\terrorMessage: message,\n\t\t})\n\t}\n\n\tpublic getWatchMode() {\n\t\treturn this.watchMode\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAQA;;AACA;;;;;;;;;;;;AAEO,IAAMA,aAAa,GAAGC,uBAAtB;;;IAOcC,U;;;;;EAmBpB,oBAAmBC,OAAnB,EAA2C;IAAA;;IAAA;IAC1C,0BAAMA,OAAN;IAD0C,kGAlBpBH,aAkBoB;IAAA,sGAjBhB,sBAiBgB;IAAA;IAAA;IAAA,iGAbiB,MAajB;IAAA;IAAA;IAAA;IAAA,oGATE;MAAEI,cAAc,EAAE;IAAlB,CASF;IAAA;IAAA;IAAA,8FANZ,KAMY;IAAA;IAAA,4GAJT,KAIS;IAAA,kGAFV,CAEU;IAAA;EAE1C;;;;;mGAED,iBACCD,OADD;QAAA;;QAAA;;QAAA;UAAA;YAAA;cAAA;gBAGC,IAAI,CAACA,OAAO,CAACE,SAAb,EAAwB;kBACjBC,QADiB,GACN,KAAKC,OAAL,CAAa,UAAb,CADM;kBAEvBJ,OAAO,CAACE,SAAR,oBAAoBC,QAAQ,CAACE,GAAT,CAAa,gBAAb,CAApB,yDAAsD,KAAtD;gBACA;;gBAEKC,iBARP,GAQ2B,KAAKC,2BAAL,CAAiCP,OAAjC,CAR3B;gBAWEQ,OAXF,GAi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;gBAAA;gBAAA,OAEO,IAAA0B,gBAAA,EAAK/D,IAAL,CAFP;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;WAKA,uCAAsClB,WAAtC,EAAsE;MAAA;MAAA;;MACrE,IAAMU,MAAqB,GAAG,EAA9B;MACA,yBAAAV,WAAW,CAACmE,SAAZ,gFAAuBe,OAAvB,CAA+B,UAACjD,IAAD,EAAU;QAAA;;QACxC,eAAAA,IAAI,CAACkD,KAAL,4DAAYD,OAAZ,CAAoB,UAACrF,IAAD,EAAU;UAAA;;UAC7B,uBAAAA,IAAI,CAACuF,aAAL,4EAAoBF,OAApB,CAA4B,UAACV,OAAD,EAAa;YACxC,IAAMa,GAAG,GAAG,MAAI,CAACC,2BAAL,CAAiCzF,IAAjC,EAAuCoC,IAAvC,EAA6CuC,OAA7C,CAAZ;;YACA9D,MAAM,CAACY,IAAP,CAAY+D,GAAZ;UACA,CAHD;QAIA,CALD;MAMA,CAPD;;MAQA,IAAI3E,MAAM,CAACoB,MAAP,GAAgB,CAApB,EAAuB;QACtB,OAAOpB,MAAP;MACA;;MAED,OAAOpC,SAAP;IACA;;;WAED,qCACCuB,IADD,EAECoC,IAFD,EAGCuC,OAHD,EAIE;MACD,OAAO,IAAIe,uBAAJ,CAAgB;QACtBC,IAAI,EAAE,aADgB;QAEtBC,QAAQ,EAAE5F,IAAI,CAACsB,IAFO;QAGtBoC,QAAQ,EAAEtB,IAAI,CAACf,IAHO;QAItBwE,YAAY,EAAElB;MAJQ,CAAhB,CAAP;IAMA;;;WAED,wBAAsB;MACrB,OAAO,KAAKrH,SAAZ;IACA;;;EA5asCwI,2B"}
@@ -1 +1 @@
1
- {"version":3,"file":"TestWriter.js","names":["TestGenerator","destinationDir","options","namePascal","filename","resolvedDestination","pathUtil","join","testContent","templates","test","writeFileIfChangedMixinResults","type","results","lint","AbstractWriter"],"sources":["../../../../src/features/test/writers/TestWriter.ts"],"sourcesContent":["import pathUtil from 'path'\nimport { TestOptions } from '@sprucelabs/spruce-templates'\nimport AbstractWriter from '../../../writers/AbstractWriter'\n\nexport default class TestGenerator extends AbstractWriter {\n\tpublic async generateTest(\n\t\tdestinationDir: string,\n\t\toptions: TestOptions & { type: string }\n\t) {\n\t\tconst { namePascal } = options\n\t\tconst filename = `${namePascal}.test.ts`\n\n\t\tconst resolvedDestination = pathUtil.join(destinationDir, filename)\n\t\tconst testContent = this.templates.test(options)\n\n\t\tconst results = await this.writeFileIfChangedMixinResults(\n\t\t\tresolvedDestination,\n\t\t\ttestContent,\n\t\t\t`Your ${options.type} test.`\n\t\t)\n\n\t\tawait this.lint(resolvedDestination)\n\n\t\treturn results\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;;;;;IAEqBA,a;;;;;;;;;;;;;wGACpB,iBACCC,cADD,EAECC,OAFD;QAAA;QAAA;UAAA;YAAA;cAAA;gBAISC,UAJT,GAIwBD,OAJxB,CAISC,UAJT;gBAKOC,QALP,aAKqBD,UALrB;gBAOOE,mBAPP,GAO6BC,iBAASC,IAAT,CAAcN,cAAd,EAA8BG,QAA9B,CAP7B;gBAQOI,WARP,GAQqB,KAAKC,SAAL,CAAeC,IAAf,CAAoBR,OAApB,CARrB;gBAAA;gBAAA,OAUuB,KAAKS,8BAAL,CACrBN,mBADqB,EAErBG,WAFqB,iBAGbN,OAAO,CAACU,IAHK,YAVvB;;cAAA;gBAUOC,OAVP;gBAAA;gBAAA,OAgBO,KAAKC,IAAL,CAAUT,mBAAV,CAhBP;;cAAA;gBAAA,iCAkBQQ,OAlBR;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;EAD0CE,2B"}
1
+ {"version":3,"file":"TestWriter.js","names":["TestGenerator","destinationDir","options","namePascal","filename","resolvedDestination","pathUtil","join","testContent","templates","test","writeFileIfChangedMixinResults","type","results","lint","AbstractWriter"],"sources":["../../../../src/features/test/writers/TestWriter.ts"],"sourcesContent":["import pathUtil from 'path'\nimport { TestOptions } from '@sprucelabs/spruce-templates'\nimport AbstractWriter from '../../../writers/AbstractWriter'\n\nexport default class TestGenerator extends AbstractWriter {\n\tpublic async generateTest(\n\t\tdestinationDir: string,\n\t\toptions: TestOptions & { type: string }\n\t) {\n\t\tconst { namePascal } = options\n\t\tconst filename = `${namePascal}.test.ts`\n\n\t\tconst resolvedDestination = pathUtil.join(destinationDir, filename)\n\t\tconst testContent = this.templates.test(options)\n\n\t\tconst results = await this.writeFileIfChangedMixinResults(\n\t\t\tresolvedDestination,\n\t\t\ttestContent,\n\t\t\t`Your ${options.type} test.`\n\t\t)\n\n\t\tawait this.lint(resolvedDestination)\n\n\t\treturn results\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;;;;;IAEqBA,a;;;;;;;;;;;;;wGACpB,iBACCC,cADD,EAECC,OAFD;QAAA;QAAA;UAAA;YAAA;cAAA;gBAISC,UAJT,GAIwBD,OAJxB,CAISC,UAJT;gBAKOC,QALP,aAKqBD,UALrB;gBAOOE,mBAPP,GAO6BC,gBAAA,CAASC,IAAT,CAAcN,cAAd,EAA8BG,QAA9B,CAP7B;gBAQOI,WARP,GAQqB,KAAKC,SAAL,CAAeC,IAAf,CAAoBR,OAApB,CARrB;gBAAA;gBAAA,OAUuB,KAAKS,8BAAL,CACrBN,mBADqB,EAErBG,WAFqB,iBAGbN,OAAO,CAACU,IAHK,YAVvB;;cAAA;gBAUOC,OAVP;gBAAA;gBAAA,OAgBO,KAAKC,IAAL,CAAUT,mBAAV,CAhBP;;cAAA;gBAAA,iCAkBQQ,OAlBR;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;EAD0CE,2B"}
@@ -1 +1 @@
1
- {"version":3,"file":"validateAndNormalize.utility.js","names":["validateAndNormalizer","validateAndNormalize","schema","options","values","stripUndefined","normalized","noUndefined","Object","keys","forEach","key","undefined"],"sources":["../../src/features/validateAndNormalize.utility.ts"],"sourcesContent":["import {\n\tdefaultSchemaValues,\n\tnormalizeSchemaValues,\n\tSchema,\n\tSchemaPartialValues,\n\tSchemaValuesWithDefaults,\n\tvalidateSchemaValues,\n} from '@sprucelabs/schema'\n\ntype StripNulls<T extends Record<string, any>> = {\n\t[K in keyof T]: Exclude<T[K], null>\n}\n\nconst validateAndNormalizer = {\n\tvalidateAndNormalize<S extends Schema = Schema>(\n\t\tschema: S,\n\t\toptions: SchemaPartialValues<S, false>\n\t) {\n\t\tconst values = {\n\t\t\t...defaultSchemaValues(schema),\n\t\t\t...this.stripUndefined(options),\n\t\t} as SchemaPartialValues<S, false>\n\n\t\tvalidateSchemaValues(schema, values, {})\n\n\t\tconst normalized = normalizeSchemaValues(schema, values)\n\n\t\treturn this.stripUndefined(normalized) as StripNulls<\n\t\t\tSchemaValuesWithDefaults<S>\n\t\t>\n\t},\n\n\tstripUndefined(normalized: Record<string, any>) {\n\t\tconst noUndefined = {}\n\n\t\tObject.keys(normalized).forEach((key: string) => {\n\t\t\t// @ts-ignore\n\t\t\tif (normalized[key] !== undefined) {\n\t\t\t\t//@ts-ignore\n\t\t\t\tnoUndefined[key] = normalized[key]\n\t\t\t}\n\t\t})\n\t\treturn noUndefined\n\t},\n}\n\nexport default validateAndNormalizer\n"],"mappings":";;;;;;;;;;;AAAA;;;;;;AAaA,IAAMA,qBAAqB,GAAG;EAC7BC,oBAD6B,gCAE5BC,MAF4B,EAG5BC,OAH4B,EAI3B;IACD,IAAMC,MAAM,mCACR,iCAAoBF,MAApB,CADQ,GAER,KAAKG,cAAL,CAAoBF,OAApB,CAFQ,CAAZ;;IAKA,kCAAqBD,MAArB,EAA6BE,MAA7B,EAAqC,EAArC;IAEA,IAAME,UAAU,GAAG,mCAAsBJ,MAAtB,EAA8BE,MAA9B,CAAnB;IAEA,OAAO,KAAKC,cAAL,CAAoBC,UAApB,CAAP;EAGA,CAjB4B;EAmB7BD,cAnB6B,0BAmBdC,UAnBc,EAmBmB;IAC/C,IAAMC,WAAW,GAAG,EAApB;IAEAC,MAAM,CAACC,IAAP,CAAYH,UAAZ,EAAwBI,OAAxB,CAAgC,UAACC,GAAD,EAAiB;MAChD;MACA,IAAIL,UAAU,CAACK,GAAD,CAAV,KAAoBC,SAAxB,EAAmC;QAClC;QACAL,WAAW,CAACI,GAAD,CAAX,GAAmBL,UAAU,CAACK,GAAD,CAA7B;MACA;IACD,CAND;IAOA,OAAOJ,WAAP;EACA;AA9B4B,CAA9B;eAiCeP,qB"}
1
+ {"version":3,"file":"validateAndNormalize.utility.js","names":["validateAndNormalizer","validateAndNormalize","schema","options","values","defaultSchemaValues","stripUndefined","validateSchemaValues","normalized","normalizeSchemaValues","noUndefined","Object","keys","forEach","key","undefined"],"sources":["../../src/features/validateAndNormalize.utility.ts"],"sourcesContent":["import {\n\tdefaultSchemaValues,\n\tnormalizeSchemaValues,\n\tSchema,\n\tSchemaPartialValues,\n\tSchemaValuesWithDefaults,\n\tvalidateSchemaValues,\n} from '@sprucelabs/schema'\n\ntype StripNulls<T extends Record<string, any>> = {\n\t[K in keyof T]: Exclude<T[K], null>\n}\n\nconst validateAndNormalizer = {\n\tvalidateAndNormalize<S extends Schema = Schema>(\n\t\tschema: S,\n\t\toptions: SchemaPartialValues<S, false>\n\t) {\n\t\tconst values = {\n\t\t\t...defaultSchemaValues(schema),\n\t\t\t...this.stripUndefined(options),\n\t\t} as SchemaPartialValues<S, false>\n\n\t\tvalidateSchemaValues(schema, values, {})\n\n\t\tconst normalized = normalizeSchemaValues(schema, values)\n\n\t\treturn this.stripUndefined(normalized) as StripNulls<\n\t\t\tSchemaValuesWithDefaults<S>\n\t\t>\n\t},\n\n\tstripUndefined(normalized: Record<string, any>) {\n\t\tconst noUndefined = {}\n\n\t\tObject.keys(normalized).forEach((key: string) => {\n\t\t\t// @ts-ignore\n\t\t\tif (normalized[key] !== undefined) {\n\t\t\t\t//@ts-ignore\n\t\t\t\tnoUndefined[key] = normalized[key]\n\t\t\t}\n\t\t})\n\t\treturn noUndefined\n\t},\n}\n\nexport default validateAndNormalizer\n"],"mappings":";;;;;;;;;;;AAAA;;;;;;AAaA,IAAMA,qBAAqB,GAAG;EAC7BC,oBAD6B,gCAE5BC,MAF4B,EAG5BC,OAH4B,EAI3B;IACD,IAAMC,MAAM,mCACR,IAAAC,2BAAA,EAAoBH,MAApB,CADQ,GAER,KAAKI,cAAL,CAAoBH,OAApB,CAFQ,CAAZ;;IAKA,IAAAI,4BAAA,EAAqBL,MAArB,EAA6BE,MAA7B,EAAqC,EAArC;IAEA,IAAMI,UAAU,GAAG,IAAAC,6BAAA,EAAsBP,MAAtB,EAA8BE,MAA9B,CAAnB;IAEA,OAAO,KAAKE,cAAL,CAAoBE,UAApB,CAAP;EAGA,CAjB4B;EAmB7BF,cAnB6B,0BAmBdE,UAnBc,EAmBmB;IAC/C,IAAME,WAAW,GAAG,EAApB;IAEAC,MAAM,CAACC,IAAP,CAAYJ,UAAZ,EAAwBK,OAAxB,CAAgC,UAACC,GAAD,EAAiB;MAChD;MACA,IAAIN,UAAU,CAACM,GAAD,CAAV,KAAoBC,SAAxB,EAAmC;QAClC;QACAL,WAAW,CAACI,GAAD,CAAX,GAAmBN,UAAU,CAACM,GAAD,CAA7B;MACA;IACD,CAND;IAOA,OAAOJ,WAAP;EACA;AA9B4B,CAA9B;eAiCeV,qB"}