@w-lfpup/jackrabbit 0.2.0 → 0.3.1
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/.github/workflows/browsers.json +55 -0
- package/.github/workflows/browsers.macos.json +51 -0
- package/.github/workflows/browsers.windows.json +19 -0
- package/.github/workflows/tests.yml +13 -0
- package/README.md +41 -1
- package/browser/dist/logger.js +43 -0
- package/browser/dist/mod.js +25 -0
- package/browser/dist/queue.js +27 -0
- package/browser/dist/runner.js +20 -0
- package/{cli → browser}/package.json +1 -1
- package/browser/src/logger.ts +57 -0
- package/browser/src/mod.ts +30 -0
- package/browser/src/runner.ts +22 -0
- package/browser/tsconfig.json +11 -0
- package/browser/tsconfig.tsbuildinfo +1 -0
- package/browsers.json +38 -0
- package/core/dist/jackrabbit_types.d.ts +61 -27
- package/core/dist/mod.d.ts +2 -2
- package/core/dist/mod.js +1 -1
- package/core/dist/run_steps.d.ts +2 -2
- package/core/dist/run_steps.js +83 -67
- package/core/src/jackrabbit_types.ts +72 -28
- package/core/src/mod.ts +2 -8
- package/core/src/run_steps.ts +111 -80
- package/examples/hello_world/goodbye_world.ts +1 -1
- package/examples/hello_world/hello_world.ts +1 -1
- package/nodejs/dist/logger.js +164 -0
- package/nodejs/dist/mod.js +33 -0
- package/nodejs/dist/results.js +145 -0
- package/nodejs/dist/results_str.js +147 -0
- package/nodejs/dist/runner.js +17 -0
- package/nodejs/src/logger.ts +200 -0
- package/nodejs/src/mod.ts +39 -0
- package/nodejs/src/results.ts +239 -0
- package/{nodejs_cli → nodejs}/tsconfig.json +2 -1
- package/nodejs/tsconfig.tsbuildinfo +1 -0
- package/package.json +6 -4
- package/tests/dist/mod.d.ts +14 -3
- package/tests/dist/mod.js +33 -15
- package/tests/dist/test_error.test.d.ts +9 -0
- package/tests/dist/test_error.test.js +25 -0
- package/tests/dist/test_errors.test.d.ts +9 -0
- package/tests/dist/test_errors.test.js +27 -0
- package/tests/dist/test_fail.test.js +0 -2
- package/tests/dist/test_logger.d.ts +3 -2
- package/tests/dist/test_logger.js +5 -1
- package/tests/dist/test_pass.test.js +0 -2
- package/tests/src/mod.ts +31 -15
- package/tests/src/test_error.test.ts +32 -0
- package/tests/src/test_logger.ts +6 -1
- package/tests/tsconfig.tsbuildinfo +1 -1
- package/tsconfig.json +3 -2
- package/webdriver/dist/config.js +56 -0
- package/webdriver/dist/eventbus.js +18 -0
- package/webdriver/dist/listeners.js +21 -0
- package/webdriver/dist/logger.js +200 -0
- package/webdriver/dist/mod.js +35 -0
- package/webdriver/dist/results.js +190 -0
- package/webdriver/dist/results_str.js +167 -0
- package/webdriver/dist/routes.js +162 -0
- package/webdriver/dist/routes2.js +163 -0
- package/webdriver/dist/test_hangar.js +20 -0
- package/webdriver/dist/webdriver.js +272 -0
- package/webdriver/package.json +8 -0
- package/webdriver/src/config.ts +89 -0
- package/webdriver/src/eventbus.ts +104 -0
- package/webdriver/src/logger.ts +247 -0
- package/webdriver/src/mod.ts +45 -0
- package/webdriver/src/results.ts +311 -0
- package/webdriver/src/routes.ts +198 -0
- package/webdriver/src/test_hangar.ts +25 -0
- package/webdriver/src/webdriver.ts +373 -0
- package/{cli → webdriver}/tsconfig.json +1 -0
- package/webdriver/tsconfig.tsbuildinfo +1 -0
- package/cli/dist/cli.d.ts +0 -3
- package/cli/dist/cli.js +0 -8
- package/cli/dist/cli_types.d.ts +0 -7
- package/cli/dist/cli_types.js +0 -1
- package/cli/dist/config.d.ts +0 -5
- package/cli/dist/config.js +0 -6
- package/cli/dist/importer.d.ts +0 -7
- package/cli/dist/importer.js +0 -16
- package/cli/dist/logger.d.ts +0 -7
- package/cli/dist/logger.js +0 -88
- package/cli/dist/mod.d.ts +0 -6
- package/cli/dist/mod.js +0 -4
- package/cli/src/cli.ts +0 -17
- package/cli/src/cli_types.ts +0 -9
- package/cli/src/config.ts +0 -9
- package/cli/src/importer.ts +0 -25
- package/cli/src/logger.ts +0 -126
- package/cli/src/mod.ts +0 -7
- package/cli/tsconfig.tsbuildinfo +0 -1
- package/nodejs_cli/dist/mod.d.ts +0 -2
- package/nodejs_cli/dist/mod.js +0 -20
- package/nodejs_cli/src/mod.ts +0 -25
- package/nodejs_cli/tsconfig.tsbuildinfo +0 -1
- /package/{nodejs_cli → nodejs}/package.json +0 -0
package/core/dist/run_steps.js
CHANGED
|
@@ -1,95 +1,111 @@
|
|
|
1
1
|
const TIMEOUT_INTERVAL_MS = 10000;
|
|
2
|
-
function sleep(time) {
|
|
2
|
+
export function sleep(time) {
|
|
3
3
|
return new Promise((resolve) => {
|
|
4
4
|
setTimeout(() => {
|
|
5
5
|
resolve();
|
|
6
6
|
}, time);
|
|
7
7
|
});
|
|
8
8
|
}
|
|
9
|
-
async function
|
|
9
|
+
async function failAfterTimeout(timeoutMs) {
|
|
10
10
|
await sleep(timeoutMs);
|
|
11
11
|
return `timed out at ${performance.now()} after ${timeoutMs} ms.`;
|
|
12
12
|
}
|
|
13
|
-
async function execTest(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
logger.log(
|
|
13
|
+
async function execTest(params) {
|
|
14
|
+
const { logger, options, jrTest, test_id, collection_id, module_id } = params;
|
|
15
|
+
const test_name = jrTest.name ?? test_id.toString();
|
|
16
|
+
logger.log({
|
|
17
|
+
collection_id,
|
|
18
|
+
module_id,
|
|
19
|
+
test_id,
|
|
20
|
+
test_name,
|
|
17
21
|
type: "start_test",
|
|
18
|
-
moduleId,
|
|
19
|
-
testId,
|
|
20
|
-
});
|
|
21
|
-
const { tests, options } = testModules[moduleId];
|
|
22
|
-
const testFunc = tests[testId];
|
|
23
|
-
const startTime = performance.now();
|
|
24
|
-
const assertions = await Promise.race([
|
|
25
|
-
createTimeout(options.timeoutMs),
|
|
26
|
-
testFunc(),
|
|
27
|
-
]);
|
|
28
|
-
if (logger.cancelled)
|
|
29
|
-
return;
|
|
30
|
-
const endTime = performance.now();
|
|
31
|
-
logger.log(testModules, {
|
|
32
|
-
type: "end_test",
|
|
33
|
-
assertions,
|
|
34
|
-
endTime,
|
|
35
|
-
moduleId,
|
|
36
|
-
startTime,
|
|
37
|
-
testId,
|
|
38
22
|
});
|
|
23
|
+
let start_time = performance.now();
|
|
24
|
+
let assertions;
|
|
25
|
+
try {
|
|
26
|
+
assertions = await Promise.race([
|
|
27
|
+
failAfterTimeout(options?.timeoutMs ?? TIMEOUT_INTERVAL_MS),
|
|
28
|
+
jrTest(),
|
|
29
|
+
]);
|
|
30
|
+
let end_time = performance.now();
|
|
31
|
+
logger.log({
|
|
32
|
+
assertions,
|
|
33
|
+
collection_id,
|
|
34
|
+
start_time,
|
|
35
|
+
end_time,
|
|
36
|
+
module_id,
|
|
37
|
+
test_id,
|
|
38
|
+
type: "end_test",
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
return logger.log({
|
|
43
|
+
collection_id,
|
|
44
|
+
error: e?.toString() ?? "wild test error",
|
|
45
|
+
module_id,
|
|
46
|
+
test_id,
|
|
47
|
+
type: "test_error",
|
|
48
|
+
});
|
|
49
|
+
}
|
|
39
50
|
}
|
|
40
|
-
async function execCollection(
|
|
41
|
-
|
|
42
|
-
return;
|
|
43
|
-
const { tests } = testModules[moduleId];
|
|
51
|
+
async function execCollection(logger, testModule, collection_id, module_id) {
|
|
52
|
+
const { tests, options } = testModule;
|
|
44
53
|
const wrappedTests = [];
|
|
45
|
-
for (let [
|
|
46
|
-
wrappedTests.push(
|
|
54
|
+
for (let [test_id, jrTest] of tests.entries()) {
|
|
55
|
+
wrappedTests.push(function () {
|
|
56
|
+
return execTest({
|
|
57
|
+
logger,
|
|
58
|
+
options,
|
|
59
|
+
jrTest,
|
|
60
|
+
collection_id,
|
|
61
|
+
module_id,
|
|
62
|
+
test_id,
|
|
63
|
+
});
|
|
64
|
+
});
|
|
47
65
|
}
|
|
48
|
-
if (logger.cancelled)
|
|
49
|
-
return;
|
|
50
66
|
await Promise.all(wrappedTests);
|
|
51
67
|
}
|
|
52
|
-
async function execCollectionOrdered(
|
|
53
|
-
const { tests } =
|
|
54
|
-
for (let [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
68
|
+
async function execCollectionOrdered(logger, testModule, collection_id, module_id) {
|
|
69
|
+
const { tests, options } = testModule;
|
|
70
|
+
for (let [test_id, jrTest] of tests.entries()) {
|
|
71
|
+
await execTest({
|
|
72
|
+
logger,
|
|
73
|
+
options,
|
|
74
|
+
jrTest,
|
|
75
|
+
collection_id,
|
|
76
|
+
module_id,
|
|
77
|
+
test_id,
|
|
78
|
+
});
|
|
58
79
|
}
|
|
59
80
|
}
|
|
60
|
-
export async function
|
|
61
|
-
logger.log(
|
|
62
|
-
|
|
63
|
-
|
|
81
|
+
export async function runCollection(logger, testModules, collection_id, collection_url) {
|
|
82
|
+
logger.log({
|
|
83
|
+
collection_id,
|
|
84
|
+
collection_url,
|
|
85
|
+
expected_module_count: testModules.length,
|
|
86
|
+
type: "start_collection",
|
|
64
87
|
});
|
|
65
|
-
for (let [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
logger.log(
|
|
88
|
+
for (let [module_id, testModule] of testModules.entries()) {
|
|
89
|
+
const { options } = testModule;
|
|
90
|
+
const module_name = options?.title ?? module_id.toString();
|
|
91
|
+
logger.log({
|
|
69
92
|
type: "start_module",
|
|
70
|
-
|
|
93
|
+
module_id,
|
|
94
|
+
module_name,
|
|
95
|
+
collection_id,
|
|
96
|
+
expected_test_count: testModule.tests.length,
|
|
71
97
|
});
|
|
72
|
-
const { options } = testModule;
|
|
73
98
|
options?.runAsynchronously
|
|
74
|
-
? await execCollection(
|
|
75
|
-
: await execCollectionOrdered(
|
|
76
|
-
|
|
77
|
-
return;
|
|
78
|
-
logger.log(testModules, {
|
|
99
|
+
? await execCollection(logger, testModule, collection_id, module_id)
|
|
100
|
+
: await execCollectionOrdered(logger, testModule, collection_id, module_id);
|
|
101
|
+
logger.log({
|
|
79
102
|
type: "end_module",
|
|
80
|
-
|
|
103
|
+
collection_id,
|
|
104
|
+
module_id,
|
|
81
105
|
});
|
|
82
106
|
}
|
|
83
|
-
logger.log(
|
|
84
|
-
type: "
|
|
85
|
-
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
export function cancelRun(logger, testModules) {
|
|
89
|
-
if (logger.cancelled)
|
|
90
|
-
return;
|
|
91
|
-
logger.log(testModules, {
|
|
92
|
-
type: "cancel_run",
|
|
93
|
-
time: performance.now(),
|
|
107
|
+
logger.log({
|
|
108
|
+
type: "end_collection",
|
|
109
|
+
collection_id,
|
|
94
110
|
});
|
|
95
111
|
}
|
|
@@ -2,74 +2,118 @@ interface Stringable {
|
|
|
2
2
|
toString: Object["toString"];
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
export type Assertions = Stringable | Stringable[] | undefined;
|
|
5
|
+
export type Assertions = Stringable | Stringable[] | undefined | null;
|
|
6
6
|
|
|
7
7
|
type SyncTest = () => Assertions;
|
|
8
8
|
type AsyncTest = () => Promise<Assertions>;
|
|
9
9
|
export type Test = SyncTest | AsyncTest;
|
|
10
10
|
|
|
11
|
-
export interface
|
|
11
|
+
export interface TestOptions {
|
|
12
12
|
runAsynchronously?: boolean;
|
|
13
13
|
timeoutMs?: number;
|
|
14
14
|
title?: string;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface TestModule {
|
|
18
|
+
options?: TestOptions;
|
|
18
19
|
tests: Test[];
|
|
19
|
-
options: Options;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
interface StartRun {
|
|
23
|
-
|
|
22
|
+
export interface StartRun {
|
|
23
|
+
expected_collection_count: number;
|
|
24
24
|
time: number;
|
|
25
|
+
type: "start_run";
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
interface EndRun {
|
|
28
|
-
type: "end_run";
|
|
28
|
+
export interface EndRun {
|
|
29
29
|
time: number;
|
|
30
|
+
type: "end_run";
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
interface
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
export interface RunError {
|
|
34
|
+
error: string;
|
|
35
|
+
type: "run_error";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface StartTestCollection {
|
|
39
|
+
collection_id: number;
|
|
40
|
+
collection_url: string;
|
|
41
|
+
expected_module_count: number;
|
|
42
|
+
type: "start_collection";
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface EndTestCollection {
|
|
46
|
+
collection_id: number;
|
|
47
|
+
type: "end_collection";
|
|
35
48
|
}
|
|
36
49
|
|
|
37
|
-
interface
|
|
50
|
+
export interface TestCollectionError {
|
|
51
|
+
collection_id: number;
|
|
52
|
+
error: string;
|
|
53
|
+
type: "collection_error";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface StartModule {
|
|
57
|
+
collection_id: number;
|
|
58
|
+
expected_test_count: number;
|
|
59
|
+
module_id: number;
|
|
60
|
+
module_name: string;
|
|
38
61
|
type: "start_module";
|
|
39
|
-
moduleId: number;
|
|
40
62
|
}
|
|
41
63
|
|
|
42
|
-
interface EndModule {
|
|
64
|
+
export interface EndModule {
|
|
65
|
+
collection_id: number;
|
|
66
|
+
module_id: number;
|
|
43
67
|
type: "end_module";
|
|
44
|
-
moduleId: number;
|
|
45
68
|
}
|
|
46
69
|
|
|
47
|
-
interface
|
|
70
|
+
export interface ModuleError {
|
|
71
|
+
collection_id: number;
|
|
72
|
+
error: string;
|
|
73
|
+
module_id: number;
|
|
74
|
+
type: "module_error";
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface StartTest {
|
|
78
|
+
collection_id: number;
|
|
79
|
+
module_id: number;
|
|
80
|
+
test_id: number;
|
|
81
|
+
test_name: string;
|
|
48
82
|
type: "start_test";
|
|
49
|
-
testId: number;
|
|
50
|
-
moduleId: number;
|
|
51
83
|
}
|
|
52
84
|
|
|
53
|
-
interface EndTest {
|
|
54
|
-
type: "end_test";
|
|
55
|
-
testId: number;
|
|
56
|
-
moduleId: number;
|
|
57
|
-
startTime: number;
|
|
58
|
-
endTime: number;
|
|
85
|
+
export interface EndTest {
|
|
59
86
|
assertions: Assertions;
|
|
87
|
+
collection_id: number;
|
|
88
|
+
module_id: number;
|
|
89
|
+
test_id: number;
|
|
90
|
+
start_time: number;
|
|
91
|
+
end_time: number;
|
|
92
|
+
type: "end_test";
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface TestError {
|
|
96
|
+
collection_id: number;
|
|
97
|
+
error: string;
|
|
98
|
+
module_id: number;
|
|
99
|
+
test_id: number;
|
|
100
|
+
type: "test_error";
|
|
60
101
|
}
|
|
61
102
|
|
|
62
103
|
export type LoggerAction =
|
|
63
104
|
| StartRun
|
|
64
105
|
| EndRun
|
|
65
|
-
|
|
|
106
|
+
| RunError
|
|
107
|
+
| StartTestCollection
|
|
108
|
+
| EndTestCollection
|
|
109
|
+
| TestCollectionError
|
|
66
110
|
| StartModule
|
|
111
|
+
| ModuleError
|
|
67
112
|
| EndModule
|
|
68
113
|
| StartTest
|
|
69
|
-
| EndTest
|
|
114
|
+
| EndTest
|
|
115
|
+
| TestError;
|
|
70
116
|
|
|
71
117
|
export interface LoggerInterface {
|
|
72
|
-
|
|
73
|
-
readonly cancelled: boolean;
|
|
74
|
-
log(testModules: TestModule[], action: LoggerAction): void;
|
|
118
|
+
log(action: LoggerAction): void;
|
|
75
119
|
}
|
package/core/src/mod.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
export type
|
|
2
|
-
LoggerAction,
|
|
3
|
-
LoggerInterface,
|
|
4
|
-
Test,
|
|
5
|
-
Options,
|
|
6
|
-
TestModule,
|
|
7
|
-
} from "./jackrabbit_types.ts";
|
|
1
|
+
export type * from "./jackrabbit_types.ts";
|
|
8
2
|
|
|
9
|
-
export {
|
|
3
|
+
export { runCollection, sleep } from "./run_steps.js";
|
package/core/src/run_steps.ts
CHANGED
|
@@ -2,11 +2,22 @@ import type {
|
|
|
2
2
|
Assertions,
|
|
3
3
|
LoggerInterface,
|
|
4
4
|
TestModule,
|
|
5
|
+
Test,
|
|
6
|
+
TestOptions,
|
|
5
7
|
} from "./jackrabbit_types.ts";
|
|
6
8
|
|
|
9
|
+
interface ExecTestParams {
|
|
10
|
+
logger: LoggerInterface;
|
|
11
|
+
options: TestOptions | undefined;
|
|
12
|
+
jrTest: Test;
|
|
13
|
+
collection_id: number;
|
|
14
|
+
module_id: number;
|
|
15
|
+
test_id: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
7
18
|
const TIMEOUT_INTERVAL_MS = 10000;
|
|
8
19
|
|
|
9
|
-
function sleep(time: number): Promise<void> {
|
|
20
|
+
export function sleep(time: number): Promise<void> {
|
|
10
21
|
return new Promise((resolve) => {
|
|
11
22
|
setTimeout(() => {
|
|
12
23
|
resolve();
|
|
@@ -14,125 +25,145 @@ function sleep(time: number): Promise<void> {
|
|
|
14
25
|
});
|
|
15
26
|
}
|
|
16
27
|
|
|
17
|
-
async function
|
|
18
|
-
timeoutMs: number = TIMEOUT_INTERVAL_MS,
|
|
19
|
-
): Promise<Assertions> {
|
|
28
|
+
async function failAfterTimeout(timeoutMs: number): Promise<Assertions> {
|
|
20
29
|
await sleep(timeoutMs);
|
|
21
30
|
|
|
22
31
|
return `timed out at ${performance.now()} after ${timeoutMs} ms.`;
|
|
23
32
|
}
|
|
24
33
|
|
|
25
|
-
async function execTest(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
testId: number,
|
|
30
|
-
) {
|
|
31
|
-
if (logger.cancelled) return;
|
|
34
|
+
async function execTest(params: ExecTestParams) {
|
|
35
|
+
const { logger, options, jrTest, test_id, collection_id, module_id } = params;
|
|
36
|
+
|
|
37
|
+
const test_name = jrTest.name ?? test_id.toString();
|
|
32
38
|
|
|
33
|
-
logger.log(
|
|
39
|
+
logger.log({
|
|
40
|
+
collection_id,
|
|
41
|
+
module_id,
|
|
42
|
+
test_id,
|
|
43
|
+
test_name,
|
|
34
44
|
type: "start_test",
|
|
35
|
-
moduleId,
|
|
36
|
-
testId,
|
|
37
45
|
});
|
|
38
46
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
})
|
|
47
|
+
let start_time = performance.now();
|
|
48
|
+
|
|
49
|
+
let assertions: Assertions;
|
|
50
|
+
try {
|
|
51
|
+
assertions = await Promise.race([
|
|
52
|
+
failAfterTimeout(options?.timeoutMs ?? TIMEOUT_INTERVAL_MS),
|
|
53
|
+
jrTest(),
|
|
54
|
+
]);
|
|
55
|
+
|
|
56
|
+
let end_time = performance.now();
|
|
57
|
+
|
|
58
|
+
logger.log({
|
|
59
|
+
assertions,
|
|
60
|
+
collection_id,
|
|
61
|
+
start_time,
|
|
62
|
+
end_time,
|
|
63
|
+
module_id,
|
|
64
|
+
test_id,
|
|
65
|
+
type: "end_test",
|
|
66
|
+
});
|
|
67
|
+
} catch (e: unknown) {
|
|
68
|
+
return logger.log({
|
|
69
|
+
collection_id,
|
|
70
|
+
error: e?.toString() ?? "wild test error",
|
|
71
|
+
module_id,
|
|
72
|
+
test_id,
|
|
73
|
+
type: "test_error",
|
|
74
|
+
});
|
|
75
|
+
}
|
|
60
76
|
}
|
|
61
77
|
|
|
62
78
|
async function execCollection(
|
|
63
|
-
testModules: TestModule[],
|
|
64
79
|
logger: LoggerInterface,
|
|
65
|
-
|
|
80
|
+
testModule: TestModule,
|
|
81
|
+
collection_id: number,
|
|
82
|
+
module_id: number,
|
|
66
83
|
) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const { tests } = testModules[moduleId];
|
|
84
|
+
const { tests, options } = testModule;
|
|
70
85
|
|
|
71
86
|
const wrappedTests = [];
|
|
72
|
-
for (let [
|
|
73
|
-
wrappedTests.push(
|
|
87
|
+
for (let [test_id, jrTest] of tests.entries()) {
|
|
88
|
+
wrappedTests.push(function () {
|
|
89
|
+
return execTest({
|
|
90
|
+
logger,
|
|
91
|
+
options,
|
|
92
|
+
jrTest,
|
|
93
|
+
collection_id,
|
|
94
|
+
module_id,
|
|
95
|
+
test_id,
|
|
96
|
+
});
|
|
97
|
+
});
|
|
74
98
|
}
|
|
75
99
|
|
|
76
|
-
if (logger.cancelled) return;
|
|
77
|
-
|
|
78
100
|
await Promise.all(wrappedTests);
|
|
79
101
|
}
|
|
80
102
|
|
|
81
103
|
async function execCollectionOrdered(
|
|
82
|
-
testModules: TestModule[],
|
|
83
104
|
logger: LoggerInterface,
|
|
84
|
-
|
|
105
|
+
testModule: TestModule,
|
|
106
|
+
collection_id: number,
|
|
107
|
+
module_id: number,
|
|
85
108
|
) {
|
|
86
|
-
const { tests } =
|
|
87
|
-
|
|
88
|
-
for (let [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
109
|
+
const { tests, options } = testModule;
|
|
110
|
+
|
|
111
|
+
for (let [test_id, jrTest] of tests.entries()) {
|
|
112
|
+
await execTest({
|
|
113
|
+
logger,
|
|
114
|
+
options,
|
|
115
|
+
jrTest,
|
|
116
|
+
collection_id,
|
|
117
|
+
module_id,
|
|
118
|
+
test_id,
|
|
119
|
+
});
|
|
92
120
|
}
|
|
93
121
|
}
|
|
94
122
|
|
|
95
|
-
export async function
|
|
123
|
+
export async function runCollection(
|
|
96
124
|
logger: LoggerInterface,
|
|
97
125
|
testModules: TestModule[],
|
|
126
|
+
collection_id: number,
|
|
127
|
+
collection_url: string,
|
|
98
128
|
) {
|
|
99
|
-
logger.log(
|
|
100
|
-
|
|
101
|
-
|
|
129
|
+
logger.log({
|
|
130
|
+
collection_id,
|
|
131
|
+
collection_url,
|
|
132
|
+
expected_module_count: testModules.length,
|
|
133
|
+
type: "start_collection",
|
|
102
134
|
});
|
|
103
135
|
|
|
104
|
-
for (let [
|
|
105
|
-
|
|
136
|
+
for (let [module_id, testModule] of testModules.entries()) {
|
|
137
|
+
const { options } = testModule;
|
|
138
|
+
|
|
139
|
+
const module_name = options?.title ?? module_id.toString();
|
|
106
140
|
|
|
107
|
-
logger.log(
|
|
141
|
+
logger.log({
|
|
108
142
|
type: "start_module",
|
|
109
|
-
|
|
143
|
+
module_id,
|
|
144
|
+
module_name,
|
|
145
|
+
collection_id,
|
|
146
|
+
expected_test_count: testModule.tests.length,
|
|
110
147
|
});
|
|
111
148
|
|
|
112
|
-
const { options } = testModule;
|
|
113
149
|
options?.runAsynchronously
|
|
114
|
-
? await execCollection(
|
|
115
|
-
: await execCollectionOrdered(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
150
|
+
? await execCollection(logger, testModule, collection_id, module_id)
|
|
151
|
+
: await execCollectionOrdered(
|
|
152
|
+
logger,
|
|
153
|
+
testModule,
|
|
154
|
+
collection_id,
|
|
155
|
+
module_id,
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
logger.log({
|
|
120
159
|
type: "end_module",
|
|
121
|
-
|
|
160
|
+
collection_id,
|
|
161
|
+
module_id,
|
|
122
162
|
});
|
|
123
163
|
}
|
|
124
164
|
|
|
125
|
-
logger.log(
|
|
126
|
-
type: "
|
|
127
|
-
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export function cancelRun(logger: LoggerInterface, testModules: TestModule[]) {
|
|
132
|
-
if (logger.cancelled) return;
|
|
133
|
-
|
|
134
|
-
logger.log(testModules, {
|
|
135
|
-
type: "cancel_run",
|
|
136
|
-
time: performance.now(),
|
|
165
|
+
logger.log({
|
|
166
|
+
type: "end_collection",
|
|
167
|
+
collection_id,
|
|
137
168
|
});
|
|
138
169
|
}
|