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.
- package/dist/cli/index.js +24 -22
- package/dist/cli/init.js +41 -91
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/lib/addBasePath.d.ts.map +1 -1
- package/dist/cli/lib/addBasePath.js +12 -14
- package/dist/cli/lib/addBasePath.js.map +1 -1
- package/dist/cli/lib/addBasePath.unitTest.d.ts +2 -0
- package/dist/cli/lib/addBasePath.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/addBasePath.unitTest.js +51 -29
- package/dist/cli/lib/addBasePath.unitTest.js.map +1 -0
- package/dist/cli/lib/addExports.js +13 -11
- package/dist/cli/lib/addExports.unitTest.d.ts +2 -0
- package/dist/cli/lib/addExports.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/addExports.unitTest.js +15 -30
- package/dist/cli/lib/addExports.unitTest.js.map +1 -0
- package/dist/cli/lib/applyConfigDefaults.js +6 -42
- package/dist/cli/lib/applyConfigDefaults.js.map +1 -1
- package/dist/cli/lib/applyConfigDefaults.unitTest.d.ts +2 -0
- package/dist/cli/lib/applyConfigDefaults.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/applyConfigDefaults.unitTest.js +19 -27
- package/dist/cli/lib/applyConfigDefaults.unitTest.js.map +1 -0
- package/dist/cli/lib/buildDependencyTree.js +23 -34
- package/dist/cli/lib/buildDependencyTree.js.map +1 -1
- package/dist/cli/lib/buildDependencyTree.unitTest.d.ts +2 -0
- package/dist/cli/lib/buildDependencyTree.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/buildDependencyTree.unitTest.js +13 -11
- package/dist/cli/lib/buildDependencyTree.unitTest.js.map +1 -0
- package/dist/cli/lib/buildDependencyTrees.js +15 -34
- package/dist/cli/lib/buildDependencyTrees.js.map +1 -1
- package/dist/cli/lib/buildDependencyTrees.unitTest.d.ts +2 -0
- package/dist/cli/lib/buildDependencyTrees.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/buildDependencyTrees.unitTest.js +18 -14
- package/dist/cli/lib/buildDependencyTrees.unitTest.js.map +1 -0
- package/dist/cli/lib/defaultConfig.js +23 -21
- package/dist/cli/lib/defaultConfig.unitTest.d.ts +2 -0
- package/dist/cli/lib/defaultConfig.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/defaultConfig.unitTest.js +7 -0
- package/dist/cli/lib/defaultConfig.unitTest.js.map +1 -0
- package/dist/cli/lib/doUserSetup.d.ts +1 -1
- package/dist/cli/lib/doUserSetup.d.ts.map +1 -1
- package/dist/cli/lib/doUserSetup.js +20 -23
- package/dist/cli/lib/doUserSetup.js.map +1 -1
- package/dist/cli/lib/doUserSetup.unitTest.d.ts +7 -0
- package/dist/cli/lib/doUserSetup.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/doUserSetup.unitTest.js +41 -36
- package/dist/cli/lib/doUserSetup.unitTest.js.map +1 -0
- package/dist/cli/lib/doUserTeardown.d.ts +1 -1
- package/dist/cli/lib/doUserTeardown.d.ts.map +1 -1
- package/dist/cli/lib/doUserTeardown.js +21 -23
- package/dist/cli/lib/doUserTeardown.js.map +1 -1
- package/dist/cli/lib/doUserTeardown.unitTest.d.ts +7 -0
- package/dist/cli/lib/doUserTeardown.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/doUserTeardown.unitTest.js +41 -36
- package/dist/cli/lib/doUserTeardown.unitTest.js.map +1 -0
- package/dist/cli/lib/findTestFiles.d.ts.map +1 -1
- package/dist/cli/lib/findTestFiles.js +16 -24
- package/dist/cli/lib/findTestFiles.js.map +1 -1
- package/dist/cli/lib/findTestFiles.unitTest.d.ts +2 -0
- package/dist/cli/lib/findTestFiles.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/findTestFiles.unitTest.js +19 -19
- package/dist/cli/lib/findTestFiles.unitTest.js.map +1 -0
- package/dist/cli/lib/getAllowedFlags.js +10 -8
- package/dist/cli/lib/getAllowedFlags.unitTest.d.ts +2 -0
- package/dist/cli/lib/getAllowedFlags.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/getAllowedFlags.unitTest.js +22 -21
- package/dist/cli/lib/getAllowedFlags.unitTest.js.map +1 -0
- package/dist/cli/lib/globArgCombine.js +8 -1
- package/dist/cli/lib/globArgCombine.unitTest.d.ts +2 -0
- package/dist/cli/lib/globArgCombine.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/globArgCombine.unitTest.js +19 -18
- package/dist/cli/lib/globArgCombine.unitTest.js.map +1 -0
- package/dist/cli/lib/injectProperties.d.ts.map +1 -1
- package/dist/cli/lib/injectProperties.js +10 -10
- package/dist/cli/lib/injectProperties.js.map +1 -1
- package/dist/cli/lib/injectProperties.unitTest.d.ts +2 -0
- package/dist/cli/lib/injectProperties.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/injectProperties.unitTest.js +19 -81
- package/dist/cli/lib/injectProperties.unitTest.js.map +1 -0
- package/dist/cli/lib/loadConfig.js +14 -18
- package/dist/cli/lib/loadConfig.js.map +1 -1
- package/dist/cli/lib/loadConfig.unitTest.d.ts +2 -0
- package/dist/cli/lib/loadConfig.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/loadConfig.unitTest.js +15 -15
- package/dist/cli/lib/loadConfig.unitTest.js.map +1 -0
- package/dist/cli/lib/loadTestFile.js +48 -78
- package/dist/cli/lib/loadTestFile.js.map +1 -1
- package/dist/cli/lib/loadTestFile.unitTest.d.ts +2 -0
- package/dist/cli/lib/loadTestFile.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/loadTestFile.unitTest.js +12 -49
- package/dist/cli/lib/loadTestFile.unitTest.js.map +1 -0
- package/dist/cli/lib/parseCommandLineArguments.js +48 -42
- package/dist/cli/lib/parseCommandLineArguments.unitTest.d.ts +2 -0
- package/dist/cli/lib/parseCommandLineArguments.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/parseCommandLineArguments.unitTest.js +22 -24
- package/dist/cli/lib/parseCommandLineArguments.unitTest.js.map +1 -0
- package/dist/cli/lib/parseDescribe.d.ts.map +1 -1
- package/dist/cli/lib/parseDescribe.js +67 -81
- package/dist/cli/lib/parseDescribe.js.map +1 -1
- package/dist/cli/lib/parseDescribe.unitTest.d.ts +2 -0
- package/dist/cli/lib/parseDescribe.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/parseDescribe.unitTest.js +20 -18
- package/dist/cli/lib/parseDescribe.unitTest.js.map +1 -0
- package/dist/cli/lib/reservedExportKeys.d.ts +2 -0
- package/dist/cli/lib/reservedExportKeys.d.ts.map +1 -0
- package/dist/cli/lib/reservedExportKeys.js +12 -1
- package/dist/cli/lib/reservedExportKeys.js.map +1 -0
- package/dist/cli/lib/reservedExportKeys.unitTest.d.ts +2 -0
- package/dist/cli/lib/reservedExportKeys.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/reservedExportKeys.unitTest.js +6 -8
- package/dist/cli/lib/reservedExportKeys.unitTest.js.map +1 -0
- package/dist/cli/lib/runDescribe.d.ts.map +1 -1
- package/dist/cli/lib/runDescribe.js +39 -39
- package/dist/cli/lib/runDescribe.js.map +1 -1
- package/dist/cli/lib/runDescribe.unitTest.d.ts +2 -0
- package/dist/cli/lib/runDescribe.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/runDescribe.unitTest.js +22 -402
- package/dist/cli/lib/runDescribe.unitTest.js.map +1 -0
- package/dist/cli/lib/runDescribeRun.js +34 -49
- package/dist/cli/lib/runDescribeRun.js.map +1 -1
- package/dist/cli/lib/runDescribeRun.unitTest.d.ts +2 -0
- package/dist/cli/lib/runDescribeRun.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/runDescribeRun.unitTest.js +44 -410
- package/dist/cli/lib/runDescribeRun.unitTest.js.map +1 -0
- package/dist/cli/lib/runIt.d.ts +1 -1
- package/dist/cli/lib/runIt.d.ts.map +1 -1
- package/dist/cli/lib/runIt.js +59 -69
- package/dist/cli/lib/runIt.js.map +1 -1
- package/dist/cli/lib/runIt.unitTest.d.ts +2 -0
- package/dist/cli/lib/runIt.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/runIt.unitTest.js +73 -410
- package/dist/cli/lib/runIt.unitTest.js.map +1 -0
- package/dist/cli/lib/runTasks.d.ts +1 -1
- package/dist/cli/lib/runTasks.d.ts.map +1 -1
- package/dist/cli/lib/runTasks.js +28 -31
- package/dist/cli/lib/runTasks.js.map +1 -1
- package/dist/cli/lib/runTasks.unitTest.d.ts +5 -0
- package/dist/cli/lib/runTasks.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/runTasks.unitTest.js +35 -31
- package/dist/cli/lib/runTasks.unitTest.js.map +1 -0
- package/dist/cli/lib/runTest.js +54 -66
- package/dist/cli/lib/runTest.js.map +1 -1
- package/dist/cli/lib/runTest.unitTest.d.ts +20 -0
- package/dist/cli/lib/runTest.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/runTest.unitTest.js +274 -289
- package/dist/cli/lib/runTest.unitTest.js.map +1 -0
- package/dist/cli/lib/runTests.d.ts.map +1 -1
- package/dist/cli/lib/runTests.js +123 -141
- package/dist/cli/lib/runTests.js.map +1 -1
- package/dist/cli/lib/runTests.unitTest.d.ts +6 -0
- package/dist/cli/lib/runTests.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/runTests.unitTest.js +48 -61
- package/dist/cli/lib/runTests.unitTest.js.map +1 -0
- package/dist/cli/lib/showTestLoadingError.js +22 -33
- package/dist/cli/lib/showTestLoadingError.js.map +1 -1
- package/dist/cli/lib/showTestLoadingError.unitTest.d.ts +2 -0
- package/dist/cli/lib/showTestLoadingError.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/showTestLoadingError.unitTest.js +16 -24
- package/dist/cli/lib/showTestLoadingError.unitTest.js.map +1 -0
- package/dist/cli/lib/showTestResult.js +88 -88
- package/dist/cli/lib/showTestResult.js.map +1 -1
- package/dist/cli/lib/showTestResult.unitTest.d.ts +2 -0
- package/dist/cli/lib/showTestResult.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/showTestResult.unitTest.js +176 -184
- package/dist/cli/lib/showTestResult.unitTest.js.map +1 -0
- package/dist/cli/lib/testHelpers/makeCustomOut.d.ts +7 -0
- package/dist/cli/lib/testHelpers/makeCustomOut.d.ts.map +1 -0
- package/dist/cli/lib/testHelpers/makeCustomOut.js +10 -0
- package/dist/cli/lib/testHelpers/makeCustomOut.js.map +1 -0
- package/dist/cli/lib/timeProfier.js +4 -6
- package/dist/cli/lib/timeProfier.js.map +1 -1
- package/dist/cli/lib/validateConfig.js +21 -24
- package/dist/cli/lib/validateConfig.unitTest.d.ts +2 -0
- package/dist/cli/lib/validateConfig.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/validateConfig.unitTest.js +17 -18
- package/dist/cli/lib/validateConfig.unitTest.js.map +1 -0
- package/dist/cli/lib/{watchFiles.js → watchFiles.d.ts} +2 -1
- package/dist/cli/lib/watchFiles.d.ts.map +1 -0
- package/dist/cli/lib/watchFiles.js.map +1 -0
- package/dist/cli/lib/watchFiles.unitTest.d.ts +2 -0
- package/dist/cli/lib/watchFiles.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/watchFiles.unitTest.js.map +1 -0
- package/dist/cli/lib/watchFilesAndRunTests.js +2 -3
- package/dist/cli/lib/watchFilesAndRunTests.unitTest.d.ts +2 -0
- package/dist/cli/lib/watchFilesAndRunTests.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/watchFilesAndRunTests.unitTest.js +86 -96
- package/dist/cli/lib/watchFilesAndRunTests.unitTest.js.map +1 -0
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.d.ts.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.js +99 -127
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.js.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.unitTest.d.ts +2 -0
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.unitTest.js +90 -99
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.unitTest.js.map +1 -0
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.d.ts.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.js +108 -148
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.js.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.unitTest.d.ts +2 -0
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.unitTest.js +87 -100
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.unitTest.js.map +1 -0
- package/dist/cli/lib/watchFilesChokidar.js +30 -56
- package/dist/cli/lib/watchFilesChokidar.js.map +1 -1
- package/dist/cli/lib/watchFilesChokidar.unitTest.d.ts +2 -0
- package/dist/cli/lib/watchFilesChokidar.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/watchFilesChokidar.unitTest.js +77 -81
- package/dist/cli/lib/watchFilesChokidar.unitTest.js.map +1 -0
- package/dist/cli/lib/watchFilesNodeWatch.js +31 -41
- package/dist/cli/lib/watchFilesNodeWatch.js.map +1 -1
- package/dist/cli/lib/watchFilesNodeWatch.unitTest.d.ts +2 -0
- package/dist/cli/lib/watchFilesNodeWatch.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/watchFilesNodeWatch.unitTest.js +41 -46
- package/dist/cli/lib/watchFilesNodeWatch.unitTest.js.map +1 -0
- package/dist/cli/once.js +35 -42
- package/dist/cli/once.js.map +1 -1
- package/dist/cli/watch.js +64 -114
- package/dist/cli/watch.js.map +1 -1
- package/dist/cli/watch.unitTest.d.ts +6 -0
- package/dist/cli/watch.unitTest.d.ts.map +1 -0
- package/dist/cli/watch.unitTest.js +100 -111
- package/dist/cli/watch.unitTest.js.map +1 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +13 -2
- package/dist/config.js.map +1 -1
- package/dist/describe.js +20 -34
- package/dist/describe.js.map +1 -1
- package/dist/describe.unitTest.d.ts +2 -0
- package/dist/describe.unitTest.d.ts.map +1 -0
- package/dist/describe.unitTest.js +19 -23
- package/dist/describe.unitTest.js.map +1 -0
- package/dist/index.js +2 -1
- package/dist/indexNumberToLetters.js +12 -11
- package/dist/output.js +16 -18
- package/dist/packages/chalk.d.ts +14 -0
- package/dist/packages/chalk.d.ts.map +1 -0
- package/dist/packages/chalk.js +22 -0
- package/dist/packages/chalk.js.map +1 -0
- package/dist/packages/figures.d.ts +6 -0
- package/dist/packages/figures.d.ts.map +1 -0
- package/dist/packages/figures.js +24 -0
- package/dist/packages/figures.js.map +1 -0
- package/dist/packages/loadConfig.d.ts +3 -0
- package/dist/packages/loadConfig.d.ts.map +1 -0
- package/dist/packages/loadConfig.js +28 -0
- package/dist/packages/loadConfig.js.map +1 -0
- package/dist/packages/mergeStructuredConfig.d.ts +2 -0
- package/dist/packages/mergeStructuredConfig.d.ts.map +1 -0
- package/dist/packages/mergeStructuredConfig.js +26 -0
- package/dist/packages/mergeStructuredConfig.js.map +1 -0
- package/dist/packages/slash.d.ts +2 -0
- package/dist/packages/slash.d.ts.map +1 -0
- package/dist/packages/slash.js +9 -0
- package/dist/packages/slash.js.map +1 -0
- package/dist/packages/timeProfiler.d.ts +6 -0
- package/dist/packages/timeProfiler.d.ts.map +1 -0
- package/dist/packages/timeProfiler.js +32 -0
- package/dist/packages/timeProfiler.js.map +1 -0
- package/dist/types.d.ts +13 -13
- package/dist/types.d.ts.map +1 -1
- package/package.json +24 -20
- package/dist/cli/files.js +0 -20
- package/dist/cli/files.unitTest.js +0 -246
- package/dist/cli/init.unitTest.js +0 -0
- package/dist/cli/lib/defaultConfig.test.js +0 -9
- package/dist/cli/lib/loadTestFileStatic.js +0 -41
- package/dist/cli/lib/loadTestFileStatic.unitTest.js +0 -30
- package/dist/cli/lib/processWatchEvent.js +0 -1
- package/dist/cli/lib/processWatchEvent.unitTest.js +0 -15
- package/dist/cli/lib/runDescribe.old.js +0 -108
- package/dist/cli/lib/runDescribe.old.unitTest.js +0 -440
- package/dist/cli/lib/runTest-old.js +0 -160
- package/dist/cli/lib/runTest-old.unitTest.js +0 -184
- package/dist/cli/lib/watchFiles.unitTest.js +0 -50
- package/dist/cli/once.unitTest.js +0 -39
- package/dist/describe-old.js +0 -271
- package/dist/describe-old.unitTest.js +0 -30
- package/dist/exported.eslintrc.js +0 -7
- package/dist/lib/arrayRemove.d.ts +0 -2
- package/dist/lib/arrayRemove.d.ts.map +0 -1
- package/dist/lib/arrayRemove.js +0 -15
- package/dist/lib/arrayRemove.js.map +0 -1
- package/dist/lib/promiseAllObj.d.ts +0 -2
- package/dist/lib/promiseAllObj.d.ts.map +0 -1
- package/dist/lib/promiseAllObj.js +0 -14
- package/dist/lib/promiseAllObj.js.map +0 -1
- package/dist/testsState.js +0 -5
- package/dist/timeProfiling.js +0 -9
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
import { createTimeProfiler } from '
|
|
2
|
-
import {
|
|
3
|
-
import chalk from 'chalk
|
|
4
|
-
import { out as mainOut
|
|
5
|
-
import figures from 'figures';
|
|
6
|
-
//import { testsState } from '../../testsState.js'
|
|
7
|
-
|
|
1
|
+
import { createTimeProfiler } from '../../packages/timeProfiler.js';
|
|
2
|
+
import { showTimeProfiling } from '../../config.js';
|
|
3
|
+
import chalk from '../../packages/chalk.js';
|
|
4
|
+
import { out as mainOut } from '../../output.js';
|
|
5
|
+
import figures from '../../packages/figures.js';
|
|
8
6
|
import { indexNumberToLetters } from '../../indexNumberToLetters.js';
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
await debug('customOut', customOut);
|
|
14
|
-
const out = customOut ? async (...texts) => await customOut(...texts) : async (...texts) => await mainOut(...texts);
|
|
15
|
-
|
|
16
|
-
//console.log('testResult', testResult)
|
|
17
|
-
|
|
18
|
-
await timeProfileAsync('show test result', () => {
|
|
19
|
-
out();
|
|
20
|
-
out(chalk.grey`File ${testResult.file}`);
|
|
21
|
-
const indent = ' ';
|
|
22
|
-
if (testResult.logs.length > 0) {
|
|
23
|
-
out();
|
|
24
|
-
out( /*indent + */chalk.grey`console.logs:`);
|
|
25
|
-
testResult.logs.forEach(async log => {
|
|
26
|
-
/*log[0] = indent + log[0]*/
|
|
27
|
-
await out(...log);
|
|
28
|
-
});
|
|
29
|
-
out();
|
|
30
|
-
}
|
|
31
|
-
let first = true;
|
|
32
|
-
for (const describeResult of testResult.describeResults) {
|
|
33
|
-
if (!first) out();
|
|
34
|
-
first = false;
|
|
35
|
-
out(chalk.lightgrey`${describeResult.counter}) describing ` + chalk.brightblue(describeResult.thing));
|
|
36
|
-
out();
|
|
37
|
-
if (describeResult.logs.length > 0) {
|
|
38
|
-
out( /*indent + */chalk.grey`console.logs:`);
|
|
39
|
-
describeResult.logs.forEach(async log => {
|
|
40
|
-
/*log[0] = indent + log[0]*/
|
|
41
|
-
await out(...log);
|
|
42
|
-
});
|
|
7
|
+
const { timeProfileAsync } = createTimeProfiler(showTimeProfiling);
|
|
8
|
+
export async function showTestResult(config, testResult, customOut) {
|
|
9
|
+
const out = customOut ?? mainOut;
|
|
10
|
+
await timeProfileAsync('show test result', () => {
|
|
43
11
|
out();
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
out();
|
|
53
|
-
out(chalk.grey(describeErrorStack));
|
|
54
|
-
}
|
|
55
|
-
out();
|
|
56
|
-
}
|
|
57
|
-
for (const itResult of describeResult.itResults) {
|
|
58
|
-
//console.log('itResult', itResult)
|
|
59
|
-
|
|
60
|
-
const letters = indexNumberToLetters(itResult.counter);
|
|
61
|
-
if (itResult.success) {
|
|
62
|
-
out(chalk.lightgrey`${indent}${letters})` + chalk.mediumgreen` ${figures.tick} ${itResult.should}`);
|
|
63
|
-
} else {
|
|
64
|
-
out(chalk.lightgrey`${indent}${letters})` + chalk.mediumred` ${figures.cross} ${itResult.should}`);
|
|
65
|
-
out();
|
|
66
|
-
const spacer = `${indent}${' '.repeat(letters.length)} `;
|
|
67
|
-
if ('actual' in itResult.error && 'expected' in itResult.error) {
|
|
68
|
-
out(chalk.mediumred(`${spacer}${itResult.error.name}: ${itResult.error.message}`
|
|
69
|
-
//+ `\n${spacer}expected: ${itResult.error.expected}`
|
|
70
|
-
//+ `\n${spacer}received: ${itResult.error.actual}`
|
|
71
|
-
));
|
|
72
|
-
} else {
|
|
73
|
-
out(chalk.mediumred(`${spacer}${itResult.error.name}: ${itResult.error.message}`));
|
|
74
|
-
}
|
|
75
|
-
// stack trace
|
|
76
|
-
if (config.showErrorTrace) {
|
|
12
|
+
out(chalk.grey `File ${testResult.file}`);
|
|
13
|
+
const indent = ' ';
|
|
14
|
+
if (testResult.logs.length > 0) {
|
|
15
|
+
out();
|
|
16
|
+
out(chalk.grey `console.logs:`);
|
|
17
|
+
testResult.logs.forEach(log => {
|
|
18
|
+
out(...log);
|
|
19
|
+
});
|
|
77
20
|
out();
|
|
78
|
-
out(chalk.grey(itResult.error.stack));
|
|
79
|
-
}
|
|
80
21
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
22
|
+
let first = true;
|
|
23
|
+
for (const describeResult of testResult.describeResults) {
|
|
24
|
+
if (!first)
|
|
25
|
+
out();
|
|
26
|
+
first = false;
|
|
27
|
+
out(chalk.lightgrey `${describeResult.counter}) describing ` + chalk.brightblue(describeResult.thing));
|
|
28
|
+
out();
|
|
29
|
+
if (describeResult.logs && describeResult.logs.length > 0) {
|
|
30
|
+
out(chalk.grey `console.logs:`);
|
|
31
|
+
describeResult.logs.forEach(log => {
|
|
32
|
+
out(...log);
|
|
33
|
+
});
|
|
34
|
+
out();
|
|
35
|
+
}
|
|
36
|
+
if (describeResult.error !== undefined) {
|
|
37
|
+
const describeError = describeResult.error;
|
|
38
|
+
const describeErrorText = (typeof describeError === 'object'
|
|
39
|
+
&& describeError !== null
|
|
40
|
+
&& 'name' in describeError
|
|
41
|
+
&& 'message' in describeError
|
|
42
|
+
&& typeof describeError.name === 'string'
|
|
43
|
+
&& typeof describeError.message === 'string')
|
|
44
|
+
? `${describeError.name}: ${describeError.message}`
|
|
45
|
+
: String(describeError);
|
|
46
|
+
out(chalk.mediumred(`${indent}Threw:`));
|
|
47
|
+
out(chalk.mediumred(`${indent}${describeErrorText}`));
|
|
48
|
+
if (config.showErrorTrace) {
|
|
49
|
+
const describeErrorStack = (typeof describeError === 'object'
|
|
50
|
+
&& describeError !== null
|
|
51
|
+
&& 'stack' in describeError
|
|
52
|
+
&& typeof describeError.stack === 'string')
|
|
53
|
+
? describeError.stack
|
|
54
|
+
: '';
|
|
55
|
+
out();
|
|
56
|
+
out(chalk.grey(describeErrorStack));
|
|
57
|
+
}
|
|
58
|
+
out();
|
|
59
|
+
}
|
|
60
|
+
for (const itResult of describeResult.itResults) {
|
|
61
|
+
const letters = indexNumberToLetters(itResult.counter) ?? '';
|
|
62
|
+
if (itResult.success === true) {
|
|
63
|
+
out(chalk.lightgrey `${indent}${letters})`
|
|
64
|
+
+ chalk.mediumgreen ` ${figures.tick} ${itResult.should}`);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
out(chalk.lightgrey `${indent}${letters})`
|
|
68
|
+
+ chalk.mediumred ` ${figures.cross} ${itResult.should}`);
|
|
69
|
+
out();
|
|
70
|
+
const spacer = `${indent}${' '.repeat(letters.length)} `;
|
|
71
|
+
const err = itResult.error;
|
|
72
|
+
if (err) {
|
|
73
|
+
out(chalk.mediumred(`${spacer}${err.name}: ${err.message}`));
|
|
74
|
+
// stack trace
|
|
75
|
+
if (config.showErrorTrace) {
|
|
76
|
+
out();
|
|
77
|
+
out(chalk.grey(err.stack ?? ''));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
out();
|
|
82
|
+
if (itResult.logs.length > 0) {
|
|
83
|
+
out(chalk.grey `console.logs:`);
|
|
84
|
+
itResult.logs.forEach(log => {
|
|
85
|
+
out(...log);
|
|
86
|
+
});
|
|
87
|
+
out();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
89
90
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=showTestResult.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"showTestResult.js","sourceRoot":"","sources":["../../../src/cli/lib/showTestResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"showTestResult.js","sourceRoot":"","sources":["../../../src/cli/lib/showTestResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,MAAM,yBAAyB,CAAA;AAC3C,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,OAAO,MAAM,2BAA2B,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AAIpE,MAAM,EAAE,gBAAgB,EAAE,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAAA;AAElE,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAAc,EAAE,UAAsB,EAAE,SAAiB;IAC1F,MAAM,GAAG,GAAG,SAAS,IAAI,OAAO,CAAA;IAEhC,MAAM,gBAAgB,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAC5C,GAAG,EAAE,CAAA;QACL,GAAG,CAAC,KAAK,CAAC,IAAI,CAAA,QAAQ,UAAU,CAAC,IAAI,EAAE,CAAC,CAAA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,190 +3,182 @@ import { showTestResult } from './showTestResult.js';
|
|
|
3
3
|
import { applyConfigDefaults } from './applyConfigDefaults.js';
|
|
4
4
|
import { loadTestFile } from './loadTestFile.js';
|
|
5
5
|
import { runTest } from './runTest.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
});
|
|
59
|
-
await mochaIt('should show the result of a test with an error', async function () {
|
|
60
|
-
const config = defaultConfig;
|
|
61
|
-
let error;
|
|
62
|
-
try {
|
|
63
|
-
await (await chaiExpect(1)).to.equal(2);
|
|
64
|
-
} catch (e) {
|
|
65
|
-
error = e;
|
|
66
|
-
}
|
|
67
|
-
const sampleTestResult = {
|
|
68
|
-
file: 'unitTesting/sampleTests/1.test.js',
|
|
69
|
-
success: true,
|
|
70
|
-
logs: [],
|
|
71
|
-
describeResults: [{
|
|
72
|
-
counter: 1,
|
|
73
|
-
thing: 'Sample test 1',
|
|
74
|
-
success: true,
|
|
75
|
-
logs: [],
|
|
76
|
-
itResults: [{
|
|
77
|
-
counter: 1,
|
|
78
|
-
should: '1 should equal 2',
|
|
79
|
-
success: false,
|
|
80
|
-
logs: [],
|
|
81
|
-
error
|
|
82
|
-
}],
|
|
83
|
-
itResultsSummary: {
|
|
84
|
-
total: 1,
|
|
85
|
-
passes: 1
|
|
6
|
+
mochaDescribe('showTestResult() function', function () {
|
|
7
|
+
mochaIt('should show the result of a single test that has been run', async function () {
|
|
8
|
+
const config = defaultConfig;
|
|
9
|
+
const sampleTestResult = {
|
|
10
|
+
file: 'unitTesting/sampleTests/1.test.js',
|
|
11
|
+
success: true,
|
|
12
|
+
logs: [],
|
|
13
|
+
describeResults: [
|
|
14
|
+
{
|
|
15
|
+
counter: 1,
|
|
16
|
+
thing: 'Sample test 1',
|
|
17
|
+
success: true,
|
|
18
|
+
logs: [],
|
|
19
|
+
itResults: [
|
|
20
|
+
{
|
|
21
|
+
counter: 1,
|
|
22
|
+
should: '1 should equal 1',
|
|
23
|
+
success: true,
|
|
24
|
+
logs: [],
|
|
25
|
+
time: 1,
|
|
26
|
+
error: undefined
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
itResultsSummary: {
|
|
30
|
+
total: 1,
|
|
31
|
+
passes: 1
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
describeResultsSummary: {
|
|
36
|
+
total: 1,
|
|
37
|
+
passes: 1,
|
|
38
|
+
invalid: 0,
|
|
39
|
+
itsTotal: 1,
|
|
40
|
+
itsPasses: 1
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
// create a custom out function to capture the output
|
|
44
|
+
let outBuffer = '';
|
|
45
|
+
const customOut = (...texts) => {
|
|
46
|
+
outBuffer += texts.join(' ') + '\n';
|
|
47
|
+
};
|
|
48
|
+
await showTestResult(config, sampleTestResult, customOut);
|
|
49
|
+
outBuffer.should.include(sampleTestResult.file);
|
|
50
|
+
outBuffer.should.include(sampleTestResult.describeResults[0]?.thing ?? '');
|
|
51
|
+
outBuffer.should.include(sampleTestResult.describeResults[0]?.itResults[0]?.should ?? '');
|
|
52
|
+
});
|
|
53
|
+
mochaIt('should show the result of a test with an error', async function () {
|
|
54
|
+
const config = defaultConfig;
|
|
55
|
+
let error;
|
|
56
|
+
try {
|
|
57
|
+
chaiExpect(1).to.equal(2);
|
|
86
58
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
passes: 1,
|
|
91
|
-
itsTotal: 1,
|
|
92
|
-
itsPasses: 1
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
// create a custom out function to capture the output
|
|
97
|
-
let outBuffer = '';
|
|
98
|
-
const customOut = (...texts) => {
|
|
99
|
-
//console.log('custom out received:', ...texts)
|
|
100
|
-
outBuffer += texts.join(' ') + '\n'; // join and save to the buffer
|
|
101
|
-
//console.log('outBuffer:', outBuffer)
|
|
102
|
-
};
|
|
103
|
-
await showTestResult(config, sampleTestResult, customOut);
|
|
104
|
-
|
|
105
|
-
//console.log(outBuffer)
|
|
106
|
-
|
|
107
|
-
await outBuffer.should.include('AssertionError');
|
|
108
|
-
await outBuffer.should.include('expected 1 to equal 2');
|
|
109
|
-
});
|
|
110
|
-
await mochaIt('shows test results including captured log output', async function () {
|
|
111
|
-
const config = defaultConfig;
|
|
112
|
-
const sampleTestResult = {
|
|
113
|
-
file: 'unitTesting/sampleTests/1.test.js',
|
|
114
|
-
success: true,
|
|
115
|
-
logs: [],
|
|
116
|
-
describeResults: [{
|
|
117
|
-
counter: 1,
|
|
118
|
-
thing: 'Sample test 1',
|
|
119
|
-
success: true,
|
|
120
|
-
logs: [['foo']],
|
|
121
|
-
itResults: [{
|
|
122
|
-
counter: 1,
|
|
123
|
-
should: '1 should equal 1',
|
|
124
|
-
success: true,
|
|
125
|
-
time: 1,
|
|
126
|
-
error: undefined,
|
|
127
|
-
logs: [['bar']]
|
|
128
|
-
}],
|
|
129
|
-
itResultsSummary: {
|
|
130
|
-
total: 1,
|
|
131
|
-
passes: 1
|
|
59
|
+
catch (e) {
|
|
60
|
+
if (e instanceof Error)
|
|
61
|
+
error = e;
|
|
132
62
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
63
|
+
const sampleTestResult = {
|
|
64
|
+
file: 'unitTesting/sampleTests/1.test.js',
|
|
65
|
+
success: true,
|
|
66
|
+
logs: [],
|
|
67
|
+
describeResults: [
|
|
68
|
+
{
|
|
69
|
+
counter: 1,
|
|
70
|
+
thing: 'Sample test 1',
|
|
71
|
+
success: true,
|
|
72
|
+
logs: [],
|
|
73
|
+
itResults: [
|
|
74
|
+
{
|
|
75
|
+
counter: 1,
|
|
76
|
+
should: '1 should equal 2',
|
|
77
|
+
success: false,
|
|
78
|
+
logs: [],
|
|
79
|
+
time: 1,
|
|
80
|
+
error
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
itResultsSummary: {
|
|
84
|
+
total: 1,
|
|
85
|
+
passes: 1
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
describeResultsSummary: {
|
|
90
|
+
total: 1,
|
|
91
|
+
passes: 1,
|
|
92
|
+
invalid: 0,
|
|
93
|
+
itsTotal: 1,
|
|
94
|
+
itsPasses: 1
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
// create a custom out function to capture the output
|
|
98
|
+
let outBuffer = '';
|
|
99
|
+
const customOut = (...texts) => {
|
|
100
|
+
outBuffer += texts.join(' ') + '\n';
|
|
101
|
+
};
|
|
102
|
+
await showTestResult(config, sampleTestResult, customOut);
|
|
103
|
+
outBuffer.should.include('AssertionError');
|
|
104
|
+
outBuffer.should.include('expected 1 to equal 2');
|
|
105
|
+
});
|
|
106
|
+
mochaIt('shows test results including captured log output', async function () {
|
|
107
|
+
const config = defaultConfig;
|
|
108
|
+
const sampleTestResult = {
|
|
109
|
+
file: 'unitTesting/sampleTests/1.test.js',
|
|
110
|
+
success: true,
|
|
111
|
+
logs: [],
|
|
112
|
+
describeResults: [
|
|
113
|
+
{
|
|
114
|
+
counter: 1,
|
|
115
|
+
thing: 'Sample test 1',
|
|
116
|
+
success: true,
|
|
117
|
+
logs: [
|
|
118
|
+
['foo']
|
|
119
|
+
],
|
|
120
|
+
itResults: [
|
|
121
|
+
{
|
|
122
|
+
counter: 1,
|
|
123
|
+
should: '1 should equal 1',
|
|
124
|
+
success: true,
|
|
125
|
+
time: 1,
|
|
126
|
+
error: undefined,
|
|
127
|
+
logs: [
|
|
128
|
+
['bar']
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
itResultsSummary: {
|
|
133
|
+
total: 1,
|
|
134
|
+
passes: 1
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
describeResultsSummary: {
|
|
139
|
+
total: 1,
|
|
140
|
+
passes: 1,
|
|
141
|
+
invalid: 0,
|
|
142
|
+
itsTotal: 1,
|
|
143
|
+
itsPasses: 1
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
// create a custom out function to capture the output
|
|
147
|
+
let outBuffer = '';
|
|
148
|
+
const customOut = (...texts) => {
|
|
149
|
+
outBuffer += texts.join(' ') + '\n';
|
|
150
|
+
};
|
|
151
|
+
await showTestResult(config, sampleTestResult, customOut);
|
|
152
|
+
outBuffer.should.include(sampleTestResult.file);
|
|
153
|
+
outBuffer.should.include(sampleTestResult.describeResults[0]?.thing ?? '');
|
|
154
|
+
outBuffer.should.include('foo');
|
|
155
|
+
outBuffer.should.include(sampleTestResult.describeResults[0]?.itResults[0]?.should ?? '');
|
|
156
|
+
outBuffer.should.include('bar');
|
|
157
|
+
});
|
|
158
|
+
mochaIt('shows test results including captured log output with a complex file', async function () {
|
|
159
|
+
const config = applyConfigDefaults({
|
|
160
|
+
execution: {
|
|
161
|
+
files: 'sequential',
|
|
162
|
+
describes: 'sequential',
|
|
163
|
+
tests: 'sequential'
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
const sampleTestFile = 'unitTesting/sampleTests/logging.test.js';
|
|
167
|
+
const sampleTest = await loadTestFile(config, sampleTestFile);
|
|
168
|
+
const testResult = await runTest(config, sampleTest);
|
|
169
|
+
// create a custom out function to capture the output
|
|
170
|
+
let outBuffer = '';
|
|
171
|
+
const customOut = (...texts) => {
|
|
172
|
+
outBuffer += texts.join(' ') + '\n';
|
|
173
|
+
};
|
|
174
|
+
await showTestResult(config, testResult, customOut);
|
|
175
|
+
outBuffer.should.include(testResult.file);
|
|
176
|
+
outBuffer.should.include(testResult.describeResults[0]?.thing ?? '');
|
|
177
|
+
outBuffer.should.include(testResult.describeResults[0]?.itResults[0]?.should ?? '');
|
|
178
|
+
outBuffer.should.include('1st test log');
|
|
179
|
+
outBuffer.should.include('3rd test log');
|
|
180
|
+
outBuffer.should.include('4th test log');
|
|
181
|
+
outBuffer.should.include('6th test log');
|
|
168
182
|
});
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const testResult = await runTest(config, sampleTest);
|
|
172
|
-
|
|
173
|
-
// create a custom out function to capture the output
|
|
174
|
-
let outBuffer = '';
|
|
175
|
-
const customOut = (...texts) => {
|
|
176
|
-
//console.log('custom out received:', ...texts)
|
|
177
|
-
outBuffer += texts.join(' ') + '\n'; // join and save to the buffer
|
|
178
|
-
//console.log('outBuffer:', outBuffer)
|
|
179
|
-
};
|
|
180
|
-
await showTestResult(config, testResult, customOut);
|
|
181
|
-
await console.log(outBuffer);
|
|
182
|
-
await outBuffer.should.include(testResult.file);
|
|
183
|
-
|
|
184
|
-
//console.log('---', sampleTestResult.describeResults[0].thing)
|
|
185
|
-
await outBuffer.should.include(testResult.describeResults[0].thing);
|
|
186
|
-
await outBuffer.should.include(testResult.describeResults[0].itResults[0].should);
|
|
187
|
-
await outBuffer.should.include('1st test log');
|
|
188
|
-
await outBuffer.should.include('3rd test log');
|
|
189
|
-
await outBuffer.should.include('4th test log');
|
|
190
|
-
await outBuffer.should.include('6th test log');
|
|
191
|
-
});
|
|
192
|
-
});
|
|
183
|
+
});
|
|
184
|
+
//# sourceMappingURL=showTestResult.unitTest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"showTestResult.unitTest.js","sourceRoot":"","sources":["../../../src/cli/lib/showTestResult.unitTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAGtC,aAAa,CAAC,2BAA2B,EAAE;IACvC,OAAO,CAAC,2DAA2D,EAAE,KAAK;QACtE,MAAM,MAAM,GAAG,aAAa,CAAA;QAE5B,MAAM,gBAAgB,GAAe;YACjC,IAAI,EAAE,mCAAmC;YACzC,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,EAAE;YACR,eAAe,EAAE;gBACb;oBACI,OAAO,EAAE,CAAC;oBACV,KAAK,EAAE,eAAe;oBACtB,OAAO,EAAE,IAAI;oBACb,IAAI,EAAE,EAAE;oBACR,SAAS,EAAE;wBACP;4BACI,OAAO,EAAE,CAAC;4BACV,MAAM,EAAE,kBAAkB;4BAC1B,OAAO,EAAE,IAAI;4BACb,IAAI,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AAO,CAAC,cAAc,CAAC,CAAA;QACxC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;QACxC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;IAC5C,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeCustomOut.d.ts","sourceRoot":"","sources":["../../../../src/cli/lib/testHelpers/makeCustomOut.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACtB,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IAC3B,YAAY,IAAI,MAAM,CAAA;IACtB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC;AAED,wBAAgB,aAAa,IAAI,SAAS,CAWzC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function makeCustomOut() {
|
|
2
|
+
let outBuffer = '';
|
|
3
|
+
const customOut = ((...texts) => {
|
|
4
|
+
outBuffer += texts.join(' ') + '\n'; // join and save to the buffer
|
|
5
|
+
});
|
|
6
|
+
customOut.getOutBuffer = () => outBuffer;
|
|
7
|
+
customOut.setOutBuffer = (value) => { outBuffer = value; };
|
|
8
|
+
return customOut;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=makeCustomOut.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeCustomOut.js","sourceRoot":"","sources":["../../../../src/cli/lib/testHelpers/makeCustomOut.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,aAAa;IACzB,IAAI,SAAS,GAAG,EAAE,CAAA;IAElB,MAAM,SAAS,GAAG,CAAC,CAAC,GAAG,KAAgB,EAAE,EAAE;QACvC,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA,CAAC,8BAA8B;IACtE,CAAC,CAAc,CAAA;IAEf,SAAS,CAAC,YAAY,GAAG,GAAG,EAAE,CAAC,SAAS,CAAA;IACxC,SAAS,CAAC,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE,GAAG,SAAS,GAAG,KAAK,CAAA,CAAC,CAAC,CAAA;IAEjE,OAAO,SAAS,CAAA;AACpB,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { createTimeProfiler } from '
|
|
1
|
+
import { createTimeProfiler } from '../../packages/timeProfiler.js';
|
|
2
2
|
import { showTimeProfiling } from '../../config.js';
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} = await createTimeProfiler(showTimeProfiling);
|
|
7
|
-
export { timeProfile, timeProfileAsync };
|
|
3
|
+
const { timeProfile, timeProfileAsync } = createTimeProfiler(showTimeProfiling);
|
|
4
|
+
export { timeProfile, timeProfileAsync };
|
|
5
|
+
//# sourceMappingURL=timeProfier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeProfier.js","sourceRoot":"","sources":["../../../src/cli/lib/timeProfier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"timeProfier.js","sourceRoot":"","sources":["../../../src/cli/lib/timeProfier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEnD,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAAA;AAE/E,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAA"}
|