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,184 +0,0 @@
1
-
2
- /*
3
- import { applyConfigDefaults } from './applyConfigDefaults.js'
4
- import { loadTestFile } from './loadTestFile.js'
5
- import { runTest } from './runTest.js'
6
-
7
- // loadTestFile(config, testFile) ???
8
-
9
- const defaultConfig = applyConfigDefaults({})
10
-
11
- const beforeAfterTestFile = 'unitTesting/runTest/beforeAfter.test.js'
12
- const beforeAfterTest = loadTestFile(defaultConfig, beforeAfterTestFile)
13
-
14
- mochaDescribe('runTest() function', function() {
15
-
16
- mochaIt('should run a test that was previously loaded from a test file', function() {
17
-
18
- //const config = applyConfigDefaults({})
19
-
20
- const sampleTestFile = 'unitTesting/runTest/1.test.js'
21
- const sampleTest = loadTestFile(defaultConfig, sampleTestFile)
22
-
23
- const testResult = runTest(defaultConfig, sampleTest)
24
-
25
- //console.log(testResult)
26
- //console.log(testResult.describeResults[0].itResults)
27
- //console.log(testResult.describeResults[0].itResultsSummary)
28
-
29
- testResult.should.include.keys([
30
- 'file',
31
- 'success',
32
- 'describeResults',
33
- 'describeResultsSummary'
34
- ])
35
-
36
- testResult.success.should.equal(true)
37
-
38
- testResult.describeResultsSummary.total.should.equal(1)
39
- testResult.describeResultsSummary.passes.should.equal(1)
40
- testResult.describeResultsSummary.itsTotal.should.equal(1)
41
- testResult.describeResultsSummary.itsPasses.should.equal(1)
42
-
43
- })
44
-
45
- mochaIt("should run beforeEachFile tasks (before - can't test)", function() {
46
-
47
- let functionHasRun = false
48
- global.beforeEachFileFileHasRun = false
49
-
50
- const ourConfig = {
51
- beforeEachFile: [
52
- function() {
53
- functionHasRun = true
54
- },
55
- 'unitTesting/runTest/beforeEachFile.js'
56
- ]
57
- }
58
-
59
- const config = applyConfigDefaults(ourConfig)
60
-
61
- runTest(config, beforeAfterTest)
62
-
63
- functionHasRun.should.equal(true)
64
- global.beforeEachFileFileHasRun.should.equal(true)
65
-
66
- })
67
-
68
- mochaIt("should run afterEachFile tasks (after - can't test)", function() {
69
-
70
- let functionHasRun = false
71
- global.afterEachFileFileHasRun = false
72
-
73
- const ourConfig = {
74
- afterEachFile: [
75
- function() {
76
- functionHasRun = true
77
- },
78
- 'unitTesting/runTest/afterEachFile.js'
79
- ]
80
- }
81
-
82
- const config = applyConfigDefaults(ourConfig)
83
-
84
- runTest(config, beforeAfterTest)
85
-
86
- functionHasRun.should.equal(true)
87
- global.afterEachFileFileHasRun.should.equal(true)
88
-
89
- })
90
-
91
- mochaIt("should run beforeEachDescribe tasks (before - can't test) each describe block", function() {
92
-
93
- let functionHasRunTimes = 0
94
- global.beforeEachDescribeFileHasRun = false
95
-
96
- const ourConfig = {
97
- beforeEachDescribe: [
98
- function() {
99
- functionHasRunTimes++
100
- },
101
- 'unitTesting/runTest/beforeEachDescribe.js'
102
- ]
103
- }
104
-
105
- const config = applyConfigDefaults(ourConfig)
106
-
107
- runTest(config, beforeAfterTest)
108
-
109
- functionHasRunTimes.should.equal(2)
110
- global.beforeEachDescribeFileHasRun.should.equal(true)
111
-
112
- })
113
-
114
- mochaIt("should run afterEachDescribe tasks (after - can't test) each describe block", function() {
115
-
116
- let functionHasRunTimes = 0
117
- global.afterEachDescribeFileHasRun = false
118
-
119
- const ourConfig = {
120
- afterEachDescribe: [
121
- function() {
122
- functionHasRunTimes++
123
- },
124
- 'unitTesting/runTest/afterEachDescribe.js'
125
- ]
126
- }
127
-
128
- const config = applyConfigDefaults(ourConfig)
129
-
130
- runTest(config, beforeAfterTest)
131
-
132
- functionHasRunTimes.should.equal(2)
133
- global.afterEachDescribeFileHasRun.should.equal(true)
134
-
135
- })
136
-
137
- mochaIt("should run beforeEachTest tasks (before - can't test) each test/it block", function() {
138
-
139
- let functionHasRunTimes = 0
140
- global.beforeEachTestbeforeEachFileFileHasRun = false
141
-
142
- const ourConfig = {
143
- beforeEachTest: [
144
- function() {
145
- functionHasRunTimes++
146
- },
147
- 'unitTesting/runTest/beforeEachTest.js'
148
- ]
149
- }
150
-
151
- const config = applyConfigDefaults(ourConfig)
152
-
153
- runTest(config, beforeAfterTest)
154
-
155
- functionHasRunTimes.should.equal(3)
156
- global.beforeEachTestFileHasRun.should.equal(true)
157
-
158
- })
159
-
160
- mochaIt("should run afterEachTest tasks (after - can't test) each test/it block", function() {
161
-
162
- let functionHasRunTimes = 0
163
- global.afterEachTestFileFileHasRun = false
164
-
165
- const ourConfig = {
166
- afterEachTest: [
167
- function() {
168
- functionHasRunTimes++
169
- },
170
- 'unitTesting/runTest/afterEachTest.js'
171
- ]
172
- }
173
-
174
- const config = applyConfigDefaults(ourConfig)
175
-
176
- runTest(config, beforeAfterTest)
177
-
178
- functionHasRunTimes.should.equal(3)
179
- global.afterEachTestFileHasRun.should.equal(true)
180
-
181
- })
182
-
183
- })
184
- */
@@ -1,50 +0,0 @@
1
- import { promises as fs } from 'fs';
2
- import { watchFiles } from './watchFiles.js';
3
- import { applyConfigDefaults } from './applyConfigDefaults.js';
4
-
5
- // watchFiles(config, callback)
6
-
7
- await mochaDescribe('watchFiles() function', async function () {
8
- await mochaIt('should call back when when a file change occurs', async function () {
9
- await this.timeout(10000);
10
- const config = await applyConfigDefaults({});
11
- let eventComplete = false;
12
- await watchFiles(config, async (filename, event) => {
13
- eventComplete = true;
14
- });
15
- await fs.writeFile('watchTests/watchFiles-file.js', 'abc');
16
- await new Promise(async (resolve, reject) => {
17
- const interval = await setInterval(async () => {
18
- if (eventComplete) {
19
- await clearInterval(interval);
20
- await resolve();
21
- }
22
- }, 50);
23
- });
24
- await eventComplete.should.equal(true);
25
- });
26
- await mochaIt('should call back when when a file change occurs in specified folder', async function () {
27
- await this.timeout(10000);
28
- const tempFolder = 'watchTests/watchFiles';
29
- const config = await applyConfigDefaults({
30
- watch: {
31
- watchFilesBase: tempFolder,
32
- watchFiles: '**/*.js'
33
- }
34
- });
35
- let eventComplete = false;
36
- await watchFiles(config, async (filename, event) => {
37
- eventComplete = true;
38
- });
39
- await fs.writeFile(`${tempFolder}/a-file.js`, 'abc');
40
- await new Promise(async (resolve, reject) => {
41
- const interval = await setInterval(async () => {
42
- if (eventComplete) {
43
- await clearInterval(interval);
44
- await resolve();
45
- }
46
- }, 50);
47
- });
48
- await eventComplete.should.equal(true);
49
- });
50
- });
@@ -1,39 +0,0 @@
1
- /*
2
- import figures from 'figures'
3
-
4
- import { once } from './once.js'
5
-
6
- mochaDescribe('once command', function() {
7
-
8
- mochaIt('should run tests and output results', async function() {
9
- this.timeout(12000)
10
-
11
- const originalConsoleLog = console.log
12
- let consoleLogBuffer = ''
13
- console.log = sync(function testLog(...texts) {
14
- consoleLogBuffer += texts.join(' ') + '\n'
15
- })
16
-
17
- global.commandLineArguments = []
18
-
19
- promise( once() )
20
- await new Promise( (resolve, reject) => { setTimeout(resolve, 8000) } )
21
-
22
- console.log = originalConsoleLog
23
-
24
- console.log(consoleLogBuffer)
25
-
26
- const testFileName = `trialTests/example.test.js`
27
- const thing = 'The example'
28
- const should = '1 should equal 1'
29
-
30
- consoleLogBuffer.should.include( testFileName )
31
- consoleLogBuffer.should.include( thing )
32
- consoleLogBuffer.should.include( should )
33
- consoleLogBuffer.should.include( figures.tick )
34
-
35
- })
36
-
37
- })
38
-
39
- */
@@ -1,271 +0,0 @@
1
- import chalk from 'chalk-extensions';
2
- import { out, log, debug } from './output.js';
3
- import { showTimeProfiling } from './config.js';
4
- import { createTimeProfiler } from 'sxy-dev-tools';
5
-
6
- //console.log('sxyDevTools', sxyDevTools)
7
- //console.log('createTimeProfiler', createTimeProfiler)
8
-
9
- const {
10
- timeProfile,
11
- timeProfileAsync
12
- } = await createTimeProfiler(showTimeProfiling);
13
-
14
- //console.log('chalk', chalk)
15
-
16
- import { runTasks } from './cli/lib/runTasks.js';
17
- export async function describe(theThing, tests) {
18
- const config = global.__sxy_test_runner__.config;
19
-
20
- // if config.beforeEachDescribe
21
- // const beforeEachDescribeExports = runTasks(config, config.beforeEachDescribe)
22
-
23
- const thisDescribeCounter = global.testState.describeCounter++; // ++: assign the value, THEN increment
24
-
25
- let itCounter = 1;
26
- const its = [];
27
-
28
- // create functions to pass back
29
-
30
- // it
31
- async function it(should, test) {
32
- // if config.beforeEachTest
33
- // const beforeEachTestExports = runTasks(config, config.beforeEachTest)
34
-
35
- const thisItCounter = itCounter++;
36
- await its.push({
37
- counter: thisItCounter,
38
- should,
39
- test
40
- //beforeEachTestExports
41
- });
42
-
43
- // if config.afterEachTest
44
- // runTasks(config, config.afterEachTest)
45
- }
46
-
47
- // before
48
- let beforeFunc;
49
- async function before(func) {
50
- beforeFunc = func;
51
- }
52
-
53
- // after
54
- let afterFunc;
55
- async function after(func) {
56
- afterFunc = func;
57
- }
58
- const provides = {
59
- it,
60
- before,
61
- after
62
- };
63
-
64
- // addExports(provides, beforeEachDescribeExports)
65
-
66
- // run the callback, to set the its
67
- await tests({
68
- it,
69
- before,
70
- after
71
- });
72
- //tests(provides)
73
-
74
- const describe = {
75
- counter: thisDescribeCounter,
76
- thing: theThing,
77
- its
78
- //beforeEachDescribeExports
79
- };
80
- await global.testState.describes.push(describe);
81
-
82
- // if config.afterEachDescribe
83
- // runTasks(config, config.afterEachDescribe)
84
-
85
- await debug(chalk.lightgrey`${thisDescribeCounter})` + chalk.lightgrey` Done with ` + chalk.brightblue`${theThing}\n`);
86
- }
87
-
88
- /*
89
-
90
-
91
- export async function describe(theThing, tests, testFilename) {
92
-
93
- const timeProfiling = {}
94
- timeProfiling.beforeDescribe = (new Date).getTime()
95
-
96
- //log('tests state 1', testsState)
97
-
98
- const thisDescribeCounter = testsState.describeCounter++ // ++: assign the value, THEN increment
99
-
100
- //log('tests state 1.5', testsState)
101
-
102
- let testCounter = 1
103
- let testResults = []
104
-
105
- const its = []
106
- async function it(should, test) {
107
- its.push([should, test])
108
- }
109
-
110
-
111
- // async function it(should, test) {
112
-
113
- // const timeProfiling = {}
114
- // timeProfiling.beforeIt = (new Date).getTime()
115
-
116
-
117
- // const thisTestCounter = testCounter++ // ++: assign the value, THEN increment
118
- // let success = null
119
- // let error
120
- // try {
121
- // await test()
122
- // if (success === null) success = true
123
- // } catch (e) {
124
- // success = false
125
- // //console.log(e)
126
- // error = e
127
- // }
128
-
129
- // const testResult = {
130
- // counter: thisTestCounter,
131
- // should,
132
- // success,
133
- // error
134
- // }
135
-
136
- // testResults.push(testResult)
137
- // testsState.testResults.push(testResult)
138
-
139
-
140
- // timeProfiling.afterIt = (new Date).getTime()
141
- // timeProfilingOut(`it ${should}`, timeProfiling.beforeIt, timeProfiling.afterIt)
142
-
143
- // }
144
-
145
- let beforeFunc
146
- async function before(func) {
147
- beforeFunc = func
148
- }
149
-
150
- let afterFunc
151
- async function after(func) {
152
- afterFunc = func
153
- }
154
-
155
- tests({it, before, after})
156
-
157
- //log('tests state2', testsState)
158
-
159
- testsState.theseDescribes.push({theThing, its, counter: thisDescribeCounter})
160
-
161
- await run('do the tests', async () => {
162
- for (const it of its) {
163
- await testIt(...it)
164
- }
165
- })
166
-
167
- async function testIt(should, test) {
168
-
169
- await timeProfileAsync(`it ${should}`, async () => {
170
-
171
- const timeStart = (new Date).getTime()
172
-
173
- const thisTestCounter = testCounter++ // ++: assign the value, THEN increment
174
- let success = null
175
- let error
176
- try {
177
- await test()
178
- if (success === null) success = true
179
- } catch (e) {
180
- success = false
181
- error = e
182
- }
183
-
184
- const timeEnd = (new Date).getTime()
185
- const time = timeEnd - timeStart
186
-
187
- const testResult = {
188
- counter: thisTestCounter,
189
- should,
190
- success,
191
- time,
192
- error
193
- }
194
-
195
- testResults.push(testResult)
196
- testsState.testResults.push(testResult)
197
-
198
- // out(`${time.localeString()}ms`)
199
- })
200
-
201
- }
202
-
203
- //console.log('testResults A', testResults)
204
- testResults = testResults.sort( (a, b) => a.counter - b.counter )
205
- //console.log('testResults B', testResults)
206
-
207
- out(
208
- chalk.lightgrey`${thisDescribeCounter})`
209
- + chalk.lightgrey` Describing` + chalk.brightblue` ${theThing}\n`
210
- )
211
-
212
- let describeSuccess = null
213
- const describeErrors = []
214
-
215
- for (const testResult of testResults) {
216
- const indexLetters = indexNumberToLetters(testResult.counter)
217
- if (testResult.success) {
218
- if (describeSuccess === null) describeSuccess = true
219
- out(
220
- chalk.lightgrey` ${indexLetters})`
221
- + chalk.mediumgreen(` ${figures.tick} ${testResult.should}`)
222
- )
223
- } else {
224
- describeSuccess = false
225
- describeErrors.push(testResult.error)
226
- out(
227
- chalk.lightgrey` ${indexLetters})`
228
- + chalk.mediumred` ${figures.cross} ${testResult.should}\n`
229
- + chalk.mediumred` ${testResult.error}`
230
- )
231
- // out(
232
- // chalk.lightgrey` ${indexLetters})`
233
- // + chalk.brightred` ${figures.cross} ${testResult.should}\n`
234
- // + chalk.brightred` ${testResult.errors}`
235
- // )
236
- }
237
- }
238
-
239
- const describeResult = {
240
- counter: thisDescribeCounter,
241
- theThing,
242
- success: describeSuccess,
243
- errors: describeErrors
244
- }
245
-
246
- testsState.describeResults.push(describeResult)
247
-
248
- out(``)
249
-
250
- timeProfiling.afterDescribe = (new Date).getTime()
251
- timeProfilingOut(`describe ${theThing}`, timeProfiling.beforeDescribe, timeProfiling.afterDescribe)
252
-
253
-
254
- global.endTest[testFilename] = (new Date).getTime()
255
- timeProfilingOutSpecial(`full test ${testFilename}`, global.startTest[testFilename], global.endTest[testFilename])
256
-
257
- }
258
-
259
- // export async function it(should, test) {
260
- // out(chalk`theThing`)
261
- // await test()
262
- // }
263
-
264
- //export const test = it
265
-
266
-
267
- function run(name, func) {
268
- return func()
269
- }
270
-
271
- */
@@ -1,30 +0,0 @@
1
- import { describe } from './describe-old.js';
2
- await mochaDescribe('watch command', async function () {
3
-
4
- // mochaIt('should run tests and output results', async function() {
5
- // this.timeout(6000)
6
-
7
- // const originalConsoleLog = console.log
8
- // let consoleLogBuffer = ''
9
- // console.log = sync(function testLog(...texts) {
10
- // consoleLogBuffer += texts.join(' ') + '\n'
11
- // })
12
-
13
- // global.commandLineArguments = []
14
-
15
- // promise( watch() )
16
- // await new Promise( (resolve, reject) => { setTimeout(resolve, 3000) } )
17
-
18
- // console.log = originalConsoleLog
19
-
20
- // const testFileName = `dist/testing/example.test.js`
21
- // const thing = 'The example'
22
- // const should = '1 should equal 1'
23
-
24
- // consoleLogBuffer.should.include( testFileName )
25
- // consoleLogBuffer.should.include( thing )
26
- // consoleLogBuffer.should.include( should )
27
- // consoleLogBuffer.should.include( figures.tick )
28
-
29
- // })
30
- });
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- "globals": {
3
- "describe": "readonly",
4
- "test": "readonly",
5
- "it": "readonly"
6
- }
7
- };
@@ -1,2 +0,0 @@
1
- export declare function arrayRemove<T>(array: T[], ...removeValues: T[]): void;
2
- //# sourceMappingURL=arrayRemove.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arrayRemove.d.ts","sourceRoot":"","sources":["../../src/lib/arrayRemove.ts"],"names":[],"mappings":"AACA,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,GAAG,YAAY,EAAE,CAAC,EAAE,GAAG,IAAI,CAYrE"}
@@ -1,15 +0,0 @@
1
- // Replaces the sxy-standard Array.prototype.remove() patch this codebase relied on.
2
- export function arrayRemove(array, ...removeValues) {
3
- for (const removeValue of removeValues) {
4
- let i = 0;
5
- let length = array.length;
6
- for (; i < length; i++) {
7
- if (array[i] === removeValue) {
8
- array.splice(i, 1);
9
- i--;
10
- length--;
11
- }
12
- }
13
- }
14
- }
15
- //# sourceMappingURL=arrayRemove.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arrayRemove.js","sourceRoot":"","sources":["../../src/lib/arrayRemove.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,MAAM,UAAU,WAAW,CAAI,KAAU,EAAE,GAAG,YAAiB;IAC3D,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACrC,IAAI,CAAC,GAAG,CAAC,CAAA;QACT,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM,CAAA;QACzB,OAAO,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACrB,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,WAAW,EAAE,CAAC;gBAC3B,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;gBAClB,CAAC,EAAE,CAAA;gBACH,MAAM,EAAE,CAAA;YACZ,CAAC;QACL,CAAC;IACL,CAAC;AACL,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function promiseAllObj<T>(promisesMap: Record<string, Promise<T>>): Promise<Record<string, T>>;
2
- //# sourceMappingURL=promiseAllObj.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promiseAllObj.d.ts","sourceRoot":"","sources":["../../src/lib/promiseAllObj.ts"],"names":[],"mappings":"AACA,wBAAsB,aAAa,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAU1G"}
@@ -1,14 +0,0 @@
1
- // Replaces the sxy-standard Promise.allObj() patch this codebase relied on.
2
- export async function promiseAllObj(promisesMap) {
3
- const results = {};
4
- const promisesArr = [];
5
- for (const key in promisesMap) {
6
- const promise = promisesMap[key];
7
- if (promise === undefined)
8
- continue;
9
- promisesArr.push(promise.then(result => { results[key] = result; }));
10
- }
11
- await Promise.all(promisesArr);
12
- return results;
13
- }
14
- //# sourceMappingURL=promiseAllObj.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promiseAllObj.js","sourceRoot":"","sources":["../../src/lib/promiseAllObj.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,CAAC,KAAK,UAAU,aAAa,CAAI,WAAuC;IAC1E,MAAM,OAAO,GAAsB,EAAE,CAAA;IACrC,MAAM,WAAW,GAA4B,EAAE,CAAA;IAC/C,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;QAChC,IAAI,OAAO,KAAK,SAAS;YAAE,SAAQ;QACnC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAA,CAAC,CAAC,CAAC,CAAC,CAAA;IACvE,CAAC;IACD,MAAM,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;IAC9B,OAAO,OAAO,CAAA;AAClB,CAAC"}
@@ -1,5 +0,0 @@
1
- export const testsState = {
2
- //describeCounter: 1,
3
- //describeResults: [],
4
- //testResults: []
5
- };
@@ -1,9 +0,0 @@
1
- import chalk from 'chalk-extensions';
2
- import { packageName, cliName, showTimeProfiling } from './config.js';
3
- import { out } from './output.js';
4
- export const timeProfilingOut = showTimeProfiling ? async function timeProfilingOut(name, start, finish) {
5
- await out(await chalk.yellow(`[${packageName}] {${name}} time ${finish - start}ms`));
6
- } : async function () {};
7
- export const timeProfilingOutSpecial = showTimeProfiling ? async function timeProfilingOutSpecial(name, start, finish) {
8
- await out(await chalk.orange(`[${packageName}] {${name}} time ${finish - start}ms`));
9
- } : async function () {};