@w-lfpup/jackrabbit 0.1.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/build_and_test.yml +18 -0
- package/.prettierignore +3 -0
- package/.prettierrc +5 -0
- package/LICENSE +29 -0
- package/README.md +33 -0
- package/cli/dist/cli.d.ts +3 -0
- package/cli/dist/cli.js +8 -0
- package/cli/dist/cli_types.d.ts +7 -0
- package/cli/dist/cli_types.js +1 -0
- package/cli/dist/config.d.ts +5 -0
- package/cli/dist/config.js +27 -0
- package/cli/dist/importer.d.ts +7 -0
- package/cli/dist/importer.js +16 -0
- package/cli/dist/logger.d.ts +7 -0
- package/cli/dist/logger.js +88 -0
- package/cli/dist/mod.d.ts +6 -0
- package/cli/dist/mod.js +4 -0
- package/cli/package.json +8 -0
- package/cli/src/cli.ts +17 -0
- package/cli/src/cli_types.ts +9 -0
- package/cli/src/config.ts +36 -0
- package/cli/src/importer.ts +25 -0
- package/cli/src/logger.ts +126 -0
- package/cli/src/mod.ts +7 -0
- package/cli/tsconfig.json +7 -0
- package/cli/tsconfig.tsbuildinfo +1 -0
- package/core/dist/jackrabbit_types.d.ts +56 -0
- package/core/dist/jackrabbit_types.js +1 -0
- package/core/dist/mod.d.ts +2 -0
- package/core/dist/mod.js +1 -0
- package/core/dist/run_steps.d.ts +3 -0
- package/core/dist/run_steps.js +95 -0
- package/core/package.json +8 -0
- package/core/src/jackrabbit_types.ts +75 -0
- package/core/src/mod.ts +9 -0
- package/core/src/run_steps.ts +138 -0
- package/core/tsconfig.json +7 -0
- package/core/tsconfig.tsbuildinfo +1 -0
- package/examples/hello_world/goodbye_world.ts +15 -0
- package/examples/hello_world/hello_world.ts +9 -0
- package/examples/hello_world/mod.ts +4 -0
- package/examples/package.json +3 -0
- package/nodejs_cli/dist/mod.d.ts +2 -0
- package/nodejs_cli/dist/mod.js +20 -0
- package/nodejs_cli/package.json +8 -0
- package/nodejs_cli/src/mod.ts +25 -0
- package/nodejs_cli/tsconfig.json +7 -0
- package/nodejs_cli/tsconfig.tsbuildinfo +1 -0
- package/package.json +29 -0
- package/test_guide.md +114 -0
- package/tests/dist/mod.d.ts +9 -0
- package/tests/dist/mod.js +30 -0
- package/tests/dist/test_fail.test.d.ts +9 -0
- package/tests/dist/test_fail.test.js +23 -0
- package/tests/dist/test_logger.d.ts +7 -0
- package/tests/dist/test_logger.js +19 -0
- package/tests/dist/test_pass.test.d.ts +9 -0
- package/tests/dist/test_pass.test.js +23 -0
- package/tests/package.json +8 -0
- package/tests/src/mod.ts +39 -0
- package/tests/src/test_fail.test.ts +28 -0
- package/tests/src/test_logger.ts +28 -0
- package/tests/src/test_pass.test.ts +28 -0
- package/tests/tsconfig.json +7 -0
- package/tests/tsconfig.tsbuildinfo +1 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class TestLogger {
|
|
2
|
+
cancelled = false;
|
|
3
|
+
failed = false;
|
|
4
|
+
log(_testModule, action) {
|
|
5
|
+
if (hasTestFailed(action)) {
|
|
6
|
+
this.failed = true;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function hasTestFailed(action) {
|
|
11
|
+
if ("end_test" !== action.type)
|
|
12
|
+
return false;
|
|
13
|
+
if (action.assertions === undefined)
|
|
14
|
+
return false;
|
|
15
|
+
if (Array.isArray(action.assertions) && action.assertions.length === 0)
|
|
16
|
+
return false;
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
export { TestLogger };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare function testStuffAndPass(): undefined;
|
|
2
|
+
declare function testMoreStuffAndPass(): never[];
|
|
3
|
+
declare function testStuffAndPassAsync(): Promise<undefined>;
|
|
4
|
+
declare function testMoreStuffAndPassAsync(): Promise<string[]>;
|
|
5
|
+
export declare const tests: (typeof testStuffAndPass | typeof testMoreStuffAndPass | typeof testStuffAndPassAsync | typeof testMoreStuffAndPassAsync)[];
|
|
6
|
+
export declare const options: {
|
|
7
|
+
title: string;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function testStuffAndPass() {
|
|
2
|
+
return;
|
|
3
|
+
}
|
|
4
|
+
function testMoreStuffAndPass() {
|
|
5
|
+
return [];
|
|
6
|
+
}
|
|
7
|
+
async function testStuffAndPassAsync() {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
async function testMoreStuffAndPassAsync() {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
// export tests
|
|
14
|
+
export const tests = [
|
|
15
|
+
testStuffAndPass,
|
|
16
|
+
testMoreStuffAndPass,
|
|
17
|
+
testStuffAndPassAsync,
|
|
18
|
+
testMoreStuffAndPassAsync,
|
|
19
|
+
];
|
|
20
|
+
// export optional test details
|
|
21
|
+
export const options = {
|
|
22
|
+
title: import.meta.url,
|
|
23
|
+
};
|
package/tests/src/mod.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as FailTests from "./test_fail.test.js";
|
|
2
|
+
import * as PassTests from "./test_pass.test.js";
|
|
3
|
+
|
|
4
|
+
import { startRun } from "../../core/dist/mod.js";
|
|
5
|
+
import { TestLogger } from "./test_logger.js";
|
|
6
|
+
|
|
7
|
+
// Test pass and fail behavior
|
|
8
|
+
|
|
9
|
+
const failTestModules = [FailTests];
|
|
10
|
+
const passTestModules = [PassTests];
|
|
11
|
+
|
|
12
|
+
// jackrabbit test run won't pass failing tests
|
|
13
|
+
async function testsFail() {
|
|
14
|
+
let logger = new TestLogger();
|
|
15
|
+
await startRun(logger, failTestModules);
|
|
16
|
+
|
|
17
|
+
if (!logger.failed) return "fail tests failed to fail";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// jackrabbit test run won't fail passing tests
|
|
21
|
+
async function testsPass() {
|
|
22
|
+
let logger = new TestLogger();
|
|
23
|
+
await startRun(logger, passTestModules);
|
|
24
|
+
|
|
25
|
+
if (logger.failed) return "passing tests failed to pass";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const tests = [testsFail, testsPass];
|
|
29
|
+
|
|
30
|
+
const options = {
|
|
31
|
+
title: "Failures and Successes",
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const testModule = {
|
|
35
|
+
tests,
|
|
36
|
+
options,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const testModules = [testModule];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function testStuffAndFail() {
|
|
2
|
+
return "this test failed!";
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
function testMoreStuffAndFail() {
|
|
6
|
+
return ["this test also failed!"];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async function testStuffAndFailAsync() {
|
|
10
|
+
return "this test failed!";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async function testMoreStuffAndFailAsync() {
|
|
14
|
+
return ["this test also failed!"];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// export tests
|
|
18
|
+
export const tests = [
|
|
19
|
+
testStuffAndFail,
|
|
20
|
+
testMoreStuffAndFail,
|
|
21
|
+
testStuffAndFailAsync,
|
|
22
|
+
testMoreStuffAndFailAsync,
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
// export optional test details
|
|
26
|
+
export const options = {
|
|
27
|
+
title: import.meta.url,
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
LoggerAction,
|
|
3
|
+
LoggerInterface,
|
|
4
|
+
TestModule,
|
|
5
|
+
} from "../../core/dist/mod.ts";
|
|
6
|
+
|
|
7
|
+
class TestLogger implements LoggerInterface {
|
|
8
|
+
cancelled: boolean = false;
|
|
9
|
+
failed: boolean = false;
|
|
10
|
+
|
|
11
|
+
log(_testModule: TestModule[], action: LoggerAction) {
|
|
12
|
+
if (hasTestFailed(action)) {
|
|
13
|
+
this.failed = true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function hasTestFailed(action: LoggerAction) {
|
|
19
|
+
if ("end_test" !== action.type) return false;
|
|
20
|
+
|
|
21
|
+
if (action.assertions === undefined) return false;
|
|
22
|
+
if (Array.isArray(action.assertions) && action.assertions.length === 0)
|
|
23
|
+
return false;
|
|
24
|
+
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { TestLogger };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function testStuffAndPass(): undefined {
|
|
2
|
+
return;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
function testMoreStuffAndPass() {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async function testStuffAndPassAsync(): Promise<undefined> {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async function testMoreStuffAndPassAsync(): Promise<string[]> {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// export tests
|
|
18
|
+
export const tests = [
|
|
19
|
+
testStuffAndPass,
|
|
20
|
+
testMoreStuffAndPass,
|
|
21
|
+
testStuffAndPassAsync,
|
|
22
|
+
testMoreStuffAndPassAsync,
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
// export optional test details
|
|
26
|
+
export const options = {
|
|
27
|
+
title: import.meta.url,
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["./src/mod.ts","./src/test_fail.test.ts","./src/test_logger.ts","./src/test_pass.test.ts"],"version":"5.9.3"}
|