-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmain.js
More file actions
42 lines (37 loc) · 1.01 KB
/
main.js
File metadata and controls
42 lines (37 loc) · 1.01 KB
1
2
3
4
5
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
import fetchTests from './__tests__/fetch.test.js';
import retryTests from './__tests__/retry.test.js';
import modelTests from './__tests__/Model.test.js';
import stateTests from './__tests__/State.test.js';
import resourceTests from './__tests__/Resource.test.js';
import resourceFactoryTests from './__tests__/ResourceFactory.test.js';
const testSuites = [
modelTests,
stateTests,
fetchTests,
resourceTests,
retryTests,
resourceFactoryTests,
];
const allSuitesTimerLabel = 'All tests finished';
async function runTests(tests) {
for (const { label, test } of tests) {
console.group(label);
try {
await test();
} catch (e) {
console.error(e.toString());
}
console.groupEnd();
}
}
async function runTestSuites(testSuites) {
console.time(allSuitesTimerLabel);
for (const { scope, tests } of testSuites) {
console.groupCollapsed(scope);
await runTests(tests);
console.groupEnd();
}
}
runTestSuites(testSuites).then(() => {
console.timeEnd(allSuitesTimerLabel);
});