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,440 +0,0 @@
1
- /*
2
- import { applyConfigDefaults } from './applyConfigDefaults.js'
3
- import { loadTestFile } from './loadTestFile.js'
4
- import { runTest } from './runTest.js'
5
- import { runDescribe } from './runDescribe.old.js'
6
-
7
-
8
- const defaultConfig = applyConfigDefaults({})
9
-
10
- const beforeAfterTestFile = 'unitTesting/runTest/beforeAfter.test.js'
11
- const beforeAfterTest = loadTestFile(defaultConfig, beforeAfterTestFile)
12
-
13
- mochaDescribe('runDescribeOld() function', function() {
14
-
15
- mochaIt('should run an it block that was loaded from a test file', function() {
16
-
17
- const config = applyConfigDefaults({})
18
-
19
- const sampleTestFile = 'unitTesting/runTest/1.test.js'
20
- const sampleTest = loadTestFile(defaultConfig, sampleTestFile)
21
- const sampleDescribe = sampleTest.describes[0]
22
- //console.log('sample describe', sampleDescribe)
23
- const describeResult = runDescribe(config, sampleDescribe)
24
- //console.log('describe result', describeResult)
25
-
26
-
27
- //console.log(testResult.describeResults[0].itResults)
28
- //console.log(testResult.describeResults[0].itResultsSummary)
29
-
30
- describeResult.should.include.keys([
31
- 'counter',
32
- 'thing',
33
- 'success',
34
- 'itResults',
35
- 'itResultsSummary',
36
- ])
37
-
38
- describeResult.success.should.equal(true)
39
-
40
- describeResult.itResultsSummary.total.should.equal(1)
41
- describeResult.itResultsSummary.passes.should.equal(1)
42
-
43
- })
44
-
45
-
46
- // mochaIt('should return sensible results from a test file without any describes', function() {
47
-
48
- // //const config = applyConfigDefaults({})
49
-
50
- // const sampleTestFile = 'unitTesting/sampletests/blank.test.js'
51
- // const sampleTest = loadTestFile(defaultConfig, sampleTestFile)
52
-
53
- // const testResult = runTest(defaultConfig, sampleTest)
54
-
55
- // //console.log(testResult)
56
- // //console.log(testResult.describeResults[0].itResults)
57
- // //console.log(testResult.describeResults[0].itResultsSummary)
58
-
59
- // testResult.should.include.keys([
60
- // 'file',
61
- // 'success',
62
- // 'describeResults',
63
- // 'describeResultsSummary'
64
- // ])
65
-
66
- // chaiExpect(testResult.success).to.be.null
67
-
68
- // //testResult.describeResultsSummary.total.should.equal(1)
69
- // //testResult.describeResultsSummary.passes.should.equal(1)
70
- // //testResult.describeResultsSummary.itsTotal.should.equal(1)
71
- // //testResult.describeResultsSummary.itsPasses.should.equal(1)
72
-
73
- // })
74
-
75
-
76
- // mochaIt('should return sensible results from a test file with describes without any its/tests', function() {
77
-
78
- // //const config = applyConfigDefaults({})
79
-
80
- // const sampleTestFile = 'unitTesting/sampletests/describesWithoutTests.test.js'
81
- // const sampleTest = loadTestFile(defaultConfig, sampleTestFile)
82
-
83
- // const testResult = runTest(defaultConfig, sampleTest)
84
-
85
- // //console.log(testResult)
86
- // //console.log(testResult.describeResults[0].itResults)
87
- // //console.log(testResult.describeResults[0].itResultsSummary)
88
-
89
- // testResult.should.include.keys([
90
- // 'file',
91
- // 'success',
92
- // 'describeResults',
93
- // 'describeResultsSummary'
94
- // ])
95
-
96
- // chaiExpect(testResult.success).to.be.null
97
-
98
- // testResult.describeResultsSummary.total.should.equal(0)
99
- // testResult.describeResultsSummary.passes.should.equal(0)
100
- // testResult.describeResultsSummary.invalid.should.equal(2)
101
- // testResult.describeResultsSummary.itsTotal.should.equal(0)
102
- // testResult.describeResultsSummary.itsPasses.should.equal(0)
103
-
104
- // })
105
-
106
-
107
-
108
- // mochaIt("should run beforeEachFile tasks (before - can't test)", function() {
109
-
110
- // let functionHasRun = false
111
- // global.beforeEachFileFileHasRun = false
112
-
113
- // const ourConfig = {
114
- // beforeEachFile: [
115
- // function() {
116
- // functionHasRun = true
117
- // },
118
- // 'unitTesting/runTest/beforeEachFile.js'
119
- // ]
120
- // }
121
-
122
- // const config = applyConfigDefaults(ourConfig)
123
-
124
- // runTest(config, beforeAfterTest)
125
-
126
- // functionHasRun.should.equal(true)
127
- // global.beforeEachFileFileHasRun.should.equal(true)
128
-
129
- // })
130
-
131
- // mochaIt("should run afterEachFile tasks (after - can't test)", function() {
132
-
133
- // let functionHasRun = false
134
- // global.afterEachFileFileHasRun = false
135
-
136
- // const ourConfig = {
137
- // afterEachFile: [
138
- // function() {
139
- // functionHasRun = true
140
- // },
141
- // 'unitTesting/runTest/afterEachFile.js'
142
- // ]
143
- // }
144
-
145
- // const config = applyConfigDefaults(ourConfig)
146
-
147
- // runTest(config, beforeAfterTest)
148
-
149
- // functionHasRun.should.equal(true)
150
- // global.afterEachFileFileHasRun.should.equal(true)
151
-
152
- // })
153
-
154
- // mochaIt("should run beforeEachDescribe tasks (before - can't test) each describe block", function() {
155
-
156
- // let functionHasRunTimes = 0
157
- // global.beforeEachDescribeFileHasRun = false
158
-
159
- // const ourConfig = {
160
- // beforeEachDescribe: [
161
- // function() {
162
- // functionHasRunTimes++
163
- // },
164
- // 'unitTesting/runTest/beforeEachDescribe.js'
165
- // ]
166
- // }
167
-
168
- // const config = applyConfigDefaults(ourConfig)
169
-
170
- // runTest(config, beforeAfterTest)
171
-
172
- // functionHasRunTimes.should.equal(2)
173
- // global.beforeEachDescribeFileHasRun.should.equal(true)
174
-
175
- // })
176
-
177
- // mochaIt("should run afterEachDescribe tasks (after - can't test) each describe block", function() {
178
-
179
- // let functionHasRunTimes = 0
180
- // global.afterEachDescribeFileHasRun = false
181
-
182
- // const ourConfig = {
183
- // afterEachDescribe: [
184
- // function() {
185
- // functionHasRunTimes++
186
- // },
187
- // 'unitTesting/runTest/afterEachDescribe.js'
188
- // ]
189
- // }
190
-
191
- // const config = applyConfigDefaults(ourConfig)
192
-
193
- // runTest(config, beforeAfterTest)
194
-
195
- // functionHasRunTimes.should.equal(2)
196
- // global.afterEachDescribeFileHasRun.should.equal(true)
197
-
198
- // })
199
-
200
- // mochaIt("should run beforeEachTest tasks (before - can't test) each test/it block", function() {
201
-
202
- // let functionHasRunTimes = 0
203
- // global.beforeEachTestbeforeEachFileFileHasRun = false
204
-
205
- // const ourConfig = {
206
- // beforeEachTest: [
207
- // function() {
208
- // functionHasRunTimes++
209
- // },
210
- // 'unitTesting/runTest/beforeEachTest.js'
211
- // ]
212
- // }
213
-
214
- // const config = applyConfigDefaults(ourConfig)
215
-
216
- // runTest(config, beforeAfterTest)
217
-
218
- // functionHasRunTimes.should.equal(3)
219
- // global.beforeEachTestFileHasRun.should.equal(true)
220
-
221
- // })
222
-
223
- // mochaIt("should run afterEachTest tasks (after - can't test) each test/it block", function() {
224
-
225
- // let functionHasRunTimes = 0
226
- // global.afterEachTestFileFileHasRun = false
227
-
228
- // const ourConfig = {
229
- // afterEachTest: [
230
- // function() {
231
- // functionHasRunTimes++
232
- // },
233
- // 'unitTesting/runTest/afterEachTest.js'
234
- // ]
235
- // }
236
-
237
- // const config = applyConfigDefaults(ourConfig)
238
-
239
- // runTest(config, beforeAfterTest)
240
-
241
- // functionHasRunTimes.should.equal(3)
242
- // global.afterEachTestFileHasRun.should.equal(true)
243
-
244
- // })
245
-
246
-
247
- // // exports provision to test file
248
-
249
- // // current beforeEachFile exports aren't provided
250
- // // perhaps extend sxy-loader to allow this
251
-
252
- // mochaIt("should pass exported/returned data from beforeEachDescribe tasks", function() {
253
-
254
- // const testFile = 'unitTesting/runTest/beforeEachDescribe.test.js'
255
- // const test = loadTestFile(defaultConfig, testFile)
256
-
257
- // const ourConfig = {
258
- // beforeEachDescribe: [
259
- // function() {
260
- // return { functionThing : 'foo' }
261
- // },
262
- // 'unitTesting/runTest/beforeEachDescribeExport.js'
263
- // ]
264
- // }
265
-
266
- // const config = applyConfigDefaults(ourConfig)
267
-
268
- // runTest(config, test)
269
-
270
- // global.functionThing.should.equal('foo')
271
- // global.fileThing.should.equal('bar')
272
-
273
- // })
274
-
275
- // mochaIt("should pass exported/returned data from beforeEachTest tasks", function() {
276
-
277
- // const testFile = 'unitTesting/runTest/beforeEachTest.test.js'
278
- // const test = loadTestFile(defaultConfig, testFile)
279
-
280
- // const ourConfig = {
281
- // beforeEachTest: [
282
- // function() {
283
- // return { functionThing : 'foo' }
284
- // },
285
- // 'unitTesting/runTest/beforeEachTestExport.js'
286
- // ]
287
- // }
288
-
289
- // const config = applyConfigDefaults(ourConfig)
290
-
291
- // runTest(config, test)
292
-
293
- // global.functionThing.should.equal('foo')
294
- // global.fileThing.should.equal('bar')
295
-
296
- // })
297
-
298
-
299
-
300
- // // exports pass through
301
-
302
- // mochaIt("beforeEachFile exports are passed through to afterEachFile", function() {
303
-
304
- // // don't try to reload test, fails due to module caching
305
- // //const testFile = 'unitTesting/runTest/beforeAfter.test.js'
306
- // //const test = loadTestFile(defaultConfig, testFile)
307
-
308
- // let exports
309
-
310
- // const ourConfig = {
311
- // beforeEachFile: [
312
- // function() {
313
- // return { functionThing : 'foo' }
314
- // },
315
- // 'unitTesting/runTest/beforeEachExport.js'
316
- // ],
317
- // afterEachFile: [
318
- // function(theExports) {
319
- // theExports.should.have.keys(['functionThing', 'fileThing'])
320
- // exports = theExports
321
- // },
322
- // ]
323
- // }
324
-
325
- // const config = applyConfigDefaults(ourConfig)
326
-
327
- // runTest(config, beforeAfterTest)
328
-
329
- // exports.functionThing.should.equal('foo')
330
- // exports.fileThing.should.equal('bar')
331
-
332
- // })
333
-
334
- // mochaIt("beforeEachDescribe exports are passed through to afterEachDescribe", function() {
335
-
336
- // // don't try to reload test, fails due to module caching
337
- // //const testFile = 'unitTesting/runTest/beforeAfter.test.js'
338
- // //const test = loadTestFile(defaultConfig, testFile)
339
-
340
- // let exports
341
-
342
- // const ourConfig = {
343
- // beforeEachDescribe: [
344
- // function() {
345
- // return { functionThing : 'foo' }
346
- // },
347
- // 'unitTesting/runTest/beforeEachExport.js'
348
- // ],
349
- // afterEachDescribe: [
350
- // function(theExports) {
351
- // exports = theExports
352
- // },
353
- // ]
354
- // }
355
-
356
- // const config = applyConfigDefaults(ourConfig)
357
-
358
- // runTest(config, beforeAfterTest)
359
-
360
- // //console.log('exports', exports)
361
-
362
- // exports.functionThing.should.equal('foo')
363
- // exports.fileThing.should.equal('bar')
364
-
365
-
366
- // })
367
-
368
- // mochaIt("beforeEachTest exports are passed through to afterEachTest", function() {
369
-
370
- // // don't try to reload test, fails due to module caching
371
- // //const testFile = 'unitTesting/runTest/beforeAfter.test.js'
372
- // //const test = loadTestFile(defaultConfig, testFile)
373
-
374
- // let exports
375
-
376
- // const ourConfig = {
377
- // beforeEachTest: [
378
- // function() {
379
- // return { functionThing : 'foo' }
380
- // },
381
- // 'unitTesting/runTest/beforeEachExport.js'
382
- // ],
383
- // afterEachTest: [
384
- // function(theExports) {
385
- // exports = theExports
386
- // },
387
- // ]
388
- // }
389
-
390
- // const config = applyConfigDefaults(ourConfig)
391
-
392
- // runTest(config, beforeAfterTest)
393
-
394
- // //console.log('exports', exports)
395
-
396
- // exports.functionThing.should.equal('foo')
397
- // exports.fileThing.should.equal('bar')
398
-
399
- // })
400
-
401
- // mochaIt("we can run code beforeEachTest and afterEachTest from within the test file", function() {
402
-
403
- // // don't try to reload test, fails due to module caching
404
- // const testFile = 'unitTesting/runTest/internalBeforeAfterEachTest.test.js'
405
- // const test = loadTestFile(defaultConfig, testFile)
406
-
407
- // const config = applyConfigDefaults({})
408
-
409
- // global.internalBeforeEachTestRanNTimes = 0
410
- // global.internalAfterEachTestRanNTimes = 0
411
- // runTest(config, test)
412
-
413
- // global.internalBeforeAfterEachTest_test1Valid.should.equal(true)
414
- // global.internalBeforeAfterEachTest_test2Valid.should.equal(true)
415
- // global.internalBeforeAfterEachTest_test3Valid.should.equal(true)
416
- // global.internalBeforeEachTestRanNTimes.should.equal(3)
417
- // global.internalAfterEachTestRanNTimes.should.equal(3)
418
-
419
- // })
420
-
421
- // mochaIt("we can run code afterDescribe from within descibe in the test file", function() {
422
-
423
- // // don't try to reload test, fails due to module caching
424
- // const testFile = 'unitTesting/runTest/internalAfterDescribeTest.test.js'
425
- // const test = loadTestFile(defaultConfig, testFile)
426
-
427
- // const config = applyConfigDefaults({})
428
-
429
- // global.internalAfterDescribeRanNTimes = 0
430
- // runTest(config, test)
431
-
432
- // //global.internalAfterDescribe_test1Valid.should.equal(true)
433
- // //global.internalAfterDescribe_test2Valid.should.equal(true)
434
- // global.internalAfterDescribeRanNTimes.should.equal(2)
435
-
436
- // })
437
-
438
-
439
- })
440
- */
@@ -1,160 +0,0 @@
1
-
2
- /*
3
- import { createTimeProfiler } from 'sxy-dev-tools'
4
- import chalk from 'chalk-extensions'
5
- import { out, log, debug } from '../../output.js'
6
- import { showTimeProfiling } from '../../config.js'
7
-
8
- import { runTasks } from './runTasks.js'
9
-
10
- const { timeProfileAsync } = createTimeProfiler(showTimeProfiling)
11
-
12
- export function runTest(config, test, customOut = undefined) {
13
-
14
- return timeProfileAsync(`run test ${test.file}`, () => {
15
-
16
- // run before test
17
- if (config.beforeEachFile) runTasks(config, config.beforeEachFile)
18
-
19
- // const beforeEachFileExports = (config.beforeEachFile)
20
- // ? runTasks(config, config.beforeEachFile)
21
- // : {}
22
-
23
- let describeCounter = 1
24
- const describeRunPromises = []
25
-
26
- for (const describe of test.describes) {
27
-
28
- describeRunPromises.push(
29
- promise( runDescribe(config, describe) )
30
- )
31
-
32
- }
33
-
34
- const describeResults = Promise.all(describeRunPromises)
35
-
36
- const describeResultsSummary = {
37
- total: 0,
38
- passes: 0,
39
- itsTotal: 0,
40
- itsPasses: 0,
41
- }
42
-
43
-
44
- for ( const describeResult of describeResults ) {
45
- describeResultsSummary.total += +(describeResult.success !== null)
46
- describeResultsSummary.passes += +describeResult.success
47
- describeResultsSummary.itsTotal += describeResult.itResultsSummary.total
48
- describeResultsSummary.itsPasses += describeResult.itResultsSummary.passes
49
- }
50
-
51
- const testResults = {
52
- file: test.file,
53
- success: (describeResultsSummary.total > 0)
54
- ? describeResultsSummary.total === describeResultsSummary.passes
55
- : null,
56
- describeResults,
57
- describeResultsSummary,
58
- }
59
-
60
- // run after test
61
- if (config.afterEachFile) runTasks(config, config.afterEachFile)
62
-
63
- return testResults
64
-
65
-
66
- function runDescribe(config, describe) {
67
-
68
- return timeProfileAsync(`run describe ${describe.thing}`, () => {
69
-
70
- // run before describe
71
- if (config.beforeEachDescribe) runTasks(config, config.beforeEachDescribe)
72
-
73
- // const beforeEachDescribeExports = (config.beforeEachDescribe)
74
- // ? runTasks(config, config.beforeEachDescribe)
75
- // : {}
76
-
77
- const thisDescribeCounter = describeCounter++ // assign THEN increment
78
- let itCounter = 1
79
- const itResults = []
80
-
81
- for ( const it of describe.its ) {
82
- itResults.push( runIt(config, it) )
83
- }
84
-
85
- const itResultsSummary = {
86
- total: 0,
87
- passes: 0,
88
- }
89
-
90
- for ( const itResult of itResults ) {
91
- itResultsSummary.total += +(itResult.success !== null)
92
- itResultsSummary.passes += +itResult.success
93
- }
94
-
95
- const describeResult = {
96
- counter: thisDescribeCounter,
97
- thing: describe.thing,
98
- success: (itResultsSummary.total > 0)
99
- ? itResultsSummary.passes === itResultsSummary.total
100
- : null,
101
- itResults,
102
- itResultsSummary
103
- }
104
-
105
- // run after describe
106
- if (config.afterEachDescribe) runTasks(config, config.afterEachDescribe)
107
-
108
- return describeResult
109
-
110
-
111
- function runIt(config, it, exports) {
112
-
113
- return timeProfileAsync(`run it ${it.should}`, () => {
114
-
115
- // run before test/it
116
- if (config.beforeEachTest) runTasks(config, config.beforeEachTest)
117
-
118
- const thisItCounter = itCounter++ // assign THEN increment
119
-
120
- //// run the it
121
- let success = null
122
- let error
123
- const startTime = (new Date).getTime()
124
- try {
125
- it.test()
126
- success = true
127
- } catch (e) {
128
- success = false
129
- error = e
130
- }
131
-
132
- const time = (new Date).getTime() - startTime
133
-
134
- const itResult = {
135
- counter: thisItCounter,
136
- should: it.should,
137
- success,
138
- time,
139
- error
140
- }
141
-
142
- // run after test/it
143
- if (config.afterEachTest) runTasks(config, config.afterEachTest)
144
-
145
- return itResult
146
- //testResults.push(testResult)
147
- //testsState.testResults.push(testResult)
148
-
149
- })
150
-
151
- }
152
-
153
- })
154
-
155
- }
156
-
157
- })
158
-
159
- }
160
- */