@ricsam/isolate-test-utils 0.1.8 → 0.1.10

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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @ricsam/isolate-test-utils
2
2
 
3
+ ## 0.1.10
4
+
5
+ ### Patch Changes
6
+
7
+ - new console.log handling
8
+ - Updated dependencies
9
+ - @ricsam/isolate-console@0.1.10
10
+ - @ricsam/isolate-runtime@0.1.11
11
+ - @ricsam/isolate-fetch@0.1.11
12
+
13
+ ## 0.1.9
14
+
15
+ ### Patch Changes
16
+
17
+ - target node when building
18
+ - Updated dependencies
19
+ - @ricsam/isolate-console@0.1.9
20
+ - @ricsam/isolate-core@0.1.9
21
+ - @ricsam/isolate-fetch@0.1.9
22
+ - @ricsam/isolate-fs@0.1.9
23
+ - @ricsam/isolate-runtime@0.1.10
24
+
3
25
  ## 0.1.8
4
26
 
5
27
  ### Patch Changes
package/README.md CHANGED
@@ -31,7 +31,7 @@ await ctx.context.eval(`
31
31
 
32
32
  // Check captured logs
33
33
  console.log(ctx.logs);
34
- // [{ level: "log", args: ["Starting fetch..."] }, ...]
34
+ // [{ level: "log", stdout: "Starting fetch..." }, ...]
35
35
 
36
36
  // Check captured fetch calls
37
37
  console.log(ctx.fetchCalls);
@@ -49,7 +49,7 @@ interface RuntimeTestContext {
49
49
  context: ivm.Context;
50
50
  tick(ms?: number): Promise<void>;
51
51
  dispose(): void;
52
- logs: Array<{ level: string; args: unknown[] }>;
52
+ logs: Array<{ level: string; stdout: string }>;
53
53
  fetchCalls: Array<{ url: string; method: string; headers: [string, string][] }>;
54
54
  setMockResponse(response: MockResponse): void;
55
55
  mockFs: MockFileSystem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/isolate-test-utils",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/index.test.ts CHANGED
@@ -351,9 +351,9 @@ describe("createRuntimeTestContext", () => {
351
351
 
352
352
  assert.strictEqual(ctx.logs.length, 2);
353
353
  assert.strictEqual(ctx.logs[0]!.level, "log");
354
- assert.deepStrictEqual(ctx.logs[0]!.args, ["test message"]);
354
+ assert.strictEqual(ctx.logs[0]!.stdout, "test message");
355
355
  assert.strictEqual(ctx.logs[1]!.level, "warn");
356
- assert.deepStrictEqual(ctx.logs[1]!.args, ["warning message"]);
356
+ assert.strictEqual(ctx.logs[1]!.stdout, "warning message");
357
357
  });
358
358
 
359
359
  test("captures and mocks fetch calls", async () => {
@@ -21,7 +21,7 @@ export interface RuntimeTestContext {
21
21
  /** Dispose all resources */
22
22
  dispose(): Promise<void>;
23
23
  /** Captured console.log calls */
24
- logs: Array<{ level: string; args: unknown[] }>;
24
+ logs: Array<{ level: string; stdout: string }>;
25
25
  /** Captured fetch calls */
26
26
  fetchCalls: Array<{ url: string; method: string; headers: [string, string][] }>;
27
27
  /** Set the mock response for the next fetch call */
@@ -60,7 +60,7 @@ export interface RuntimeTestContext {
60
60
  * console.log(ctx.getResult()); // { data: "test" }
61
61
  *
62
62
  * // Check logs
63
- * console.log(ctx.logs); // [{ level: "log", args: ["Starting fetch..."] }, ...]
63
+ * console.log(ctx.logs); // [{ level: "log", stdout: "Starting fetch..." }, ...]
64
64
  *
65
65
  * // Check fetch calls
66
66
  * console.log(ctx.fetchCalls); // [{ url: "https://api.example.com/data", method: "GET", ... }]
@@ -78,7 +78,7 @@ export async function createRuntimeTestContext(
78
78
  clearAllInstanceState();
79
79
 
80
80
  // State for capturing logs and fetch calls
81
- const logs: Array<{ level: string; args: unknown[] }> = [];
81
+ const logs: Array<{ level: string; stdout: string }> = [];
82
82
  const fetchCalls: Array<{
83
83
  url: string;
84
84
  method: string;
@@ -96,9 +96,9 @@ export async function createRuntimeTestContext(
96
96
  console: {
97
97
  onEntry: (entry) => {
98
98
  if (entry.type === "output") {
99
- logs.push({ level: entry.level, args: entry.args });
99
+ logs.push({ level: entry.level, stdout: entry.stdout });
100
100
  } else if (entry.type === "assert") {
101
- logs.push({ level: "error", args: ["Assertion failed:", ...entry.args] });
101
+ logs.push({ level: "error", stdout: entry.stdout });
102
102
  }
103
103
  },
104
104
  },