@aethervtt/shard-testing 0.1.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.
package/dist/index.d.ts CHANGED
@@ -39,6 +39,20 @@ export declare class Game {
39
39
  * them: `{ frame, event, clip, entity, path, bus, position, gain, pan, reason }`.
40
40
  */
41
41
  audioLog(since?: number): Promise<Json[]>;
42
+ /** Audio inspection and cursor-aware traces; assertions remain ordinary test assertions. */
43
+ readonly audio: {
44
+ describe: () => Promise<Json>;
45
+ events: (cursor?: number) => Promise<Json>;
46
+ music: (cursor?: number) => Promise<Json>;
47
+ mix: () => Promise<Json>;
48
+ log: (cursor?: number) => Promise<{
49
+ entries: Json[];
50
+ oldestCursor: number;
51
+ nextCursor: number;
52
+ truncated: boolean;
53
+ }>;
54
+ parameter: (instance: number, name: string, value: string | number) => Promise<Json>;
55
+ };
42
56
  /** UI (ui plugin): read the HUD as data and press buttons by path, without pixel coordinates. */
43
57
  readonly ui: {
44
58
  /** `ui.describe`: every tree with rects, text, widget state, focus, and anchors. */
@@ -88,7 +102,10 @@ export declare class Game {
88
102
  private inject;
89
103
  private resolve;
90
104
  }
91
- /** A gameplay test. Each test gets a fresh game; the GPU is shared across a file. */
105
+ /**
106
+ * A gameplay test. Each test gets a fresh game; the GPU is shared across a file. `timeout` is
107
+ * scaled like `timeout()` from test-env (5x in CI, which renders on a software GPU).
108
+ */
92
109
  export declare function test(name: string, fn: (ctx: {
93
110
  game: Game;
94
111
  }) => Promise<void> | void, timeout?: number): void;
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { mkdir, writeFile } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
3
  import { findComponent, ShardError } from "@aethervtt/shard-core";
4
+ import { timeout as scaled } from "@aethervtt/shard-core/test-env";
4
5
  import { createNodeGpuContext } from "@aethervtt/shard-gpu/node";
5
6
  import { openProject } from "@aethervtt/shard-node";
6
7
  import { findEntityByPath } from "@aethervtt/shard-scene";
@@ -85,6 +86,15 @@ class Game {
85
86
  async audioLog(since = 0) {
86
87
  return (await this.call("audio.log", { since })).entries;
87
88
  }
89
+ /** Audio inspection and cursor-aware traces; assertions remain ordinary test assertions. */
90
+ audio = {
91
+ describe: async () => this.call("audio.describe"),
92
+ events: async (cursor = 0) => this.call("audio.events.inspect", { cursor }),
93
+ music: async (cursor = 0) => this.call("audio.music.inspect", { cursor }),
94
+ mix: async () => this.call("audio.mix.inspect"),
95
+ log: async (cursor = 0) => this.call("audio.log", { cursor }),
96
+ parameter: async (instance, name, value) => this.call("audio.parameter.set", { instance, name, value })
97
+ };
88
98
  /** UI (ui plugin): read the HUD as data and press buttons by path, without pixel coordinates. */
89
99
  ui = {
90
100
  /** `ui.describe`: every tree with rects, text, widget state, focus, and anchors. */
@@ -202,7 +212,7 @@ function test(name, fn, timeout = 3e4) {
202
212
  open.push(project);
203
213
  await fn({ game: new Game(project) });
204
214
  },
205
- timeout
215
+ scaled(timeout)
206
216
  );
207
217
  }
208
218
  test.skip = (name, _fn) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aethervtt/shard-testing",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -16,13 +16,13 @@
16
16
  "README.md"
17
17
  ],
18
18
  "dependencies": {
19
- "@aethervtt/shard-core": "0.1.0",
20
- "@aethervtt/shard-gpu": "0.1.0",
21
- "@aethervtt/shard-node": "0.1.0",
22
- "@aethervtt/shard-protocol": "0.1.0",
23
- "@aethervtt/shard-runtime": "0.1.0",
19
+ "@aethervtt/shard-core": "0.2.1",
20
+ "@aethervtt/shard-gpu": "0.2.1",
21
+ "@aethervtt/shard-node": "0.2.1",
22
+ "@aethervtt/shard-protocol": "0.2.1",
23
+ "@aethervtt/shard-runtime": "0.2.1",
24
24
  "vitest": "^5.0.1",
25
- "@aethervtt/shard-scene": "0.1.0"
25
+ "@aethervtt/shard-scene": "0.2.1"
26
26
  },
27
27
  "repository": {
28
28
  "type": "git",
@@ -34,6 +34,6 @@
34
34
  "provenance": true
35
35
  },
36
36
  "shard": {
37
- "buildSha": "8e14c9896f82a3554b156f1ffdd68f2cc3e7d78a"
37
+ "buildSha": "772eb0d2b8a5fc499105708f4ae92c58788cc9ea"
38
38
  }
39
39
  }