@rcompat/test 0.12.0 → 0.12.2

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/README.md CHANGED
@@ -288,7 +288,7 @@ called and how.
288
288
  ```js
289
289
  import test from "@rcompat/test";
290
290
 
291
- await using telegram = test.intercept("https://api.telegram.org", setup => {
291
+ using telegram = test.intercept("https://api.telegram.org", setup => {
292
292
  setup.post("/sendMessage", () => ({
293
293
  ok: true,
294
294
  result: { message_id: 42 },
@@ -309,9 +309,9 @@ test.case("notifies user via telegram on signup", async assert => {
309
309
  });
310
310
  ```
311
311
 
312
- `await using` restores the original fetch automatically when the file scope
313
- exits. For long-lived intercepts that need manual control, use `restore()`
314
- with `test.ended`:
312
+ `using` restores the original fetch automatically when the file scope exits.
313
+ For long-lived intercepts that need manual control, use `restore()` with
314
+ `test.ended`:
315
315
 
316
316
  ```js
317
317
  const telegram = test.intercept("https://api.telegram.org", setup => {
@@ -474,7 +474,7 @@ which is serialized into a `Response` automatically.
474
474
  | `calls(path)` | Number of times `path` was hit |
475
475
  | `requests(path)` | Array of `Request` objects recorded for `path` |
476
476
  | `restore()` | Reinstate the original `globalThis.fetch` |
477
- | `[Symbol.asyncDispose]` | Called automatically by `await using` |
477
+ | `[Symbol.dispose]` | Called automatically by `using` |
478
478
 
479
479
  ### `Asserter`
480
480
 
@@ -614,7 +614,7 @@ test.case("divide works normally", assert => {
614
614
  ```js
615
615
  import test from "@rcompat/test";
616
616
 
617
- await using openai = test.intercept("https://api.openai.com", setup => {
617
+ using openai = test.intercept("https://api.openai.com", setup => {
618
618
  setup.post("/v1/chat/completions", () => ({
619
619
  choices: [{ message: { content: "Hello!" } }],
620
620
  }));
@@ -18,7 +18,7 @@ declare const _default: {
18
18
  calls(path: string): number;
19
19
  requests(path: string): Request[];
20
20
  restore(): void;
21
- [Symbol.asyncDispose](): Promise<void>;
21
+ [Symbol.dispose](): void;
22
22
  };
23
23
  extend<Subject, Extensions>(factory: Factory<Subject, Extensions>): ExtendedTest<Extensions>;
24
24
  case(name: string, body: Body): void;
@@ -10,7 +10,7 @@ type Intercept = {
10
10
  calls(path: string): number;
11
11
  requests(path: string): Request[];
12
12
  restore(): void;
13
- [Symbol.asyncDispose](): Promise<void>;
13
+ [Symbol.dispose](): void;
14
14
  };
15
15
  declare const _default: (base_url: string, setup: (setup: Setup) => void) => Intercept;
16
16
  export default _default;
@@ -39,7 +39,7 @@ export default (base_url, setup) => {
39
39
  return log.filter(r => new URL(r.url).pathname === path);
40
40
  },
41
41
  restore,
42
- async [Symbol.asyncDispose]() {
42
+ [Symbol.dispose]() {
43
43
  restore();
44
44
  },
45
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rcompat/test",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "description": "Standard library testing",
5
5
  "bugs": "https://github.com/rcompat/rcompat/issues",
6
6
  "license": "MIT",
@@ -15,38 +15,38 @@
15
15
  "directory": "packages/test"
16
16
  },
17
17
  "dependencies": {
18
- "@rcompat/is": "^0.6.0"
18
+ "@rcompat/is": "^0.6.1"
19
19
  },
20
20
  "devDependencies": {
21
- "@rcompat/fs": "^0.28.0",
22
- "@rcompat/type": "^0.11.0"
21
+ "@rcompat/type": "^0.11.1",
22
+ "@rcompat/fs": "^0.28.1"
23
23
  },
24
24
  "type": "module",
25
25
  "imports": {
26
26
  "#mask/*": {
27
- "source": "./src/private/mask/*.ts",
27
+ "@rcompat/source": "./src/private/mask/*.ts",
28
28
  "default": "./lib/private/mask/*.js"
29
29
  },
30
30
  "#types/*": {
31
- "source": "./src/private/types/*.ts",
31
+ "@rcompat/source": "./src/private/types/*.ts",
32
32
  "default": "./lib/private/types/*.js"
33
33
  },
34
34
  "#*": {
35
- "source": "./src/private/*.ts",
35
+ "@rcompat/source": "./src/private/*.ts",
36
36
  "default": "./lib/private/*.js"
37
37
  }
38
38
  },
39
39
  "exports": {
40
40
  "./mask/*": {
41
- "source": "./src/public/mask/*.ts",
41
+ "@rcompat/source": "./src/public/mask/*.ts",
42
42
  "default": "./lib/public/mask/*.js"
43
43
  },
44
44
  "./*": {
45
- "source": "./src/public/*.ts",
45
+ "@rcompat/source": "./src/public/*.ts",
46
46
  "default": "./lib/public/*.js"
47
47
  },
48
48
  ".": {
49
- "source": "./src/public/index.ts",
49
+ "@rcompat/source": "./src/public/index.ts",
50
50
  "default": "./lib/public/index.js"
51
51
  }
52
52
  },