sxy-test-runner 1.4.4 → 2.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 (287) hide show
  1. package/dist/cli/index.js +24 -22
  2. package/dist/cli/init.js +41 -91
  3. package/dist/cli/init.js.map +1 -1
  4. package/dist/cli/lib/addBasePath.d.ts.map +1 -1
  5. package/dist/cli/lib/addBasePath.js +12 -14
  6. package/dist/cli/lib/addBasePath.js.map +1 -1
  7. package/dist/cli/lib/addBasePath.unitTest.d.ts +2 -0
  8. package/dist/cli/lib/addBasePath.unitTest.d.ts.map +1 -0
  9. package/dist/cli/lib/addBasePath.unitTest.js +51 -29
  10. package/dist/cli/lib/addBasePath.unitTest.js.map +1 -0
  11. package/dist/cli/lib/addExports.js +13 -11
  12. package/dist/cli/lib/addExports.unitTest.d.ts +2 -0
  13. package/dist/cli/lib/addExports.unitTest.d.ts.map +1 -0
  14. package/dist/cli/lib/addExports.unitTest.js +15 -30
  15. package/dist/cli/lib/addExports.unitTest.js.map +1 -0
  16. package/dist/cli/lib/applyConfigDefaults.js +6 -42
  17. package/dist/cli/lib/applyConfigDefaults.js.map +1 -1
  18. package/dist/cli/lib/applyConfigDefaults.unitTest.d.ts +2 -0
  19. package/dist/cli/lib/applyConfigDefaults.unitTest.d.ts.map +1 -0
  20. package/dist/cli/lib/applyConfigDefaults.unitTest.js +19 -27
  21. package/dist/cli/lib/applyConfigDefaults.unitTest.js.map +1 -0
  22. package/dist/cli/lib/buildDependencyTree.js +23 -34
  23. package/dist/cli/lib/buildDependencyTree.js.map +1 -1
  24. package/dist/cli/lib/buildDependencyTree.unitTest.d.ts +2 -0
  25. package/dist/cli/lib/buildDependencyTree.unitTest.d.ts.map +1 -0
  26. package/dist/cli/lib/buildDependencyTree.unitTest.js +13 -11
  27. package/dist/cli/lib/buildDependencyTree.unitTest.js.map +1 -0
  28. package/dist/cli/lib/buildDependencyTrees.js +15 -34
  29. package/dist/cli/lib/buildDependencyTrees.js.map +1 -1
  30. package/dist/cli/lib/buildDependencyTrees.unitTest.d.ts +2 -0
  31. package/dist/cli/lib/buildDependencyTrees.unitTest.d.ts.map +1 -0
  32. package/dist/cli/lib/buildDependencyTrees.unitTest.js +18 -14
  33. package/dist/cli/lib/buildDependencyTrees.unitTest.js.map +1 -0
  34. package/dist/cli/lib/defaultConfig.js +23 -21
  35. package/dist/cli/lib/defaultConfig.unitTest.d.ts +2 -0
  36. package/dist/cli/lib/defaultConfig.unitTest.d.ts.map +1 -0
  37. package/dist/cli/lib/defaultConfig.unitTest.js +7 -0
  38. package/dist/cli/lib/defaultConfig.unitTest.js.map +1 -0
  39. package/dist/cli/lib/doUserSetup.d.ts +1 -1
  40. package/dist/cli/lib/doUserSetup.d.ts.map +1 -1
  41. package/dist/cli/lib/doUserSetup.js +20 -23
  42. package/dist/cli/lib/doUserSetup.js.map +1 -1
  43. package/dist/cli/lib/doUserSetup.unitTest.d.ts +7 -0
  44. package/dist/cli/lib/doUserSetup.unitTest.d.ts.map +1 -0
  45. package/dist/cli/lib/doUserSetup.unitTest.js +41 -36
  46. package/dist/cli/lib/doUserSetup.unitTest.js.map +1 -0
  47. package/dist/cli/lib/doUserTeardown.d.ts +1 -1
  48. package/dist/cli/lib/doUserTeardown.d.ts.map +1 -1
  49. package/dist/cli/lib/doUserTeardown.js +21 -23
  50. package/dist/cli/lib/doUserTeardown.js.map +1 -1
  51. package/dist/cli/lib/doUserTeardown.unitTest.d.ts +7 -0
  52. package/dist/cli/lib/doUserTeardown.unitTest.d.ts.map +1 -0
  53. package/dist/cli/lib/doUserTeardown.unitTest.js +41 -36
  54. package/dist/cli/lib/doUserTeardown.unitTest.js.map +1 -0
  55. package/dist/cli/lib/findTestFiles.d.ts.map +1 -1
  56. package/dist/cli/lib/findTestFiles.js +16 -24
  57. package/dist/cli/lib/findTestFiles.js.map +1 -1
  58. package/dist/cli/lib/findTestFiles.unitTest.d.ts +2 -0
  59. package/dist/cli/lib/findTestFiles.unitTest.d.ts.map +1 -0
  60. package/dist/cli/lib/findTestFiles.unitTest.js +19 -19
  61. package/dist/cli/lib/findTestFiles.unitTest.js.map +1 -0
  62. package/dist/cli/lib/getAllowedFlags.js +10 -8
  63. package/dist/cli/lib/getAllowedFlags.unitTest.d.ts +2 -0
  64. package/dist/cli/lib/getAllowedFlags.unitTest.d.ts.map +1 -0
  65. package/dist/cli/lib/getAllowedFlags.unitTest.js +22 -21
  66. package/dist/cli/lib/getAllowedFlags.unitTest.js.map +1 -0
  67. package/dist/cli/lib/globArgCombine.js +8 -1
  68. package/dist/cli/lib/globArgCombine.unitTest.d.ts +2 -0
  69. package/dist/cli/lib/globArgCombine.unitTest.d.ts.map +1 -0
  70. package/dist/cli/lib/globArgCombine.unitTest.js +19 -18
  71. package/dist/cli/lib/globArgCombine.unitTest.js.map +1 -0
  72. package/dist/cli/lib/injectProperties.d.ts.map +1 -1
  73. package/dist/cli/lib/injectProperties.js +10 -10
  74. package/dist/cli/lib/injectProperties.js.map +1 -1
  75. package/dist/cli/lib/injectProperties.unitTest.d.ts +2 -0
  76. package/dist/cli/lib/injectProperties.unitTest.d.ts.map +1 -0
  77. package/dist/cli/lib/injectProperties.unitTest.js +19 -81
  78. package/dist/cli/lib/injectProperties.unitTest.js.map +1 -0
  79. package/dist/cli/lib/loadConfig.js +14 -18
  80. package/dist/cli/lib/loadConfig.js.map +1 -1
  81. package/dist/cli/lib/loadConfig.unitTest.d.ts +2 -0
  82. package/dist/cli/lib/loadConfig.unitTest.d.ts.map +1 -0
  83. package/dist/cli/lib/loadConfig.unitTest.js +15 -15
  84. package/dist/cli/lib/loadConfig.unitTest.js.map +1 -0
  85. package/dist/cli/lib/loadTestFile.js +48 -78
  86. package/dist/cli/lib/loadTestFile.js.map +1 -1
  87. package/dist/cli/lib/loadTestFile.unitTest.d.ts +2 -0
  88. package/dist/cli/lib/loadTestFile.unitTest.d.ts.map +1 -0
  89. package/dist/cli/lib/loadTestFile.unitTest.js +12 -49
  90. package/dist/cli/lib/loadTestFile.unitTest.js.map +1 -0
  91. package/dist/cli/lib/parseCommandLineArguments.js +48 -42
  92. package/dist/cli/lib/parseCommandLineArguments.unitTest.d.ts +2 -0
  93. package/dist/cli/lib/parseCommandLineArguments.unitTest.d.ts.map +1 -0
  94. package/dist/cli/lib/parseCommandLineArguments.unitTest.js +22 -24
  95. package/dist/cli/lib/parseCommandLineArguments.unitTest.js.map +1 -0
  96. package/dist/cli/lib/parseDescribe.d.ts.map +1 -1
  97. package/dist/cli/lib/parseDescribe.js +67 -81
  98. package/dist/cli/lib/parseDescribe.js.map +1 -1
  99. package/dist/cli/lib/parseDescribe.unitTest.d.ts +2 -0
  100. package/dist/cli/lib/parseDescribe.unitTest.d.ts.map +1 -0
  101. package/dist/cli/lib/parseDescribe.unitTest.js +20 -18
  102. package/dist/cli/lib/parseDescribe.unitTest.js.map +1 -0
  103. package/dist/cli/lib/reservedExportKeys.d.ts +2 -0
  104. package/dist/cli/lib/reservedExportKeys.d.ts.map +1 -0
  105. package/dist/cli/lib/reservedExportKeys.js +12 -1
  106. package/dist/cli/lib/reservedExportKeys.js.map +1 -0
  107. package/dist/cli/lib/reservedExportKeys.unitTest.d.ts +2 -0
  108. package/dist/cli/lib/reservedExportKeys.unitTest.d.ts.map +1 -0
  109. package/dist/cli/lib/reservedExportKeys.unitTest.js +6 -8
  110. package/dist/cli/lib/reservedExportKeys.unitTest.js.map +1 -0
  111. package/dist/cli/lib/runDescribe.d.ts.map +1 -1
  112. package/dist/cli/lib/runDescribe.js +39 -39
  113. package/dist/cli/lib/runDescribe.js.map +1 -1
  114. package/dist/cli/lib/runDescribe.unitTest.d.ts +2 -0
  115. package/dist/cli/lib/runDescribe.unitTest.d.ts.map +1 -0
  116. package/dist/cli/lib/runDescribe.unitTest.js +22 -402
  117. package/dist/cli/lib/runDescribe.unitTest.js.map +1 -0
  118. package/dist/cli/lib/runDescribeRun.js +34 -49
  119. package/dist/cli/lib/runDescribeRun.js.map +1 -1
  120. package/dist/cli/lib/runDescribeRun.unitTest.d.ts +2 -0
  121. package/dist/cli/lib/runDescribeRun.unitTest.d.ts.map +1 -0
  122. package/dist/cli/lib/runDescribeRun.unitTest.js +44 -410
  123. package/dist/cli/lib/runDescribeRun.unitTest.js.map +1 -0
  124. package/dist/cli/lib/runIt.d.ts +1 -1
  125. package/dist/cli/lib/runIt.d.ts.map +1 -1
  126. package/dist/cli/lib/runIt.js +59 -69
  127. package/dist/cli/lib/runIt.js.map +1 -1
  128. package/dist/cli/lib/runIt.unitTest.d.ts +2 -0
  129. package/dist/cli/lib/runIt.unitTest.d.ts.map +1 -0
  130. package/dist/cli/lib/runIt.unitTest.js +73 -410
  131. package/dist/cli/lib/runIt.unitTest.js.map +1 -0
  132. package/dist/cli/lib/runTasks.d.ts +1 -1
  133. package/dist/cli/lib/runTasks.d.ts.map +1 -1
  134. package/dist/cli/lib/runTasks.js +28 -31
  135. package/dist/cli/lib/runTasks.js.map +1 -1
  136. package/dist/cli/lib/runTasks.unitTest.d.ts +5 -0
  137. package/dist/cli/lib/runTasks.unitTest.d.ts.map +1 -0
  138. package/dist/cli/lib/runTasks.unitTest.js +35 -31
  139. package/dist/cli/lib/runTasks.unitTest.js.map +1 -0
  140. package/dist/cli/lib/runTest.js +54 -66
  141. package/dist/cli/lib/runTest.js.map +1 -1
  142. package/dist/cli/lib/runTest.unitTest.d.ts +20 -0
  143. package/dist/cli/lib/runTest.unitTest.d.ts.map +1 -0
  144. package/dist/cli/lib/runTest.unitTest.js +274 -289
  145. package/dist/cli/lib/runTest.unitTest.js.map +1 -0
  146. package/dist/cli/lib/runTests.d.ts.map +1 -1
  147. package/dist/cli/lib/runTests.js +123 -141
  148. package/dist/cli/lib/runTests.js.map +1 -1
  149. package/dist/cli/lib/runTests.unitTest.d.ts +6 -0
  150. package/dist/cli/lib/runTests.unitTest.d.ts.map +1 -0
  151. package/dist/cli/lib/runTests.unitTest.js +48 -61
  152. package/dist/cli/lib/runTests.unitTest.js.map +1 -0
  153. package/dist/cli/lib/showTestLoadingError.js +22 -33
  154. package/dist/cli/lib/showTestLoadingError.js.map +1 -1
  155. package/dist/cli/lib/showTestLoadingError.unitTest.d.ts +2 -0
  156. package/dist/cli/lib/showTestLoadingError.unitTest.d.ts.map +1 -0
  157. package/dist/cli/lib/showTestLoadingError.unitTest.js +16 -24
  158. package/dist/cli/lib/showTestLoadingError.unitTest.js.map +1 -0
  159. package/dist/cli/lib/showTestResult.js +88 -88
  160. package/dist/cli/lib/showTestResult.js.map +1 -1
  161. package/dist/cli/lib/showTestResult.unitTest.d.ts +2 -0
  162. package/dist/cli/lib/showTestResult.unitTest.d.ts.map +1 -0
  163. package/dist/cli/lib/showTestResult.unitTest.js +176 -184
  164. package/dist/cli/lib/showTestResult.unitTest.js.map +1 -0
  165. package/dist/cli/lib/testHelpers/makeCustomOut.d.ts +7 -0
  166. package/dist/cli/lib/testHelpers/makeCustomOut.d.ts.map +1 -0
  167. package/dist/cli/lib/testHelpers/makeCustomOut.js +10 -0
  168. package/dist/cli/lib/testHelpers/makeCustomOut.js.map +1 -0
  169. package/dist/cli/lib/timeProfier.js +4 -6
  170. package/dist/cli/lib/timeProfier.js.map +1 -1
  171. package/dist/cli/lib/validateConfig.js +21 -24
  172. package/dist/cli/lib/validateConfig.unitTest.d.ts +2 -0
  173. package/dist/cli/lib/validateConfig.unitTest.d.ts.map +1 -0
  174. package/dist/cli/lib/validateConfig.unitTest.js +17 -18
  175. package/dist/cli/lib/validateConfig.unitTest.js.map +1 -0
  176. package/dist/cli/lib/{watchFiles.js → watchFiles.d.ts} +2 -1
  177. package/dist/cli/lib/watchFiles.d.ts.map +1 -0
  178. package/dist/cli/lib/watchFiles.js.map +1 -0
  179. package/dist/cli/lib/watchFiles.unitTest.d.ts +2 -0
  180. package/dist/cli/lib/watchFiles.unitTest.d.ts.map +1 -0
  181. package/dist/cli/lib/watchFiles.unitTest.js.map +1 -0
  182. package/dist/cli/lib/watchFilesAndRunTests.js +2 -3
  183. package/dist/cli/lib/watchFilesAndRunTests.unitTest.d.ts +2 -0
  184. package/dist/cli/lib/watchFilesAndRunTests.unitTest.d.ts.map +1 -0
  185. package/dist/cli/lib/watchFilesAndRunTests.unitTest.js +86 -96
  186. package/dist/cli/lib/watchFilesAndRunTests.unitTest.js.map +1 -0
  187. package/dist/cli/lib/watchFilesAndRunTestsChokidar.d.ts.map +1 -1
  188. package/dist/cli/lib/watchFilesAndRunTestsChokidar.js +99 -127
  189. package/dist/cli/lib/watchFilesAndRunTestsChokidar.js.map +1 -1
  190. package/dist/cli/lib/watchFilesAndRunTestsChokidar.unitTest.d.ts +2 -0
  191. package/dist/cli/lib/watchFilesAndRunTestsChokidar.unitTest.d.ts.map +1 -0
  192. package/dist/cli/lib/watchFilesAndRunTestsChokidar.unitTest.js +90 -99
  193. package/dist/cli/lib/watchFilesAndRunTestsChokidar.unitTest.js.map +1 -0
  194. package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.d.ts.map +1 -1
  195. package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.js +108 -148
  196. package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.js.map +1 -1
  197. package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.unitTest.d.ts +2 -0
  198. package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.unitTest.d.ts.map +1 -0
  199. package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.unitTest.js +87 -100
  200. package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.unitTest.js.map +1 -0
  201. package/dist/cli/lib/watchFilesChokidar.js +30 -56
  202. package/dist/cli/lib/watchFilesChokidar.js.map +1 -1
  203. package/dist/cli/lib/watchFilesChokidar.unitTest.d.ts +2 -0
  204. package/dist/cli/lib/watchFilesChokidar.unitTest.d.ts.map +1 -0
  205. package/dist/cli/lib/watchFilesChokidar.unitTest.js +77 -81
  206. package/dist/cli/lib/watchFilesChokidar.unitTest.js.map +1 -0
  207. package/dist/cli/lib/watchFilesNodeWatch.js +31 -41
  208. package/dist/cli/lib/watchFilesNodeWatch.js.map +1 -1
  209. package/dist/cli/lib/watchFilesNodeWatch.unitTest.d.ts +2 -0
  210. package/dist/cli/lib/watchFilesNodeWatch.unitTest.d.ts.map +1 -0
  211. package/dist/cli/lib/watchFilesNodeWatch.unitTest.js +41 -46
  212. package/dist/cli/lib/watchFilesNodeWatch.unitTest.js.map +1 -0
  213. package/dist/cli/once.js +35 -42
  214. package/dist/cli/once.js.map +1 -1
  215. package/dist/cli/watch.js +64 -114
  216. package/dist/cli/watch.js.map +1 -1
  217. package/dist/cli/watch.unitTest.d.ts +6 -0
  218. package/dist/cli/watch.unitTest.d.ts.map +1 -0
  219. package/dist/cli/watch.unitTest.js +100 -111
  220. package/dist/cli/watch.unitTest.js.map +1 -0
  221. package/dist/config.d.ts +1 -1
  222. package/dist/config.d.ts.map +1 -1
  223. package/dist/config.js +13 -2
  224. package/dist/config.js.map +1 -1
  225. package/dist/describe.js +20 -34
  226. package/dist/describe.js.map +1 -1
  227. package/dist/describe.unitTest.d.ts +2 -0
  228. package/dist/describe.unitTest.d.ts.map +1 -0
  229. package/dist/describe.unitTest.js +19 -23
  230. package/dist/describe.unitTest.js.map +1 -0
  231. package/dist/index.js +2 -1
  232. package/dist/indexNumberToLetters.js +12 -11
  233. package/dist/output.js +16 -18
  234. package/dist/packages/chalk.d.ts +14 -0
  235. package/dist/packages/chalk.d.ts.map +1 -0
  236. package/dist/packages/chalk.js +22 -0
  237. package/dist/packages/chalk.js.map +1 -0
  238. package/dist/packages/figures.d.ts +6 -0
  239. package/dist/packages/figures.d.ts.map +1 -0
  240. package/dist/packages/figures.js +24 -0
  241. package/dist/packages/figures.js.map +1 -0
  242. package/dist/packages/loadConfig.d.ts +3 -0
  243. package/dist/packages/loadConfig.d.ts.map +1 -0
  244. package/dist/packages/loadConfig.js +28 -0
  245. package/dist/packages/loadConfig.js.map +1 -0
  246. package/dist/packages/mergeStructuredConfig.d.ts +2 -0
  247. package/dist/packages/mergeStructuredConfig.d.ts.map +1 -0
  248. package/dist/packages/mergeStructuredConfig.js +26 -0
  249. package/dist/packages/mergeStructuredConfig.js.map +1 -0
  250. package/dist/packages/slash.d.ts +2 -0
  251. package/dist/packages/slash.d.ts.map +1 -0
  252. package/dist/packages/slash.js +9 -0
  253. package/dist/packages/slash.js.map +1 -0
  254. package/dist/packages/timeProfiler.d.ts +6 -0
  255. package/dist/packages/timeProfiler.d.ts.map +1 -0
  256. package/dist/packages/timeProfiler.js +32 -0
  257. package/dist/packages/timeProfiler.js.map +1 -0
  258. package/dist/types.d.ts +13 -13
  259. package/dist/types.d.ts.map +1 -1
  260. package/package.json +24 -20
  261. package/dist/cli/files.js +0 -20
  262. package/dist/cli/files.unitTest.js +0 -246
  263. package/dist/cli/init.unitTest.js +0 -0
  264. package/dist/cli/lib/defaultConfig.test.js +0 -9
  265. package/dist/cli/lib/loadTestFileStatic.js +0 -41
  266. package/dist/cli/lib/loadTestFileStatic.unitTest.js +0 -30
  267. package/dist/cli/lib/processWatchEvent.js +0 -1
  268. package/dist/cli/lib/processWatchEvent.unitTest.js +0 -15
  269. package/dist/cli/lib/runDescribe.old.js +0 -108
  270. package/dist/cli/lib/runDescribe.old.unitTest.js +0 -440
  271. package/dist/cli/lib/runTest-old.js +0 -160
  272. package/dist/cli/lib/runTest-old.unitTest.js +0 -184
  273. package/dist/cli/lib/watchFiles.unitTest.js +0 -50
  274. package/dist/cli/once.unitTest.js +0 -39
  275. package/dist/describe-old.js +0 -271
  276. package/dist/describe-old.unitTest.js +0 -30
  277. package/dist/exported.eslintrc.js +0 -7
  278. package/dist/lib/arrayRemove.d.ts +0 -2
  279. package/dist/lib/arrayRemove.d.ts.map +0 -1
  280. package/dist/lib/arrayRemove.js +0 -15
  281. package/dist/lib/arrayRemove.js.map +0 -1
  282. package/dist/lib/promiseAllObj.d.ts +0 -2
  283. package/dist/lib/promiseAllObj.d.ts.map +0 -1
  284. package/dist/lib/promiseAllObj.js +0 -14
  285. package/dist/lib/promiseAllObj.js.map +0 -1
  286. package/dist/testsState.js +0 -5
  287. package/dist/timeProfiling.js +0 -9
