@w-lfpup/jackrabbit 0.2.0 → 0.3.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/.github/workflows/browsers.json +45 -0
- package/.github/workflows/browsers.macos.json +51 -0
- package/.github/workflows/browsers.windows.json +19 -0
- package/.github/workflows/tests.yml +24 -0
- package/README.md +41 -1
- package/browser/dist/logger.js +43 -0
- package/browser/dist/mod.js +26 -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 +161 -0
- package/nodejs/dist/mod.js +31 -0
- package/nodejs/dist/results.js +139 -0
- package/nodejs/dist/results_str.js +147 -0
- package/nodejs/dist/runner.js +17 -0
- package/nodejs/src/logger.ts +193 -0
- package/nodejs/src/mod.ts +37 -0
- package/nodejs/src/results_str.ts +234 -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 -13
- package/tests/dist/test_error.test.d.ts +9 -0
- package/tests/dist/test_error.test.js +27 -0
- package/tests/dist/test_errors.test.d.ts +9 -0
- package/tests/dist/test_errors.test.js +27 -0
- package/tests/dist/test_logger.d.ts +3 -2
- package/tests/dist/test_logger.js +5 -1
- 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 +1 -1
- package/webdriver/dist/config.js +57 -0
- package/webdriver/dist/eventbus.js +18 -0
- package/webdriver/dist/listeners.js +21 -0
- package/webdriver/dist/logger.js +203 -0
- package/webdriver/dist/mod.js +36 -0
- package/webdriver/dist/results_str.js +167 -0
- package/webdriver/dist/routes.js +172 -0
- package/webdriver/dist/routes2.js +163 -0
- package/webdriver/dist/test_hangar.js +20 -0
- package/webdriver/dist/webdriver.js +273 -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 +43 -0
- package/webdriver/src/results.ts +56 -0
- package/webdriver/src/results_str.ts +222 -0
- package/webdriver/src/routes.ts +211 -0
- package/webdriver/src/test_hangar.ts +25 -0
- package/webdriver/src/webdriver.ts +372 -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/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/{cli/dist/cli_types.js → webdriver/dist/results.js} +0 -0
package/cli/dist/logger.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
export class Logger {
|
|
2
|
-
#assertions = new Map();
|
|
3
|
-
#data = {
|
|
4
|
-
cancelled: false,
|
|
5
|
-
failed: false,
|
|
6
|
-
startTime: -1,
|
|
7
|
-
testTime: 0,
|
|
8
|
-
};
|
|
9
|
-
get failed() {
|
|
10
|
-
return this.#data.failed;
|
|
11
|
-
}
|
|
12
|
-
get cancelled() {
|
|
13
|
-
return this.#data.cancelled;
|
|
14
|
-
}
|
|
15
|
-
log(testModules, action) {
|
|
16
|
-
if ("start_run" === action.type) {
|
|
17
|
-
this.#data.startTime = action.time;
|
|
18
|
-
}
|
|
19
|
-
if ("cancel_run" === action.type) {
|
|
20
|
-
this.#data.cancelled = true;
|
|
21
|
-
logAssertions(testModules, this.#assertions);
|
|
22
|
-
logResults(this.#data, action.time);
|
|
23
|
-
}
|
|
24
|
-
// add to fails
|
|
25
|
-
if ("end_test" === action.type && action?.assertions) {
|
|
26
|
-
if (Array.isArray(action.assertions) && action.assertions.length === 0)
|
|
27
|
-
return;
|
|
28
|
-
this.#data.testTime += action.endTime - action.startTime;
|
|
29
|
-
this.#data.failed = true;
|
|
30
|
-
let assertions = this.#assertions.get(action.moduleId);
|
|
31
|
-
if (assertions) {
|
|
32
|
-
assertions.set(action.testId, action);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
this.#assertions.set(action.moduleId, new Map([[action.testId, action]]));
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
if ("end_run" === action.type) {
|
|
39
|
-
logAssertions(testModules, this.#assertions);
|
|
40
|
-
logResults(this.#data, action.time);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function logAssertions(testModules, fails) {
|
|
45
|
-
for (let [moduleID, module] of testModules.entries()) {
|
|
46
|
-
let failedTests = fails.get(moduleID);
|
|
47
|
-
if (undefined === failedTests)
|
|
48
|
-
continue;
|
|
49
|
-
const { tests, options } = module;
|
|
50
|
-
console.log(`${options?.title ?? `module index: ${moduleID}`}`);
|
|
51
|
-
let numFailedTests = fails.get(moduleID)?.size ?? 0;
|
|
52
|
-
console.log(`${numFailedTests}/${tests.length} tests failed`);
|
|
53
|
-
for (let [index, test] of tests.entries()) {
|
|
54
|
-
let action = failedTests.get(index);
|
|
55
|
-
if (!action || action.type !== "end_test")
|
|
56
|
-
continue;
|
|
57
|
-
console.log(`\t${test.name}\n\t\t${action.assertions}`);
|
|
58
|
-
}
|
|
59
|
-
console.log("\n");
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function logResults(data, time) {
|
|
63
|
-
let status_with_color = data.failed
|
|
64
|
-
? yellow("\u{2717} failed")
|
|
65
|
-
: blue("\u{2714} passed");
|
|
66
|
-
if (data.cancelled) {
|
|
67
|
-
status_with_color = gray("\u{2717} cancelled");
|
|
68
|
-
}
|
|
69
|
-
const overhead = time - data.startTime;
|
|
70
|
-
console.log(`Results:
|
|
71
|
-
${status_with_color}
|
|
72
|
-
duration: ${data.testTime.toFixed(4)} mS
|
|
73
|
-
overhead: ${overhead.toFixed(4)} mS`);
|
|
74
|
-
}
|
|
75
|
-
// 39 - default foreground color
|
|
76
|
-
// 49 - default background color
|
|
77
|
-
function blue(text) {
|
|
78
|
-
return `\x1b[44m\x1b[97m${text}\x1b[0m`;
|
|
79
|
-
}
|
|
80
|
-
function yellow(text) {
|
|
81
|
-
return `\x1b[43m\x1b[97m${text}\x1b[0m`;
|
|
82
|
-
}
|
|
83
|
-
function gray(text) {
|
|
84
|
-
return `\x1b[100m\x1b[97m${text}\x1b[0m`;
|
|
85
|
-
}
|
|
86
|
-
function logTestModule(moduleID, title) {
|
|
87
|
-
console.log(`module: ${title ?? `module index: ${moduleID}`}`);
|
|
88
|
-
}
|
package/cli/dist/mod.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export type { ConfigInterface } from "./cli_types.ts";
|
|
2
|
-
export type { ImporterInterface } from "./cli_types.ts";
|
|
3
|
-
export { Config } from "./config.js";
|
|
4
|
-
export { Importer } from "./importer.js";
|
|
5
|
-
export { Logger } from "./logger.js";
|
|
6
|
-
export { run } from "./cli.js";
|
package/cli/dist/mod.js
DELETED
package/cli/src/cli.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ConfigInterface, ImporterInterface } from "./cli_types.ts";
|
|
2
|
-
import type { LoggerInterface } from "../../core/dist/mod.ts";
|
|
3
|
-
|
|
4
|
-
import { startRun } from "../../core/dist/mod.js";
|
|
5
|
-
import { Logger } from "./logger.js";
|
|
6
|
-
|
|
7
|
-
export async function run(
|
|
8
|
-
config: ConfigInterface,
|
|
9
|
-
importer: ImporterInterface,
|
|
10
|
-
logger: LoggerInterface = new Logger(),
|
|
11
|
-
) {
|
|
12
|
-
for (const file of config.files) {
|
|
13
|
-
const testModules = await importer.load(file);
|
|
14
|
-
|
|
15
|
-
await startRun(logger, testModules);
|
|
16
|
-
}
|
|
17
|
-
}
|
package/cli/src/cli_types.ts
DELETED
package/cli/src/config.ts
DELETED
package/cli/src/importer.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { TestModule } from "../../core/dist/mod.ts";
|
|
2
|
-
import type { ImporterInterface } from "./cli_types.ts";
|
|
3
|
-
|
|
4
|
-
export class Importer implements ImporterInterface {
|
|
5
|
-
#cwd: string;
|
|
6
|
-
|
|
7
|
-
constructor(cwd: string) {
|
|
8
|
-
this.#cwd = cwd;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
async load(uri: string): Promise<TestModule[]> {
|
|
12
|
-
let uri_updated = uri;
|
|
13
|
-
|
|
14
|
-
let absolute = uri.startsWith("/");
|
|
15
|
-
if (!absolute) {
|
|
16
|
-
uri_updated = this.#cwd + "/" + uri;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const { testModules } = await import(uri_updated);
|
|
20
|
-
|
|
21
|
-
// verify here
|
|
22
|
-
|
|
23
|
-
return testModules;
|
|
24
|
-
}
|
|
25
|
-
}
|
package/cli/src/logger.ts
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
LoggerAction,
|
|
3
|
-
LoggerInterface,
|
|
4
|
-
TestModule,
|
|
5
|
-
} from "../../core/dist/mod.js";
|
|
6
|
-
|
|
7
|
-
interface LoggerData {
|
|
8
|
-
cancelled: boolean;
|
|
9
|
-
failed: boolean;
|
|
10
|
-
startTime: number;
|
|
11
|
-
testTime: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class Logger implements LoggerInterface {
|
|
15
|
-
#assertions: Map<number, Map<number, LoggerAction>> = new Map();
|
|
16
|
-
#data: LoggerData = {
|
|
17
|
-
cancelled: false,
|
|
18
|
-
failed: false,
|
|
19
|
-
startTime: -1,
|
|
20
|
-
testTime: 0,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
get failed() {
|
|
24
|
-
return this.#data.failed;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
get cancelled() {
|
|
28
|
-
return this.#data.cancelled;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
log(testModules: TestModule[], action: LoggerAction) {
|
|
32
|
-
if ("start_run" === action.type) {
|
|
33
|
-
this.#data.startTime = action.time;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if ("cancel_run" === action.type) {
|
|
37
|
-
this.#data.cancelled = true;
|
|
38
|
-
logAssertions(testModules, this.#assertions);
|
|
39
|
-
logResults(this.#data, action.time);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// add to fails
|
|
43
|
-
if ("end_test" === action.type && action?.assertions) {
|
|
44
|
-
if (Array.isArray(action.assertions) && action.assertions.length === 0)
|
|
45
|
-
return;
|
|
46
|
-
|
|
47
|
-
this.#data.testTime += action.endTime - action.startTime;
|
|
48
|
-
this.#data.failed = true;
|
|
49
|
-
|
|
50
|
-
let assertions = this.#assertions.get(action.moduleId);
|
|
51
|
-
if (assertions) {
|
|
52
|
-
assertions.set(action.testId, action);
|
|
53
|
-
} else {
|
|
54
|
-
this.#assertions.set(
|
|
55
|
-
action.moduleId,
|
|
56
|
-
new Map([[action.testId, action]]),
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if ("end_run" === action.type) {
|
|
62
|
-
logAssertions(testModules, this.#assertions);
|
|
63
|
-
logResults(this.#data, action.time);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function logAssertions(
|
|
69
|
-
testModules: TestModule[],
|
|
70
|
-
fails: Map<number, Map<number, LoggerAction>>,
|
|
71
|
-
) {
|
|
72
|
-
for (let [moduleID, module] of testModules.entries()) {
|
|
73
|
-
let failedTests = fails.get(moduleID);
|
|
74
|
-
if (undefined === failedTests) continue;
|
|
75
|
-
|
|
76
|
-
const { tests, options } = module;
|
|
77
|
-
|
|
78
|
-
console.log(`${options?.title ?? `module index: ${moduleID}`}`);
|
|
79
|
-
|
|
80
|
-
let numFailedTests = fails.get(moduleID)?.size ?? 0;
|
|
81
|
-
console.log(`${numFailedTests}/${tests.length} tests failed`);
|
|
82
|
-
|
|
83
|
-
for (let [index, test] of tests.entries()) {
|
|
84
|
-
let action = failedTests.get(index);
|
|
85
|
-
if (!action || action.type !== "end_test") continue;
|
|
86
|
-
|
|
87
|
-
console.log(`\t${test.name}\n\t\t${action.assertions}`);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
console.log("\n");
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function logResults(data: LoggerData, time: number) {
|
|
95
|
-
let status_with_color = data.failed
|
|
96
|
-
? yellow("\u{2717} failed")
|
|
97
|
-
: blue("\u{2714} passed");
|
|
98
|
-
|
|
99
|
-
if (data.cancelled) {
|
|
100
|
-
status_with_color = gray("\u{2717} cancelled");
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const overhead = time - data.startTime;
|
|
104
|
-
console.log(`Results:
|
|
105
|
-
${status_with_color}
|
|
106
|
-
duration: ${data.testTime.toFixed(4)} mS
|
|
107
|
-
overhead: ${overhead.toFixed(4)} mS`);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// 39 - default foreground color
|
|
111
|
-
// 49 - default background color
|
|
112
|
-
function blue(text: string) {
|
|
113
|
-
return `\x1b[44m\x1b[97m${text}\x1b[0m`;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function yellow(text: string) {
|
|
117
|
-
return `\x1b[43m\x1b[97m${text}\x1b[0m`;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function gray(text: string) {
|
|
121
|
-
return `\x1b[100m\x1b[97m${text}\x1b[0m`;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function logTestModule(moduleID: number, title?: string) {
|
|
125
|
-
console.log(`module: ${title ?? `module index: ${moduleID}`}`);
|
|
126
|
-
}
|
package/cli/src/mod.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type { ConfigInterface } from "./cli_types.ts";
|
|
2
|
-
export type { ImporterInterface } from "./cli_types.ts";
|
|
3
|
-
|
|
4
|
-
export { Config } from "./config.js";
|
|
5
|
-
export { Importer } from "./importer.js";
|
|
6
|
-
export { Logger } from "./logger.js";
|
|
7
|
-
export { run } from "./cli.js";
|
package/cli/tsconfig.tsbuildinfo
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"root":["./src/cli.ts","./src/cli_types.ts","./src/config.ts","./src/importer.ts","./src/logger.ts","./src/mod.ts"],"version":"5.9.3"}
|
package/nodejs_cli/dist/mod.d.ts
DELETED
package/nodejs_cli/dist/mod.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { Config, Importer, Logger, run } from "../../cli/dist/mod.js";
|
|
3
|
-
const config = new Config(process.argv.slice(2));
|
|
4
|
-
const importer = new Importer(process.cwd());
|
|
5
|
-
const logger = new Logger();
|
|
6
|
-
let errored = false;
|
|
7
|
-
try {
|
|
8
|
-
await run(config, importer, logger);
|
|
9
|
-
}
|
|
10
|
-
catch (e) {
|
|
11
|
-
errored = true;
|
|
12
|
-
console.log("Error:");
|
|
13
|
-
e instanceof Error
|
|
14
|
-
? console.log(`
|
|
15
|
-
${e.name}
|
|
16
|
-
${e.message}
|
|
17
|
-
${e.stack}`)
|
|
18
|
-
: console.log(e);
|
|
19
|
-
}
|
|
20
|
-
logger.failed || errored ? process.exit(1) : process.exit(0);
|
package/nodejs_cli/src/mod.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { Config, Importer, Logger, run } from "../../cli/dist/mod.js";
|
|
4
|
-
|
|
5
|
-
const config = new Config(process.argv.slice(2));
|
|
6
|
-
const importer = new Importer(process.cwd());
|
|
7
|
-
const logger = new Logger();
|
|
8
|
-
|
|
9
|
-
let errored = false;
|
|
10
|
-
|
|
11
|
-
try {
|
|
12
|
-
await run(config, importer, logger);
|
|
13
|
-
} catch (e: unknown) {
|
|
14
|
-
errored = true;
|
|
15
|
-
console.log("Error:");
|
|
16
|
-
|
|
17
|
-
e instanceof Error
|
|
18
|
-
? console.log(`
|
|
19
|
-
${e.name}
|
|
20
|
-
${e.message}
|
|
21
|
-
${e.stack}`)
|
|
22
|
-
: console.log(e);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
logger.failed || errored ? process.exit(1) : process.exit(0);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"root":["./src/mod.ts"],"version":"5.9.3"}
|
|
File without changes
|
|
File without changes
|