sxy-test-runner 1.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 +33 -0
- package/dist/cli/init.js +170 -0
- package/dist/cli/init.unitTest.js +0 -0
- package/dist/cli/lib/addBasePath.js +15 -0
- package/dist/cli/lib/addBasePath.unitTest.js +31 -0
- package/dist/cli/lib/addExports.js +12 -0
- package/dist/cli/lib/addExports.unitTest.js +29 -0
- package/dist/cli/lib/applyConfigDefaults.js +41 -0
- package/dist/cli/lib/applyConfigDefaults.unitTest.js +25 -0
- package/dist/cli/lib/buildDependencyTree.js +32 -0
- package/dist/cli/lib/buildDependencyTree.unitTest.js +15 -0
- package/dist/cli/lib/buildDependencyTrees.js +34 -0
- package/dist/cli/lib/buildDependencyTrees.unitTest.js +17 -0
- package/dist/cli/lib/defaultConfig.js +22 -0
- package/dist/cli/lib/defaultConfig.test.js +7 -0
- package/dist/cli/lib/doUserSetup.js +30 -0
- package/dist/cli/lib/doUserSetup.unitTest.js +39 -0
- package/dist/cli/lib/doUserTeardown.js +30 -0
- package/dist/cli/lib/doUserTeardown.unitTest.js +39 -0
- package/dist/cli/lib/findTestFiles.js +24 -0
- package/dist/cli/lib/findTestFiles.unitTest.js +22 -0
- package/dist/cli/lib/getAllowedFlags.js +11 -0
- package/dist/cli/lib/getAllowedFlags.unitTest.js +20 -0
- package/dist/cli/lib/globArgCombine.js +1 -0
- package/dist/cli/lib/globArgCombine.unitTest.js +18 -0
- package/dist/cli/lib/injectProperties.js +11 -0
- package/dist/cli/lib/injectProperties.unitTest.js +75 -0
- package/dist/cli/lib/load.js +3 -0
- package/dist/cli/lib/load.unitTest.js +7 -0
- package/dist/cli/lib/loadConfig.js +21 -0
- package/dist/cli/lib/loadConfig.unitTest.js +15 -0
- package/dist/cli/lib/loadTestFile.js +75 -0
- package/dist/cli/lib/loadTestFile.unitTest.js +45 -0
- package/dist/cli/lib/loadTestFileStatic.js +40 -0
- package/dist/cli/lib/loadTestFileStatic.unitTest.js +29 -0
- package/dist/cli/lib/parseCommandLineArguments.js +57 -0
- package/dist/cli/lib/parseCommandLineArguments.unitTest.js +21 -0
- package/dist/cli/lib/parseDescribe.js +88 -0
- package/dist/cli/lib/parseDescribe.unitTest.js +17 -0
- package/dist/cli/lib/parseItsFromDescribe.js +115 -0
- package/dist/cli/lib/processWatchEvent.js +0 -0
- package/dist/cli/lib/processWatchEvent.unitTest.js +7 -0
- package/dist/cli/lib/reservedExportKeys.js +1 -0
- package/dist/cli/lib/reservedExportKeys.unitTest.js +7 -0
- package/dist/cli/lib/runDescribe.js +29 -0
- package/dist/cli/lib/runDescribe.old copy.js +115 -0
- package/dist/cli/lib/runDescribe.old.js +115 -0
- package/dist/cli/lib/runDescribe.old.unitTest.js +440 -0
- package/dist/cli/lib/runDescribe.unitTest.js +287 -0
- package/dist/cli/lib/runDescribeParseIts.js +87 -0
- package/dist/cli/lib/runDescribeParseIts.unitTest.js +0 -0
- package/dist/cli/lib/runDescribeRun.js +59 -0
- package/dist/cli/lib/runDescribeRun.unitTest.js +293 -0
- package/dist/cli/lib/runDescribeRunIts.js +56 -0
- package/dist/cli/lib/runDescribeRunIts.unitTest.js +0 -0
- package/dist/cli/lib/runIt.js +79 -0
- package/dist/cli/lib/runIt.unitTest.js +294 -0
- package/dist/cli/lib/runTasks.js +42 -0
- package/dist/cli/lib/runTasks.unitTest.js +30 -0
- package/dist/cli/lib/runTest-old.js +159 -0
- package/dist/cli/lib/runTest-old.unitTest.js +183 -0
- package/dist/cli/lib/runTest.js +71 -0
- package/dist/cli/lib/runTest.unitTest.js +269 -0
- package/dist/cli/lib/runTests.js +137 -0
- package/dist/cli/lib/runTests.unitTest.js +59 -0
- package/dist/cli/lib/showTestLoadingError.js +22 -0
- package/dist/cli/lib/showTestLoadingError.unitTest.js +25 -0
- package/dist/cli/lib/showTestResult.js +87 -0
- package/dist/cli/lib/showTestResult.unitTest.js +180 -0
- package/dist/cli/lib/timeProfier.js +7 -0
- package/dist/cli/lib/validateConfig.js +29 -0
- package/dist/cli/lib/validateConfig.unitTest.js +22 -0
- package/dist/cli/lib/watchFiles.js +1 -0
- package/dist/cli/lib/watchFiles.unitTest.js +48 -0
- package/dist/cli/lib/watchFilesAndRunTests.js +2 -0
- package/dist/cli/lib/watchFilesAndRunTests.unitTest.js +129 -0
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.js +142 -0
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.unitTest.js +133 -0
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.js +162 -0
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.unitTest.js +131 -0
- package/dist/cli/lib/watchFilesChokidar.js +56 -0
- package/dist/cli/lib/watchFilesChokidar.unitTest.js +85 -0
- package/dist/cli/lib/watchFilesNodeWatch.js +42 -0
- package/dist/cli/lib/watchFilesNodeWatch.unitTest.js +48 -0
- package/dist/cli/once.js +47 -0
- package/dist/cli/once.unitTest.js +39 -0
- package/dist/cli/watch.js +100 -0
- package/dist/cli/watch.unitTest.js +117 -0
- package/dist/config.js +7 -0
- package/dist/describe-old.js +257 -0
- package/dist/describe-old.unitTest.js +21 -0
- package/dist/describe.js +24 -0
- package/dist/describe.unitTest.js +27 -0
- package/dist/exported.eslintrc.js +7 -0
- package/dist/index.js +1 -0
- package/dist/indexNumberToLetters.js +13 -0
- package/dist/load.js +3 -0
- package/dist/output.js +17 -0
- package/dist/testing/example.test.js +26 -0
- package/dist/testing/example2.test.js +19 -0
- package/dist/testing/example3.test.js +16 -0
- package/dist/testing/importTimeTarget.js +9 -0
- package/dist/testing/importTimeTarget2.js +11 -0
- package/dist/testing/importTimeTest.js +8 -0
- package/dist/testsState.js +4 -0
- package/dist/timeProfiling.js +9 -0
- package/package.json +68 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { timeProfileAsync } from './timeProfier.js';
|
|
2
|
+
import { runTasks } from './runTasks.js';
|
|
3
|
+
import { addExports } from './addExports.js';
|
|
4
|
+
import { debug } from '../../output.js';
|
|
5
|
+
import { runIt } from './runIt.js';
|
|
6
|
+
export async function parseItsFromDescribe(config, describe) {
|
|
7
|
+
return await timeProfileAsync(`parse its from describe ${describe.thing}`, async () => {
|
|
8
|
+
let itCounter = 1;
|
|
9
|
+
const its = []; // create functions to pass back
|
|
10
|
+
// afterDescribe
|
|
11
|
+
|
|
12
|
+
let afterDescribeFunc;
|
|
13
|
+
|
|
14
|
+
async function afterDescribe(func) {
|
|
15
|
+
if (typeof func !== 'function') {
|
|
16
|
+
throw new Error(`afterDescribe() error, argument passed to afterDescribe() must be a function,` + ` received ${typeof func}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
afterDescribeFunc = func;
|
|
20
|
+
} // beforeEachTest
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
let beforeEachTestFunc;
|
|
24
|
+
|
|
25
|
+
async function beforeEachTest(func) {
|
|
26
|
+
if (typeof func !== 'function') {
|
|
27
|
+
throw new Error(`afterDescribe() error, argument passed to afterDescribe() must be a function,` + ` received ${typeof func}`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
beforeEachTestFunc = func;
|
|
31
|
+
} // afterEachTest
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
let afterEachTestFunc;
|
|
35
|
+
|
|
36
|
+
async function afterEachTest(func) {
|
|
37
|
+
if (typeof func !== 'function') {
|
|
38
|
+
throw new Error(`afterDescribe() error, argument passed to afterDescribe() must be a function,` + ` received ${typeof func}`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
afterEachTestFunc = func;
|
|
42
|
+
} // it
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
async function it(should, test) {
|
|
46
|
+
const thisItCounter = itCounter++;
|
|
47
|
+
await its.push({
|
|
48
|
+
counter: thisItCounter,
|
|
49
|
+
should,
|
|
50
|
+
test //beforeEachTestExports
|
|
51
|
+
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const test = it;
|
|
56
|
+
const describeExports = {};
|
|
57
|
+
await configBeforeEachDescribe(config, describeExports);
|
|
58
|
+
const describeParcel = {
|
|
59
|
+
it,
|
|
60
|
+
test,
|
|
61
|
+
afterDescribe,
|
|
62
|
+
beforeEachTest,
|
|
63
|
+
afterEachTest
|
|
64
|
+
};
|
|
65
|
+
await addExports(describeParcel, describeExports);
|
|
66
|
+
await describe.tests(describeParcel); //console.log('its', its)
|
|
67
|
+
// const beforeEachDescribeExports = (config.beforeEachDescribe)
|
|
68
|
+
// ? runTasks(config, config.beforeEachDescribe)
|
|
69
|
+
// : {}
|
|
70
|
+
//const thisDescribeCounter = describeCounter++ // assign THEN increment
|
|
71
|
+
//let itCounter = 1
|
|
72
|
+
|
|
73
|
+
const itResults = [];
|
|
74
|
+
|
|
75
|
+
for (const it of its) {
|
|
76
|
+
await itResults.push(await runIt(config, it, beforeEachTestFunc, afterEachTestFunc));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const itResultsSummary = {
|
|
80
|
+
total: 0,
|
|
81
|
+
passes: 0
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
for (const itResult of itResults) {
|
|
85
|
+
itResultsSummary.total += +(itResult.success !== null);
|
|
86
|
+
itResultsSummary.passes += +itResult.success;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
await debug('itResultsSummary', itResultsSummary);
|
|
90
|
+
const describeResult = {
|
|
91
|
+
counter: describe.counter,
|
|
92
|
+
thing: describe.thing,
|
|
93
|
+
success: itResultsSummary.total > 0 ? itResultsSummary.passes === itResultsSummary.total : null,
|
|
94
|
+
itResults,
|
|
95
|
+
itResultsSummary
|
|
96
|
+
}; // run after
|
|
97
|
+
|
|
98
|
+
if (typeof afterDescribeFunc === 'function') await afterDescribeFunc();
|
|
99
|
+
await configAfterEachDescribe(config, describeExports);
|
|
100
|
+
return describeResult;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async function configBeforeEachDescribe(config, exports) {
|
|
105
|
+
if (config.beforeEachDescribe) {
|
|
106
|
+
const theExports = await runTasks(config.beforeEachDescribe, undefined);
|
|
107
|
+
await addExports(exports, theExports);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async function configAfterEachDescribe(config, exports) {
|
|
112
|
+
if (config.afterEachDescribe) {
|
|
113
|
+
await runTasks(config.afterEachDescribe, exports);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//import { processWatchEvent } from './processWatchEvent.js'
|
|
2
|
+
// parseCommandLineArguments(allowedArguments)
|
|
3
|
+
// mochaDescribe('processWatchEvent() function', function() {
|
|
4
|
+
// mochaIt('identifies a test in a watch event', function() {
|
|
5
|
+
// processWatchEvent('temp/a.test.js', 'update')
|
|
6
|
+
// })
|
|
7
|
+
// })
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const reservedExportKeys = ['describe', 'test', 'it', 'before', 'after', 'beforeEach', 'afterEach', 'beforeAll', 'afterAll'];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { reservedExportKeys } from './reservedExportKeys.js'; // applyConfigDefaults( userConfig: {} )
|
|
2
|
+
|
|
3
|
+
await mochaDescribe('the reservedExportKeys', async function () {
|
|
4
|
+
await mochaIt('has sensible defaults', async function () {
|
|
5
|
+
await reservedExportKeys.should.include.members(['describe', 'test', 'it', 'before']);
|
|
6
|
+
});
|
|
7
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { timeProfileAsync } from './timeProfier.js';
|
|
2
|
+
import { parseDescribe } from './parseDescribe.js';
|
|
3
|
+
import { runDescribeRun } from './runDescribeRun.js';
|
|
4
|
+
export async function runDescribe(config, describe) {
|
|
5
|
+
return await timeProfileAsync(`run describe ${describe.thing}`, async () => {
|
|
6
|
+
const capturingConsoleLog = config.execution.describes === 'sequential'; //// capture console.log output
|
|
7
|
+
|
|
8
|
+
let previousConsoleLog;
|
|
9
|
+
const logs = [];
|
|
10
|
+
|
|
11
|
+
if (capturingConsoleLog) {
|
|
12
|
+
previousConsoleLog = console.log; // eslint-disable-line no-console
|
|
13
|
+
|
|
14
|
+
console.log = async (...texts) => await logs.push(texts); // eslint-disable-line no-console
|
|
15
|
+
|
|
16
|
+
} ////
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
const parsedDescribe = await parseDescribe(config, describe);
|
|
20
|
+
const describeResult = await runDescribeRun(config, describe, parsedDescribe);
|
|
21
|
+
describeResult.logs = logs;
|
|
22
|
+
|
|
23
|
+
if (capturingConsoleLog) {
|
|
24
|
+
console.log = previousConsoleLog; // eslint-disable-line no-console
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return describeResult;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { timeProfileAsync } from './timeProfier.js';
|
|
2
|
+
import { runTasks } from './runTasks.js';
|
|
3
|
+
import { addExports } from './addExports.js';
|
|
4
|
+
import { debug } from '../../output.js';
|
|
5
|
+
import { runIt } from './runIt.js';
|
|
6
|
+
export async function runDescribe(config, describe) {
|
|
7
|
+
return await timeProfileAsync(`run describe ${describe.thing}`, async () => {
|
|
8
|
+
let itCounter = 1;
|
|
9
|
+
const its = []; // create functions to pass back
|
|
10
|
+
// afterDescribe
|
|
11
|
+
|
|
12
|
+
let afterDescribeFunc;
|
|
13
|
+
|
|
14
|
+
async function afterDescribe(func) {
|
|
15
|
+
if (typeof func !== 'function') {
|
|
16
|
+
throw new Error(`afterDescribe() error, argument passed to afterDescribe() must be a function,` + ` received ${typeof func}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
afterDescribeFunc = func;
|
|
20
|
+
} // beforeEachTest
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
let beforeEachTestFunc;
|
|
24
|
+
|
|
25
|
+
async function beforeEachTest(func) {
|
|
26
|
+
if (typeof func !== 'function') {
|
|
27
|
+
throw new Error(`afterDescribe() error, argument passed to afterDescribe() must be a function,` + ` received ${typeof func}`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
beforeEachTestFunc = func;
|
|
31
|
+
} // afterEachTest
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
let afterEachTestFunc;
|
|
35
|
+
|
|
36
|
+
async function afterEachTest(func) {
|
|
37
|
+
if (typeof func !== 'function') {
|
|
38
|
+
throw new Error(`afterDescribe() error, argument passed to afterDescribe() must be a function,` + ` received ${typeof func}`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
afterEachTestFunc = func;
|
|
42
|
+
} // it
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
async function it(should, test) {
|
|
46
|
+
const thisItCounter = itCounter++;
|
|
47
|
+
await its.push({
|
|
48
|
+
counter: thisItCounter,
|
|
49
|
+
should,
|
|
50
|
+
test //beforeEachTestExports
|
|
51
|
+
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const test = it;
|
|
56
|
+
const describeExports = {};
|
|
57
|
+
await configBeforeEachDescribe(config, describeExports);
|
|
58
|
+
const describeParcel = {
|
|
59
|
+
it,
|
|
60
|
+
test,
|
|
61
|
+
afterDescribe,
|
|
62
|
+
beforeEachTest,
|
|
63
|
+
afterEachTest
|
|
64
|
+
};
|
|
65
|
+
await addExports(describeParcel, describeExports);
|
|
66
|
+
await describe.tests(describeParcel); //console.log('its', its)
|
|
67
|
+
// const beforeEachDescribeExports = (config.beforeEachDescribe)
|
|
68
|
+
// ? runTasks(config, config.beforeEachDescribe)
|
|
69
|
+
// : {}
|
|
70
|
+
//const thisDescribeCounter = describeCounter++ // assign THEN increment
|
|
71
|
+
//let itCounter = 1
|
|
72
|
+
|
|
73
|
+
const itResults = [];
|
|
74
|
+
|
|
75
|
+
for (const it of its) {
|
|
76
|
+
await itResults.push(await runIt(config, it, beforeEachTestFunc, afterEachTestFunc));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const itResultsSummary = {
|
|
80
|
+
total: 0,
|
|
81
|
+
passes: 0
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
for (const itResult of itResults) {
|
|
85
|
+
itResultsSummary.total += +(itResult.success !== null);
|
|
86
|
+
itResultsSummary.passes += +itResult.success;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
await debug('itResultsSummary', itResultsSummary);
|
|
90
|
+
const describeResult = {
|
|
91
|
+
counter: describe.counter,
|
|
92
|
+
thing: describe.thing,
|
|
93
|
+
success: itResultsSummary.total > 0 ? itResultsSummary.passes === itResultsSummary.total : null,
|
|
94
|
+
itResults,
|
|
95
|
+
itResultsSummary
|
|
96
|
+
}; // run after
|
|
97
|
+
|
|
98
|
+
if (typeof afterDescribeFunc === 'function') await afterDescribeFunc();
|
|
99
|
+
await configAfterEachDescribe(config, describeExports);
|
|
100
|
+
return describeResult;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async function configBeforeEachDescribe(config, exports) {
|
|
105
|
+
if (config.beforeEachDescribe) {
|
|
106
|
+
const theExports = await runTasks(config.beforeEachDescribe, undefined);
|
|
107
|
+
await addExports(exports, theExports);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async function configAfterEachDescribe(config, exports) {
|
|
112
|
+
if (config.afterEachDescribe) {
|
|
113
|
+
await runTasks(config.afterEachDescribe, exports);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { timeProfileAsync } from './timeProfier.js';
|
|
2
|
+
import { runTasks } from './runTasks.js';
|
|
3
|
+
import { addExports } from './addExports.js';
|
|
4
|
+
import { debug } from '../../output.js';
|
|
5
|
+
import { runIt } from './runIt.js';
|
|
6
|
+
export async function runDescribeOld(config, describe) {
|
|
7
|
+
return await timeProfileAsync(`run describe ${describe.thing}`, async () => {
|
|
8
|
+
let itCounter = 1;
|
|
9
|
+
const its = []; // create functions to pass back
|
|
10
|
+
// afterDescribe
|
|
11
|
+
|
|
12
|
+
let afterDescribeFunc;
|
|
13
|
+
|
|
14
|
+
async function afterDescribe(func) {
|
|
15
|
+
if (typeof func !== 'function') {
|
|
16
|
+
throw new Error(`afterDescribe() error, argument passed to afterDescribe() must be a function,` + ` received ${typeof func}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
afterDescribeFunc = func;
|
|
20
|
+
} // beforeEachTest
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
let beforeEachTestFunc;
|
|
24
|
+
|
|
25
|
+
async function beforeEachTest(func) {
|
|
26
|
+
if (typeof func !== 'function') {
|
|
27
|
+
throw new Error(`afterDescribe() error, argument passed to afterDescribe() must be a function,` + ` received ${typeof func}`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
beforeEachTestFunc = func;
|
|
31
|
+
} // afterEachTest
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
let afterEachTestFunc;
|
|
35
|
+
|
|
36
|
+
async function afterEachTest(func) {
|
|
37
|
+
if (typeof func !== 'function') {
|
|
38
|
+
throw new Error(`afterDescribe() error, argument passed to afterDescribe() must be a function,` + ` received ${typeof func}`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
afterEachTestFunc = func;
|
|
42
|
+
} // it
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
async function it(should, test) {
|
|
46
|
+
const thisItCounter = itCounter++;
|
|
47
|
+
await its.push({
|
|
48
|
+
counter: thisItCounter,
|
|
49
|
+
should,
|
|
50
|
+
test //beforeEachTestExports
|
|
51
|
+
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const test = it;
|
|
56
|
+
const describeExports = {};
|
|
57
|
+
await configBeforeEachDescribe(config, describeExports);
|
|
58
|
+
const describeParcel = {
|
|
59
|
+
it,
|
|
60
|
+
test,
|
|
61
|
+
afterDescribe,
|
|
62
|
+
beforeEachTest,
|
|
63
|
+
afterEachTest
|
|
64
|
+
};
|
|
65
|
+
await addExports(describeParcel, describeExports);
|
|
66
|
+
await describe.tests(describeParcel); //console.log('its', its)
|
|
67
|
+
// const beforeEachDescribeExports = (config.beforeEachDescribe)
|
|
68
|
+
// ? runTasks(config, config.beforeEachDescribe)
|
|
69
|
+
// : {}
|
|
70
|
+
//const thisDescribeCounter = describeCounter++ // assign THEN increment
|
|
71
|
+
//let itCounter = 1
|
|
72
|
+
|
|
73
|
+
const itResults = [];
|
|
74
|
+
|
|
75
|
+
for (const it of its) {
|
|
76
|
+
await itResults.push(await runIt(config, it, beforeEachTestFunc, afterEachTestFunc));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const itResultsSummary = {
|
|
80
|
+
total: 0,
|
|
81
|
+
passes: 0
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
for (const itResult of itResults) {
|
|
85
|
+
itResultsSummary.total += +(itResult.success !== null);
|
|
86
|
+
itResultsSummary.passes += +itResult.success;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
await debug('itResultsSummary', itResultsSummary);
|
|
90
|
+
const describeResult = {
|
|
91
|
+
counter: describe.counter,
|
|
92
|
+
thing: describe.thing,
|
|
93
|
+
success: itResultsSummary.total > 0 ? itResultsSummary.passes === itResultsSummary.total : null,
|
|
94
|
+
itResults,
|
|
95
|
+
itResultsSummary
|
|
96
|
+
}; // run after
|
|
97
|
+
|
|
98
|
+
if (typeof afterDescribeFunc === 'function') await afterDescribeFunc();
|
|
99
|
+
await configAfterEachDescribe(config, describeExports);
|
|
100
|
+
return describeResult;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async function configBeforeEachDescribe(config, exports) {
|
|
105
|
+
if (config.beforeEachDescribe) {
|
|
106
|
+
const theExports = await runTasks(config.beforeEachDescribe, undefined);
|
|
107
|
+
await addExports(exports, theExports);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async function configAfterEachDescribe(config, exports) {
|
|
112
|
+
if (config.afterEachDescribe) {
|
|
113
|
+
await runTasks(config.afterEachDescribe, exports);
|
|
114
|
+
}
|
|
115
|
+
}
|