@@ -1,24 +1,21 @@
1
- import { out as mainOut, log, debug } from '../../output.js';
2
- export async function validateConfig(config, customOut = undefined) {
3
- const out = customOut ? async (...texts) => await customOut(...texts) : async (...texts) => await mainOut(...texts);
4
- if (config.execution === undefined) {
5
- const message = `Config error, config.execution is not defined`;
6
- await doError(message);
7
- }
8
- if (config.execution.files !== 'parallel' && config.execution.files !== 'sequential') {
9
- const message = `Config error, config.execution.files should be 'parallel' or 'sequential'`;
10
- await doError(message);
11
- }
12
- if (config.execution.describes !== 'parallel' && config.execution.describes !== 'sequential') {
13
- const message = `Config error, config.execution.describes should be 'parallel' or 'sequential'`;
14
- await doError(message);
15
- }
16
- if (config.execution.tests !== 'parallel' && config.execution.tests !== 'sequential') {
17
- const message = `Config error, config.execution.tests should be 'parallel' or 'sequential'`;
18
- await doError(message);
19
- }
20
- async function doError(message) {
21
- await out(message);
22
- throw new Error(message);
23
- }
24
- }
1
+ import { out as mainOut } from '../../output.js';
2
+ export function validateConfig(config, customOut) {
3
+ const out = customOut ?? mainOut;
4
+ function doError(message) {
5
+ out(message);
6
+ throw new Error(message);
7
+ }
8
+ if (config.execution === undefined) {
9
+ doError('Config error, config.execution is not defined');
10
+ }
11
+ if (config.execution.files !== 'parallel' && config.execution.files !== 'sequential') {
12
+ doError('Config error, config.execution.files should be \'parallel\' or \'sequential\'');
13
+ }
14
+ if (config.execution.describes !== 'parallel' && config.execution.describes !== 'sequential') {
15
+ doError('Config error, config.execution.describes should be \'parallel\' or \'sequential\'');
16
+ }
17
+ if (config.execution.tests !== 'parallel' && config.execution.tests !== 'sequential') {
18
+ doError('Config error, config.execution.tests should be \'parallel\' or \'sequential\'');
19
+ }
20
+ }
21
+ //# sourceMappingURL=validateConfig.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=validateConfig.unitTest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateConfig.unitTest.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/validateConfig.unitTest.ts"],"names":[],"mappings":""}
@@ -1,21 +1,20 @@
1
1
  import { applyConfigDefaults } from './applyConfigDefaults.js';
