@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/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
|