@rcompat/test 0.2.0 → 0.2.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.
@@ -1,4 +1,5 @@
1
1
  import type Asserter from "#Asserter";
2
- type Body = (asserter: Asserter) => void;
2
+ import type MaybePromise from "@rcompat/type/MaybePromise";
3
+ type Body = (asserter: Asserter) => MaybePromise<void>;
3
4
  export { Body as default };
4
5
  //# sourceMappingURL=Body.d.ts.map
@@ -8,6 +8,6 @@ export default class Test {
8
8
  get file(): FileRef;
9
9
  get results(): Result<unknown>[];
10
10
  report<T>(actual: T, expected: T, passed: boolean): void;
11
- run(): void;
11
+ run(): Promise<this>;
12
12
  }
13
13
  //# sourceMappingURL=Test.d.ts.map
@@ -22,9 +22,10 @@ export default class Test {
22
22
  report(actual, expected, passed) {
23
23
  this.#results.push(new Result(actual, expected, passed));
24
24
  }
25
- run() {
25
+ async run() {
26
26
  const asserter = (actual) => new Assert(this, actual);
27
- this.#body(asserter);
27
+ await this.#body(asserter);
28
+ return this;
28
29
  }
29
30
  }
30
31
  ;
@@ -16,7 +16,7 @@ const checks = [
16
16
  [fn.is, (x, y) => fn.is(y) && fn.equal(x, y)],
17
17
  [record.is, (x, y) => record.is(y)
18
18
  && record.equal(x, y)],
19
- [(_) => true, (_, _1) => false]
19
+ [(_) => true, (_, _1) => false],
20
20
  ];
21
21
  const equals = (x, y) => typeof x === typeof y
22
22
  ? checks.find(([predicate]) => predicate(x))[1](x, y)
@@ -6,7 +6,7 @@ declare class Repository {
6
6
  reset(): void;
7
7
  put(name: string, body: Body): void;
8
8
  current(file: FileRef): void;
9
- run(): Generator<Test, void, unknown>;
9
+ run(): AsyncGenerator<Test, void, unknown>;
10
10
  }
11
11
  declare const _default: Repository;
12
12
  export default _default;
@@ -11,10 +11,9 @@ class Repository {
11
11
  current(file) {
12
12
  this.#current = file;
13
13
  }
14
- *run() {
14
+ async *run() {
15
15
  for (const test of this.#tests) {
16
- test.run();
17
- yield test;
16
+ yield await test.run();
18
17
  }
19
18
  }
20
19
  }
@@ -1,9 +1,9 @@
1
- import type Dictionary from "@rcompat/type/Dictionary";
1
+ import type Dict from "@rcompat/type/Dict";
2
2
  declare const _default: {
3
- equal: <T extends Dictionary>(x: T, y: T) => boolean;
4
- include: <T extends Dictionary>(x: T, y: T) => boolean;
5
- is: (x: unknown) => x is Dictionary;
6
- partial: <t extends Dictionary>(x: t, y: t) => boolean;
3
+ equal: <T extends Dict>(x: T, y: T) => boolean;
4
+ include: <T extends Dict>(x: T, y: T) => boolean;
5
+ is: (x: unknown) => x is Dict;
6
+ partial: <t extends Dict>(x: t, y: t) => boolean;
7
7
  };
8
8
  export default _default;
9
9
  //# sourceMappingURL=record.d.ts.map
@@ -1,4 +1,11 @@
1
- const scalars = ["bigint", "boolean", "number", "string", "symbol", "undefined"];
1
+ const scalars = [
2
+ "bigint",
3
+ "boolean",
4
+ "number",
5
+ "string",
6
+ "symbol",
7
+ "undefined",
8
+ ];
2
9
  const is = (x) => scalars.includes(typeof x);
3
10
  const equal = (x, y) => x === y || Object.is(x, y);
4
11
  const include = equal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rcompat/test",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Standard library testing",
5
5
  "bugs": "https://github.com/rcompat/rcompat/issues",
6
6
  "license": "MIT",
@@ -15,7 +15,7 @@
15
15
  "directory": "packages/test"
16
16
  },
17
17
  "devDependencies": {
18
- "@rcompat/fs": "^0.13.0"
18
+ "@rcompat/fs": "^0.13.2"
19
19
  },
20
20
  "dependencies": {
21
21
  "@rcompat/record": "^0.8.0"