2
2
  import { validateConfig } from './validateConfig.js';
3
- // loadTestFile(config, testFile) ???
4
-
5
- import { makeCustomOut } from '../../../unitTesting/makeCustomOut.js';
6
- await mochaDescribe('validateConfig() function', async function () {
7
- await mochaIt('complains if execution values are not valid', async function () {
8
- const customOut = await makeCustomOut();
9
- const config = await applyConfigDefaults({
10
- execution: {
11
- files: 'typo'
12
- }
3
+ import { makeCustomOut } from './testHelpers/makeCustomOut.js';
4
+ mochaDescribe('validateConfig() function', function () {
5
+ mochaIt('complains if execution values are not valid', function () {
6
+ const customOut = makeCustomOut();
7
+ const config = applyConfigDefaults({
8
+ execution: {
9
+ files: 'typo'
10
+ }
11
+ });
12
+ try {
13
+ validateConfig(config, customOut);
14
+ }
15
+ catch { /* expected */ }
16
+ customOut.getOutBuffer().should.include('Config error');
17
+ customOut.getOutBuffer().should.include('execution.files');
13
18
  });
14
- try {
15
- await validateConfig(config, customOut);
16
- } catch (e) {} // eslint-disable-line
17
-
18
- await (await customOut.getOutBuffer()).should.include('Config error');
19
- await (await customOut.getOutBuffer()).should.include('execution.files');
20
- });
21
- });
19
+ });
20
+ //# sourceMappingURL=validateConfig.unitTest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateConfig.unitTest.js","sourceRoot":"","sources":["../../../src/cli/lib/validateConfig.unitTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAE9D,aAAa,CAAC,2BAA2B,EAAE;IACvC,OAAO,CAAC,6CAA6C,EAAE;QACnD,MAAM,SAAS,GAAG,aAAa,EAAE,CAAA;QAEjC,MAAM,MAAM,GAAG,mBAAmB,CAAC;YAC/B,SAAS,EAAE;gBACP,KAAK,EAAE,MAAe;aACzB;SACJ,CAAC,CAAA;QAEF,IAAI,CAAC;YACD,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;QACrC,CAAC;QAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;QAE1B,SAAS,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;QACvD,SAAS,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAC9D,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
@@ -1 +1,2 @@
1
- export { watchFilesChokidar as watchFiles } from './watchFilesChokidar.js';
1
+ export { watchFilesChokidar as watchFiles } from './watchFilesChokidar.js';
2
+ //# sourceMappingURL=watchFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchFiles.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/watchFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchFiles.js","sourceRoot":"","sources":["../../../src/cli/lib/watchFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=watchFiles.unitTest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchFiles.unitTest.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/watchFiles.unitTest.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchFiles.unitTest.js","sourceRoot":"","sources":["../../../src/cli/lib/watchFiles.unitTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,Q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,CAAC,CAAA;QAEF,KAAK,EAAE,CAAC,SAAS,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAA;QAE3D,MAAM,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;YAC9B,MAAM,QAAQ,GAAG,WAAW,CACxB,GAAG,EAAE;gBACD,IAAI,aAAa,EAAE,CAAC;oBAChB,aAAa,CAAC,QAAQ,CAAC,CAAA;oBACvB,OAAO,EAAE,CAAA;gBACb,CAAC;YACL,CAAC,EACD,EAAE,CACL,CAAA;QACL,CAAC,CAAC,CAAA;QAEF,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
@@ -1,4 +1,3 @@
1
1
  export { watchFilesAndRunTestsNodeWatch as watchFilesAndRunTests } from './watchFilesAndRunTestsNodeWatch.js';
2
-
3
- //export { watchFilesAndRunTestsChokidar as watchFilesAndRunTests }
4
- // from './watchFilesAndRunTestsChokidar.js'
2
+ //export { watchFilesAndRunTestsChokidar as watchFilesAndRunTests } from './watchFilesAndRunTestsChokidar.js'
3
+ //# sourceMappingURL=watchFilesAndRunTests.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=watchFilesAndRunTests.unitTest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchFilesAndRunTests.unitTest.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesAndRunTests.unitTest.ts"],"names":[],"mappings":""}
@@ -1,40 +1,30 @@
1
1
  import { promises as fs, existsSync } from 'fs';
2
- import figures from 'figures';
3
- import { objectCopy } from 'sxy-lib-object-copy';
2
+ import figures from '../../packages/figures.js';
4
3
  import { watchFilesAndRunTests } from './watchFilesAndRunTests.js';
5
4
  import { applyConfigDefaults } from './applyConfigDefaults.js';
6
-
7
- // watchFiles(config, testFiles, dependencyTrees, failingTests)
8
-
9
- await mochaDescribe('watchFilesAndRunTests() function', async function () {
10
- const tempFolder = 'watchTests/watchFilesAndRunTests';
11
- const baseConfig = await applyConfigDefaults({
12
- testsBase: tempFolder,
13
- tests: '**/*.test.js',
14
- watch: {
15
- watchFilesBase: tempFolder,
16
- watchFiles: '**/*.js'
17
- }
18
- });
19
- await mochaIt('should run a test when a test file is changed', async function () {
20
- //this.timeout(100000)
21
-
22
- const config = await objectCopy(baseConfig);
23
-
24
- // create a custom out function to capture the output
25
- let outBuffer = '';
26
- const customOut = (...texts) => {
27
- outBuffer += texts.join(' ') + '\n'; // join and save to the buffer
28
- };
29
- watchFilesAndRunTests(config, [], {}, [], customOut);
30
-
31
- //console.log('outBuffer', outBuffer)
32
-
33
- await outBuffer.should.equal('');
34
- const testFileName = `${tempFolder}/a.test.js`;
35
- const thing = 'Sample test 1';
36
- const should = '1 should equal 1';
37
- await fs.writeFile(testFileName, `import { describe } from '../../dist/index.js'
5
+ mochaDescribe('watchFilesAndRunTests() function', function () {
6
+ const tempFolder = 'watchTests/watchFilesAndRunTests';
7
+ const baseConfig = applyConfigDefaults({
8
+ testsBase: tempFolder,
9
+ tests: '**/*.test.js',
10
+ watch: {
11
+ watchFilesBase: tempFolder,
12
+ watchFiles: '**/*.js'
13
+ }
14
+ });
15
+ mochaIt('should run a test when a test file is changed', async function () {
16
+ const config = structuredClone(baseConfig);
17
+ // create a custom out function to capture the output
18
+ let outBuffer = '';
19
+ const customOut = (...texts) => {
20
+ outBuffer += texts.join(' ') + '\n';
21
+ };
22
+ void watchFilesAndRunTests(config, [], {}, [], customOut);
23
+ outBuffer.should.equal('');
24
+ const testFileName = `${tempFolder}/a.test.js`;
25
+ const thing = 'Sample test 1';
26
+ const should = '1 should equal 1';
27
+ void fs.writeFile(testFileName, `import { describe } from '../../dist/index.js'
38
28
  import { expect, should } from 'chai'
39
29
  should()
40
30
 
@@ -45,30 +35,29 @@ describe('${thing}', ({it}) => {
45
35
  })
46
36
 
47
37
  })`);
48
- await new Promise(async (resolve, reject) => await setTimeout(resolve, 1000));
49
- await outBuffer.should.include(testFileName);
50
- await outBuffer.should.include(thing);
51
- await outBuffer.should.include(should);
52
- await outBuffer.should.include(figures.tick);
53
- });
54
- await mochaIt('should run a test when a new test file is changed', async function () {
55
- const config = await objectCopy(baseConfig);
56
-
57
- // create a custom out function to capture the output
58
- let outBuffer = '';
59
- const customOut = (...texts) => {
60
- outBuffer += texts.join(' ') + '\n'; // join and save to the buffer
61
- };
62
- const testFileName = `${tempFolder}/b.test.js`;
63
- const thing = 'Sample test 2';
64
- const should = '2 should equal 2';
65
- if (await existsSync(testFileName)) {
66
- await fs.unlink(testFileName);
67
- }
68
- await (await existsSync(testFileName)).should.equal(false);
69
- await watchFilesAndRunTests(config, [], {}, [], customOut);
70
- await outBuffer.should.equal('');
71
- await fs.writeFile(testFileName, `import { describe } from '../../dist/index.js'
38
+ await new Promise(resolve => setTimeout(resolve, 1000));
39
+ outBuffer.should.include(testFileName);
40
+ outBuffer.should.include(thing);
41
+ outBuffer.should.include(should);
42
+ outBuffer.should.include(figures.tick);
43
+ });
44
+ mochaIt('should run a test when a new test file is changed', async function () {
45
+ const config = structuredClone(baseConfig);
46
+ // create a custom out function to capture the output
47
+ let outBuffer = '';
48
+ const customOut = (...texts) => {
49
+ outBuffer += texts.join(' ') + '\n';
50
+ };
51
+ const testFileName = `${tempFolder}/b.test.js`;
52
+ const thing = 'Sample test 2';
53
+ const should = '2 should equal 2';
54
+ if (existsSync(testFileName)) {
55
+ await fs.unlink(testFileName);
56
+ }
57
+ existsSync(testFileName).should.equal(false);
58
+ await watchFilesAndRunTests(config, [], {}, [], customOut);
59
+ outBuffer.should.equal('');
60
+ void fs.writeFile(testFileName, `import { describe } from '../../dist/index.js'
72
61
  import { expect, should } from 'chai'
73
62
  should()
74
63
 
@@ -79,27 +68,24 @@ describe('${thing}', ({it}) => {
79
68
  })
80
69
 
81
70
  })`);
82
- await new Promise(async (resolve, reject) => await setTimeout(resolve, 1000));
83
- await outBuffer.should.include(testFileName);
84
- await outBuffer.should.include(thing);
85
- await outBuffer.should.include(should);
86
- await outBuffer.should.include(figures.tick);
87
- });
88
- await mochaIt('removes a test from tests and dependencyTrees when it is deleted', async function () {
89
- //this.timeout(100000)
90
-
91
- const config = await objectCopy(baseConfig);
92
-
93
- // create a custom out function to capture the output
94
- let outBuffer = '';
95
- const customOut = (...texts) => {
96
- outBuffer += texts.join(' ') + '\n'; // join and save to the buffer
97
- };
98
- const testFileName = `${tempFolder}/c.test.js`;
99
- const thing = 'Sample test 3';
100
- const should = '3 should equal 3';
101
- if (!(await existsSync(testFileName))) {
102
- await fs.writeFile(testFileName, `import { describe } from '../../dist/index.js'
71
+ await new Promise(resolve => setTimeout(resolve, 1000));
72
+ outBuffer.should.include(testFileName);
73
+ outBuffer.should.include(thing);
74
+ outBuffer.should.include(should);
75
+ outBuffer.should.include(figures.tick);
76
+ });
77
+ mochaIt('removes a test from tests and dependencyTrees when it is deleted', async function () {
78
+ const config = structuredClone(baseConfig);
79
+ // create a custom out function to capture the output
80
+ let outBuffer = '';
81
+ const customOut = (...texts) => {
82
+ outBuffer += texts.join(' ') + '\n';
83
+ };
84
+ const testFileName = `${tempFolder}/c.test.js`;
85
+ const thing = 'Sample test 3';
86
+ const should = '3 should equal 3';
87
+ if (!existsSync(testFileName)) {
88
+ await fs.writeFile(testFileName, `import { describe } from '../../dist/index.js'
103
89
  import { expect, should } from 'chai'
104
90
  should()
105
91
 
@@ -110,20 +96,24 @@ describe('${thing}', ({it}) => {
110
96
  })
111
97
 
112
98
  })`);
113
- }
114
- (await existsSync(testFileName)).should.be.true;
115
- const originalTests = [testFileName];
116
- const originalDependencyTrees = {
117
- [testFileName]: ['dep-1.js', 'dep-2.js']
118
- };
119
- const tests = await objectCopy(originalTests);
120
- const dependencyTrees = await objectCopy(originalDependencyTrees);
121
- await tests.should.include.members([testFileName]);
122
- await dependencyTrees.should.include.keys([testFileName]);
123
- await watchFilesAndRunTests(config, tests, dependencyTrees, [], customOut);
124
- await fs.unlink(testFileName);
125
- await new Promise(async (resolve, reject) => await setTimeout(resolve, 1000));
126
- await tests.should.not.include.members([testFileName]);
127
- await dependencyTrees.should.not.include.keys([testFileName]);
128
- });
129
- });
99
+ }
100
+ existsSync(testFileName).should.be.true;
101
+ const originalTests = [testFileName];
102
+ const originalDependencyTrees = {
103
+ [testFileName]: [
104
+ 'dep-1.js',
105
+ 'dep-2.js'
106
+ ]
107
+ };
108
+ const tests = structuredClone(originalTests);
109
+ const dependencyTrees = structuredClone(originalDependencyTrees);
110
+ tests.should.include.members([testFileName]);
111
+ dependencyTrees.should.include.keys([testFileName]);
112
+ await watchFilesAndRunTests(config, tests, dependencyTrees, [], customOut);
113
+ await fs.unlink(testFileName);
114
+ await new Promise(resolve => setTimeout(resolve, 1000));
115
+ tests.should.not.include.members([testFileName]);
116
+ dependencyTrees.should.not.include.keys([testFileName]);
117
+ });
118
+ });
119
+ //# sourceMappingURL=watchFilesAndRunTests.unitTest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchFilesAndRunTests.unitTest.js","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesAndRunTests.unitTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAC/C,OAAO,OAAO,MAAM,2BAA2B,CAAA;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAG9D,aAAa,CAAC,kCAAkC,EAAE;IAC9C,MAAM,UAAU,GAAG,kCAAkC,CAAA;IACrD,MAAM,UAAU,GAAG,mBAAmB,CAAC;QACnC,SAAS,EAAE,UAAU;QACrB,KAAK,EAAE,cAAc;QACrB,KAAK,EAAE;YACH,cAAc,EAAE,UAAU;YAC1B,UAAU,EAAE,SAAS;SACxB;KACJ,CAAC,CAAA;IAEF,OAAO,CAAC,+CAA+C,EAAE,KAAK;QAC1D,MAAM,MAAM,GA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CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,CAAA;IAC3D,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"watchFilesAndRunTestsChokidar.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesAndRunTestsChokidar.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAIpE,wBAAsB,6BAA6B,CAC/C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EAAE,EACnB,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,MAAM,EAAE,EACtB,SAAS,CAAC,EAAE,KAAK,GAClB,OAAO,CAAC,IAAI,CAAC,CA6Gf"}
1
+ {"version":3,"file":"watchFilesAndRunTestsChokidar.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesAndRunTestsChokidar.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAIpE,wBAAsB,6BAA6B,CAC/C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EAAE,EACnB,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,MAAM,EAAE,EACtB,SAAS,CAAC,EAAE,KAAK,GAClB,OAAO,CAAC,IAAI,CAAC,CAgHf"}
@@ -1,136 +1,108 @@
1
- import { createTimeProfiler } from 'sxy-dev-tools';
1
+ import { createTimeProfiler } from '../../packages/timeProfiler.js';
2
2
  import { showTimeProfiling } from '../../config.js';
3
- import chalk from 'chalk-extensions';
3
+ import chalk from '../../packages/chalk.js';
4
4
  import minimatch from 'minimatch';
5
- import slash from 'slash';
6
- import watch from 'node-watch';
7
- //import chokidar from 'chokidar'
8
- //import nsfw from 'nsfw'
9
- import fs from 'fs';
5
+ import slash from '../../packages/slash.js';
10
6
  import { out, log, debug } from '../../output.js';
11
7
  import { runTests } from './runTests.js';
12
8
  import { buildDependencyTree } from './buildDependencyTree.js';
13
9
  import { globArgCombine } from './globArgCombine.js';
14
- //import { load } from './load.js.depr/index.js'
15
-
16
- const {
17
- timeProfileAsync
18
- } = await createTimeProfiler(showTimeProfiling);
19
10
  import { watchFilesChokidar } from './watchFilesChokidar.js';
20
- export async function watchFilesAndRunTestsChokidar(config, testFiles, dependencyTrees, failingTests, customOut = undefined) {
21
- const projectDir = await process.cwd();
22
- await timeProfileAsync('start watching', async () => {
23
- let changedFiles = [];
24
- let timeout = null;
25
- const testFilter = file => minimatch(file, globArgCombine(config.tests)) && (!config.testsIgnore || !minimatch(file, globArgCombine(config.testsIgnore)));
26
-
27
- // start watching
28
- await watchFilesChokidar(config, watchEvent);
29
- async function watchEvent(filename, event) {
30
- await debug('chokidar watch event', filename, event);
31
- //filename = slash(filename)
32
-
33
- // remove dep tree for any tests that are deleted, avoiding trying to run it later
34
- if (event === 'remove' && filename in dependencyTrees) {
35
- await testFiles.remove(filename); // arrayRemove?
36
- delete dependencyTrees[filename];
37
- }
38
-
39
- // info on the event found
40
- await out(chalk.grey`change: ${filename} (${event})`);
41
-
42
- // add the file to changed files
43
- await changedFiles.push([filename, event]);
44
-
45
- // wait 100ms after any change before processing, to avoid multiple execution?
46
- if (timeout) {
47
- await clearTimeout(timeout);
48
- }
49
- timeout = await setTimeout(async () => {
50
- await timeProfileAsync('handle changed files', async () => {
51
- await debug('changed files', changedFiles);
52
- //out('changed files', changedFiles)
53
- try {
54
- // build related test list
55
- const tests = [];
56
- for (const [file, event] of changedFiles) {
57
- await debug('check', file);
58
- await debug('1 tests', tests);
59
- if (event !== 'remove') {
60
- // only check to see if its a test if it exists (has not just been removed)
61
- if (await testFilter(file)) {
62
- // it is a test file itself, add to run list
63
- await debug('its a test', file);
64
- await tests.push(file);
65
- if (!(file in dependencyTrees)) {
66
- // if its a new test
67
- await debug('try to add a new test', file), await addNewTest(file);
68
- }
69
- }
70
- }
71
- await debug('dtrees', dependencyTrees);
72
- await debug('2 tests', tests);
73
- for (const f of await Object.getOwnPropertyNames(dependencyTrees)) {
74
- await debug('dep tree', f, dependencyTrees[f]);
75
- if (await dependencyTrees[f].some(dep => {
76
- debug('checking dep', dep, file);
77
- return dep === file;
78
- })) {
79
- // a test depends on this file
80
- await debug('its a dependency', file);
81
- await debug('its a dependency', file);
82
- await tests.push(f);
83
- }
84
- }
11
+ import { remove as arrayRemove } from 'sxy-lib/arrays.js';
12
+ const { timeProfileAsync } = createTimeProfiler(showTimeProfiling);
13
+ export async function watchFilesAndRunTestsChokidar(config, testFiles, dependencyTrees, failingTests, customOut) {
14
+ const projectDir = process.cwd();
15
+ await timeProfileAsync('start watching', async () => {
16
+ let changedFiles = [];
17
+ let timeout = null;
18
+ const testFilter = (file) => {
19
+ return minimatch(file, globArgCombine(config.tests))
20
+ && !minimatch(file, globArgCombine(config.testsIgnore));
21
+ };
22
+ // start watching
23
+ await watchFilesChokidar(config, watchEvent);
24
+ function watchEvent(filename, event) {
25
+ debug('chokidar watch event', filename, event);
26
+ // remove dep tree for any tests that are deleted, avoiding trying to run it later
27
+ if (event === 'remove' && filename in dependencyTrees) {
28
+ arrayRemove(testFiles, filename);
29
+ delete dependencyTrees[filename];
85
30
  }
86
- changedFiles = [];
87
- await debug('tests', tests);
88
- await debug('3 tests', tests);
89
- if (tests.length) {
90
- await timeProfileAsync('run tests related to changes', async () => {
91
- await debug('tests', tests);
92
- if (config.reRunFailingTests) {
93
- for (const failingTest of failingTests) {
94
- if (!(await fs.existsSync(failingTest))) {
95
- //debug('remove failing test', failingTest)
96
- await failingTests.remove(failingTest); // arrayRemove?
97
- //(failingTests)
98
- }
99
- }
100
- }
101
- await debug('tests', tests);
102
- await debug('failingTests', failingTests);
103
- await debug('reRunFailingTests', config.watch.reRunFailingTests);
104
- const toTest = config.watch.reRunFailingTests ? await (await [...tests, ...failingTests].dedupeSlow()).reverse() // dedupe return new? // reverse in place
105
- : await [...tests].reverse(); // reverse in place
106
-
107
- const results = {
108
- total: 0,
109
- passed: 0
110
- };
111
- await debug('run tests on change');
112
- await debug('toTest', toTest);
113
-
114
- // clear load cache to allow accesing the new tets
115
- //load.cache.clear()
116
-
117
- const testResults = await runTests(config, toTest, failingTests, customOut);
118
- });
31
+ // info on the event found
32
+ out(chalk.grey `change: ${filename} (${event})`);
33
+ // add the file to changed files
34
+ changedFiles.push([filename, event]);
35
+ // wait 100ms after any change before processing, to avoid multiple execution?
36
+ if (timeout) {
37
+ clearTimeout(timeout);
119
38
  }
120
- } catch (e) {
121
- await log('watch handler error', e);
122
- } finally {
123
- //
124
- }
125
- });
126
- }, 33);
127
- } // end of watch event
128
-
129
- async function addNewTest(testFile) {
130
- await debug('new test', testFile);
131
- const dependencyTree = await buildDependencyTree(config, testFile);
132
- dependencyTrees[testFile] = await (await dependencyTree.map(async file => await (await slash(file)).slice(projectDir.length + 1))).filter(async f => f !== testFile);
133
- }
134
- });
135
- await out(chalk.brightblue`watching...`);
136
- }
39
+ timeout = setTimeout(() => {
40
+ void timeProfileAsync('handle changed files', async () => {
41
+ debug('changed files', changedFiles);
42
+ try {
43
+ // build related test list
44
+ const tests = [];
45
+ for (const [file, fileEvent] of changedFiles) {
46
+ debug('check', file);
47
+ debug('1 tests', tests);
48
+ if (fileEvent !== 'remove') { // only check if it's a test if it exists (has not just been removed)
49
+ if (testFilter(file)) { // it is a test file itself, add to run list
50
+ debug('its a test', file);
51
+ tests.push(file);
52
+ if (!(file in dependencyTrees)) { // if its a new test
53
+ debug('try to add a new test', file);
54
+ addNewTest(file);
55
+ }
56
+ }
57
+ }
58
+ debug('dtrees', dependencyTrees);
59
+ debug('2 tests', tests);
60
+ for (const f of Object.getOwnPropertyNames(dependencyTrees)) {
61
+ debug('dep tree', f, dependencyTrees[f]);
62
+ if (dependencyTrees[f]?.some(dep => dep === file) === true) { // a test depends on this file
63
+ debug('its a dependency', file);
64
+ tests.push(f);
65
+ }
66
+ }
67
+ }
68
+ changedFiles = [];
69
+ debug('tests', tests);
70
+ if (tests.length) {
71
+ await timeProfileAsync('run tests related to changes', async () => {
72
+ debug('tests', tests);
73
+ // NOTE: the original guarded a stale-failing-test cleanup here with
74
+ // `config.reRunFailingTests` (missing the `.watch.` prefix used everywhere
75
+ // else), which is always undefined - so it never ran. Preserved as dead
76
+ // code rather than newly activating it as part of a TS conversion.
77
+ debug('tests', tests);
78
+ debug('failingTests', failingTests);
79
+ debug('reRunFailingTests', config.watch.reRunFailingTests);
80
+ const toTest = config.watch.reRunFailingTests
81
+ ? [...new Set([...tests, ...failingTests])].reverse()
82
+ : [...tests].reverse();
83
+ debug('run tests on change');
84
+ debug('toTest', toTest);
85
+ await runTests(config, toTest, failingTests, customOut);
86
+ });
87
+ }
88
+ }
89
+ catch (e) {
90
+ log('watch handler error', e);
91
+ }
92
+ });
93
+ }, 33);
94
+ } // end of watch event
95
+ function addNewTest(testFile) {
96
+ debug('new test', testFile);
97
+ const dependencyTree = buildDependencyTree(config, testFile);
98
+ dependencyTrees[testFile] = dependencyTree
99
+ .map(file => slash(file).slice(projectDir.length + 1))
100
+ .filter(f => f !== testFile);
101
+ }
102
+ });
103
+ // NOTE: "watching..." is intentionally NOT printed here. watch() already emits it,
104
+ // tied to a real milestone (the initial test run finishing, or no tests found).
105
+ // Printing it again here produced a duplicate "watching..." on every startup.
106
+ // out(chalk.brightblue`watching...`)
107
+ }
108
+ //# sourceMappingURL=watchFilesAndRunTestsChokidar.js.map