@rcompat/test 0.3.0 → 0.5.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/lib/private/End.d.ts +4 -0
- package/lib/private/End.js +2 -0
- package/lib/private/Suite.d.ts +14 -0
- package/lib/private/Suite.js +29 -0
- package/lib/private/Test.d.ts +1 -3
- package/lib/private/Test.js +1 -6
- package/lib/private/index.d.ts +2 -0
- package/lib/private/index.js +3 -0
- package/lib/private/repository.d.ts +6 -4
- package/lib/private/repository.js +16 -11
- package/package.json +2 -5
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type Body from "#Body";
|
|
2
|
+
import type End from "#End";
|
|
3
|
+
import Test from "#Test";
|
|
4
|
+
import type FileRef from "@rcompat/fs/FileRef";
|
|
5
|
+
export default class Suite {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(file: FileRef);
|
|
8
|
+
test(name: string, body: Body): void;
|
|
9
|
+
ended(end: End): void;
|
|
10
|
+
get file(): FileRef;
|
|
11
|
+
run(): AsyncGenerator<Test, void, unknown>;
|
|
12
|
+
end(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Suite.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import Test from "#Test";
|
|
2
|
+
export default class Suite {
|
|
3
|
+
#file;
|
|
4
|
+
#tests = [];
|
|
5
|
+
#ends = [];
|
|
6
|
+
constructor(file) {
|
|
7
|
+
this.#file = file;
|
|
8
|
+
}
|
|
9
|
+
test(name, body) {
|
|
10
|
+
this.#tests.push(new Test(name, body));
|
|
11
|
+
}
|
|
12
|
+
ended(end) {
|
|
13
|
+
this.#ends.push(end);
|
|
14
|
+
}
|
|
15
|
+
get file() {
|
|
16
|
+
return this.#file;
|
|
17
|
+
}
|
|
18
|
+
async *run() {
|
|
19
|
+
for (const test of this.#tests) {
|
|
20
|
+
yield await test.run();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async end() {
|
|
24
|
+
for (const end of this.#ends) {
|
|
25
|
+
await end();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=Suite.js.map
|
package/lib/private/Test.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type Body from "#Body";
|
|
2
2
|
import Result from "#Result";
|
|
3
|
-
import type FileRef from "@rcompat/fs/FileRef";
|
|
4
3
|
export default class Test {
|
|
5
4
|
#private;
|
|
6
|
-
constructor(name: string, body: Body
|
|
5
|
+
constructor(name: string, body: Body);
|
|
7
6
|
get name(): string;
|
|
8
|
-
get file(): FileRef;
|
|
9
7
|
get results(): Result<unknown>[];
|
|
10
8
|
report<T>(actual: T, expected: T, passed: boolean): void;
|
|
11
9
|
run(): Promise<this>;
|
package/lib/private/Test.js
CHANGED
|
@@ -4,18 +4,13 @@ export default class Test {
|
|
|
4
4
|
#name;
|
|
5
5
|
#body;
|
|
6
6
|
#results = [];
|
|
7
|
-
|
|
8
|
-
constructor(name, body, file) {
|
|
7
|
+
constructor(name, body) {
|
|
9
8
|
this.#name = name;
|
|
10
9
|
this.#body = body;
|
|
11
|
-
this.#file = file;
|
|
12
10
|
}
|
|
13
11
|
get name() {
|
|
14
12
|
return this.#name;
|
|
15
13
|
}
|
|
16
|
-
get file() {
|
|
17
|
-
return this.#file;
|
|
18
|
-
}
|
|
19
14
|
get results() {
|
|
20
15
|
return this.#results;
|
|
21
16
|
}
|
package/lib/private/index.d.ts
CHANGED
package/lib/private/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type Body from "#Body";
|
|
2
|
-
import
|
|
2
|
+
import type End from "#End";
|
|
3
|
+
import Suite from "#Suite";
|
|
3
4
|
import type FileRef from "@rcompat/fs/FileRef";
|
|
4
5
|
declare class Repository {
|
|
5
6
|
#private;
|
|
6
|
-
reset(): void;
|
|
7
7
|
put(name: string, body: Body): void;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
ended(end: End): void;
|
|
9
|
+
suite(file: FileRef): void;
|
|
10
|
+
reset(): void;
|
|
11
|
+
next(): Generator<Suite, void, unknown>;
|
|
10
12
|
}
|
|
11
13
|
declare const _default: Repository;
|
|
12
14
|
export default _default;
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Suite from "#Suite";
|
|
2
2
|
class Repository {
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
this.#tests = [];
|
|
3
|
+
#suites = [];
|
|
4
|
+
get #suite() {
|
|
5
|
+
return this.#suites.at(-1);
|
|
7
6
|
}
|
|
8
7
|
put(name, body) {
|
|
9
|
-
this.#
|
|
8
|
+
this.#suite.test(name, body);
|
|
9
|
+
}
|
|
10
|
+
ended(end) {
|
|
11
|
+
this.#suite.ended(end);
|
|
10
12
|
}
|
|
11
|
-
|
|
12
|
-
this.#
|
|
13
|
+
suite(file) {
|
|
14
|
+
this.#suites.push(new Suite(file));
|
|
15
|
+
}
|
|
16
|
+
reset() {
|
|
17
|
+
this.#suites = [];
|
|
13
18
|
}
|
|
14
|
-
|
|
15
|
-
for (const
|
|
16
|
-
yield
|
|
19
|
+
*next() {
|
|
20
|
+
for (const suite of this.#suites) {
|
|
21
|
+
yield suite;
|
|
17
22
|
}
|
|
18
23
|
}
|
|
19
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rcompat/test",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Standard library testing",
|
|
5
5
|
"bugs": "https://github.com/rcompat/rcompat/issues",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,10 +15,7 @@
|
|
|
15
15
|
"directory": "packages/test"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@rcompat/fs": "^0.
|
|
19
|
-
},
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"@rcompat/record": "^0.8.1"
|
|
18
|
+
"@rcompat/fs": "^0.17.0"
|
|
22
19
|
},
|
|
23
20
|
"type": "module",
|
|
24
21
|
"imports": {
|