modelfusion 0.91.0 → 0.92.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.
Files changed (57) hide show
  1. package/README.md +4 -2
  2. package/core/FunctionOptions.d.ts +3 -11
  3. package/core/LogFormat.cjs +10 -0
  4. package/core/LogFormat.d.ts +9 -0
  5. package/core/LogFormat.js +9 -0
  6. package/core/ModelFusionConfiguration.cjs +21 -0
  7. package/core/ModelFusionConfiguration.d.ts +6 -0
  8. package/core/ModelFusionConfiguration.js +14 -0
  9. package/core/api/ApiCallError.cjs +9 -1
  10. package/core/api/ApiCallError.d.ts +4 -1
  11. package/core/api/ApiCallError.js +9 -1
  12. package/core/executeFunctionCall.cjs +4 -4
  13. package/core/executeFunctionCall.js +4 -4
  14. package/core/getFunctionCallLogger.cjs +21 -5
  15. package/core/getFunctionCallLogger.js +21 -5
  16. package/core/index.cjs +15 -2
  17. package/core/index.d.ts +2 -2
  18. package/core/index.js +2 -2
  19. package/model-function/executeStandardCall.cjs +4 -4
  20. package/model-function/executeStandardCall.js +4 -4
  21. package/model-function/executeStreamCall.cjs +4 -4
  22. package/model-function/executeStreamCall.js +4 -4
  23. package/model-provider/ollama/OllamaError.cjs +25 -24
  24. package/model-provider/ollama/OllamaError.d.ts +1 -11
  25. package/model-provider/ollama/OllamaError.js +24 -22
  26. package/model-provider/ollama/OllamaTextGenerationModel.cjs +38 -1
  27. package/model-provider/ollama/OllamaTextGenerationModel.d.ts +5 -1
  28. package/model-provider/ollama/OllamaTextGenerationModel.js +39 -2
  29. package/model-provider/ollama/OllamaTextGenerationModel.test.cjs +63 -0
  30. package/model-provider/ollama/OllamaTextGenerationModel.test.d.ts +1 -0
  31. package/model-provider/ollama/OllamaTextGenerationModel.test.js +61 -0
  32. package/model-provider/ollama/index.cjs +1 -3
  33. package/model-provider/ollama/index.d.ts +1 -1
  34. package/model-provider/ollama/index.js +0 -1
  35. package/model-provider/openai/OpenAIError.cjs +13 -29
  36. package/model-provider/openai/OpenAIError.d.ts +2 -11
  37. package/model-provider/openai/OpenAIError.js +11 -26
  38. package/model-provider/openai/index.cjs +1 -3
  39. package/model-provider/openai/index.d.ts +1 -1
  40. package/model-provider/openai/index.js +0 -1
  41. package/model-provider/whispercpp/WhisperCppTranscriptionModel.cjs +5 -8
  42. package/model-provider/whispercpp/WhisperCppTranscriptionModel.js +5 -8
  43. package/package.json +5 -4
  44. package/tool/execute-tool/executeTool.cjs +3 -4
  45. package/tool/execute-tool/executeTool.js +3 -4
  46. package/util/AsyncQueue.test.cjs +20 -21
  47. package/util/AsyncQueue.test.js +9 -10
  48. package/util/isDeepEqualData.test.cjs +14 -15
  49. package/util/isDeepEqualData.test.js +14 -15
  50. package/util/runSafe.test.cjs +12 -13
  51. package/util/runSafe.test.js +6 -7
  52. package/core/GlobalFunctionLogging.cjs +0 -12
  53. package/core/GlobalFunctionLogging.d.ts +0 -3
  54. package/core/GlobalFunctionLogging.js +0 -7
  55. package/core/GlobalFunctionObservers.cjs +0 -12
  56. package/core/GlobalFunctionObservers.d.ts +0 -3
  57. package/core/GlobalFunctionObservers.js +0 -7
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const vitest_1 = require("vitest");
4
3
  const delay_js_1 = require("./delay.cjs");
5
4
  const AsyncQueue_js_1 = require("./AsyncQueue.cjs");
6
- (0, vitest_1.test)("receive values in order for single iterator created before pushing", async () => {
5
+ it("should receive values in order for single iterator created before pushing", async () => {
7
6
  const asyncQueue = new AsyncQueue_js_1.AsyncQueue();
8
7
  const receivedValues = [];
9
8
  const receiveValuesPromise = (async () => {
@@ -16,9 +15,9 @@ const AsyncQueue_js_1 = require("./AsyncQueue.cjs");
16
15
  asyncQueue.push(3);
17
16
  asyncQueue.close();
18
17
  await receiveValuesPromise;
19
- (0, vitest_1.expect)(receivedValues).toEqual([1, 2, 3]);
18
+ expect(receivedValues).toEqual([1, 2, 3]);
20
19
  });
21
- (0, vitest_1.test)("receive values in order for single iterator created after closing", async () => {
20
+ it("should receive values in order for single iterator created after closing", async () => {
22
21
  const asyncQueue = new AsyncQueue_js_1.AsyncQueue();
23
22
  asyncQueue.push(1);
24
23
  asyncQueue.push(2);
@@ -31,9 +30,9 @@ const AsyncQueue_js_1 = require("./AsyncQueue.cjs");
31
30
  }
32
31
  })();
33
32
  await receiveValuesPromise;
34
- (0, vitest_1.expect)(receivedValues).toEqual([1, 2, 3]);
33
+ expect(receivedValues).toEqual([1, 2, 3]);
35
34
  });
36
- (0, vitest_1.test)("handle delayed pushing", async () => {
35
+ it("should handle delayed pushing", async () => {
37
36
  const asyncQueue = new AsyncQueue_js_1.AsyncQueue();
38
37
  setTimeout(() => {
39
38
  asyncQueue.push(1);
@@ -44,12 +43,12 @@ const AsyncQueue_js_1 = require("./AsyncQueue.cjs");
44
43
  for await (const value of asyncQueue) {
45
44
  receivedValues.push(value);
46
45
  }
47
- (0, vitest_1.expect)(receivedValues).toEqual([1, 2]);
46
+ expect(receivedValues).toEqual([1, 2]);
48
47
  });
49
- (0, vitest_1.test)("error handling in consumer", async () => {
48
+ it("should error handling in consumer", async () => {
50
49
  const asyncQueue = new AsyncQueue_js_1.AsyncQueue();
51
50
  asyncQueue.push(1);
52
- await (0, vitest_1.expect)((async () => {
51
+ await expect((async () => {
53
52
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
54
53
  for await (const _value of asyncQueue) {
55
54
  throw new Error("Consumer error");
@@ -62,23 +61,23 @@ const AsyncQueue_js_1 = require("./AsyncQueue.cjs");
62
61
  for await (const value of asyncQueue) {
63
62
  receivedValues.push(value);
64
63
  }
65
- (0, vitest_1.expect)(receivedValues).toEqual([1, 2]);
64
+ expect(receivedValues).toEqual([1, 2]);
66
65
  });
67
- (0, vitest_1.test)("behavior on empty queue closing", async () => {
66
+ it("should behavior on empty queue closing", async () => {
68
67
  const asyncQueue = new AsyncQueue_js_1.AsyncQueue();
69
68
  asyncQueue.close();
70
69
  const receivedValues = [];
71
70
  for await (const value of asyncQueue) {
72
71
  receivedValues.push(value);
73
72
  }
74
- (0, vitest_1.expect)(receivedValues).toEqual([]);
73
+ expect(receivedValues).toEqual([]);
75
74
  });
76
- (0, vitest_1.test)("multiple closings", async () => {
75
+ it("should multiple closings", async () => {
77
76
  const asyncQueue = new AsyncQueue_js_1.AsyncQueue();
78
77
  asyncQueue.close();
79
- (0, vitest_1.expect)(() => asyncQueue.close()).not.toThrow();
78
+ expect(() => asyncQueue.close()).not.toThrow();
80
79
  });
81
- (0, vitest_1.test)("receive all values in multiple independent consumers", async () => {
80
+ it("should receive all values in multiple independent consumers", async () => {
82
81
  const asyncQueue = new AsyncQueue_js_1.AsyncQueue();
83
82
  const consumerPromises = [1, 2].map(async () => {
84
83
  const receivedValues = [];
@@ -97,10 +96,10 @@ const AsyncQueue_js_1 = require("./AsyncQueue.cjs");
97
96
  asyncQueue.close();
98
97
  const allReceivedValues = await Promise.all(consumerPromises);
99
98
  allReceivedValues.forEach((receivedValues) => {
100
- (0, vitest_1.expect)(receivedValues).toEqual([1, 2, 3]);
99
+ expect(receivedValues).toEqual([1, 2, 3]);
101
100
  });
102
101
  });
103
- (0, vitest_1.test)("each consumer receives all pushed values under varying conditions", async () => {
102
+ it("should each consumer receives all pushed values under varying conditions", async () => {
104
103
  const asyncQueue = new AsyncQueue_js_1.AsyncQueue();
105
104
  // Start the first consumer, which will await values.
106
105
  const receivedValues1 = [];
@@ -128,11 +127,11 @@ const AsyncQueue_js_1 = require("./AsyncQueue.cjs");
128
127
  asyncQueue.close();
129
128
  await Promise.all([consumer1, consumer2]);
130
129
  // Both consumers should have received all values, even if they started at different times.
131
- (0, vitest_1.expect)(receivedValues1).toEqual([1, 2, 3]);
132
- (0, vitest_1.expect)(receivedValues2).toEqual([1, 2, 3]); // This will likely fail because consumer2 started late.
130
+ expect(receivedValues1).toEqual([1, 2, 3]);
131
+ expect(receivedValues2).toEqual([1, 2, 3]); // This will likely fail because consumer2 started late.
133
132
  });
134
- (0, vitest_1.test)("throw error when pushing to a closed queue", async () => {
133
+ it("should throw error when pushing to a closed queue", async () => {
135
134
  const asyncQueue = new AsyncQueue_js_1.AsyncQueue();
136
135
  asyncQueue.close();
137
- (0, vitest_1.expect)(() => asyncQueue.push(1)).toThrowError("Cannot push value to closed queue.");
136
+ expect(() => asyncQueue.push(1)).toThrowError("Cannot push value to closed queue.");
138
137
  });
@@ -1,7 +1,6 @@
1
- import { expect, test } from "vitest";
2
1
  import { delay } from "./delay.js";
3
2
  import { AsyncQueue } from "./AsyncQueue.js";
4
- test("receive values in order for single iterator created before pushing", async () => {
3
+ it("should receive values in order for single iterator created before pushing", async () => {
5
4
  const asyncQueue = new AsyncQueue();
6
5
  const receivedValues = [];
7
6
  const receiveValuesPromise = (async () => {
@@ -16,7 +15,7 @@ test("receive values in order for single iterator created before pushing", async
16
15
  await receiveValuesPromise;
17
16
  expect(receivedValues).toEqual([1, 2, 3]);
18
17
  });
19
- test("receive values in order for single iterator created after closing", async () => {
18
+ it("should receive values in order for single iterator created after closing", async () => {
20
19
  const asyncQueue = new AsyncQueue();
21
20
  asyncQueue.push(1);
22
21
  asyncQueue.push(2);
@@ -31,7 +30,7 @@ test("receive values in order for single iterator created after closing", async
31
30
  await receiveValuesPromise;
32
31
  expect(receivedValues).toEqual([1, 2, 3]);
33
32
  });
34
- test("handle delayed pushing", async () => {
33
+ it("should handle delayed pushing", async () => {
35
34
  const asyncQueue = new AsyncQueue();
36
35
  setTimeout(() => {
37
36
  asyncQueue.push(1);
@@ -44,7 +43,7 @@ test("handle delayed pushing", async () => {
44
43
  }
45
44
  expect(receivedValues).toEqual([1, 2]);
46
45
  });
47
- test("error handling in consumer", async () => {
46
+ it("should error handling in consumer", async () => {
48
47
  const asyncQueue = new AsyncQueue();
49
48
  asyncQueue.push(1);
50
49
  await expect((async () => {
@@ -62,7 +61,7 @@ test("error handling in consumer", async () => {
62
61
  }
63
62
  expect(receivedValues).toEqual([1, 2]);
64
63
  });
65
- test("behavior on empty queue closing", async () => {
64
+ it("should behavior on empty queue closing", async () => {
66
65
  const asyncQueue = new AsyncQueue();
67
66
  asyncQueue.close();
68
67
  const receivedValues = [];
@@ -71,12 +70,12 @@ test("behavior on empty queue closing", async () => {
71
70
  }
72
71
  expect(receivedValues).toEqual([]);
73
72
  });
74
- test("multiple closings", async () => {
73
+ it("should multiple closings", async () => {
75
74
  const asyncQueue = new AsyncQueue();
76
75
  asyncQueue.close();
77
76
  expect(() => asyncQueue.close()).not.toThrow();
78
77
  });
79
- test("receive all values in multiple independent consumers", async () => {
78
+ it("should receive all values in multiple independent consumers", async () => {
80
79
  const asyncQueue = new AsyncQueue();
81
80
  const consumerPromises = [1, 2].map(async () => {
82
81
  const receivedValues = [];
@@ -98,7 +97,7 @@ test("receive all values in multiple independent consumers", async () => {
98
97
  expect(receivedValues).toEqual([1, 2, 3]);
99
98
  });
100
99
  });
101
- test("each consumer receives all pushed values under varying conditions", async () => {
100
+ it("should each consumer receives all pushed values under varying conditions", async () => {
102
101
  const asyncQueue = new AsyncQueue();
103
102
  // Start the first consumer, which will await values.
104
103
  const receivedValues1 = [];
@@ -129,7 +128,7 @@ test("each consumer receives all pushed values under varying conditions", async
129
128
  expect(receivedValues1).toEqual([1, 2, 3]);
130
129
  expect(receivedValues2).toEqual([1, 2, 3]); // This will likely fail because consumer2 started late.
131
130
  });
132
- test("throw error when pushing to a closed queue", async () => {
131
+ it("should throw error when pushing to a closed queue", async () => {
133
132
  const asyncQueue = new AsyncQueue();
134
133
  asyncQueue.close();
135
134
  expect(() => asyncQueue.push(1)).toThrowError("Cannot push value to closed queue.");
@@ -4,9 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const node_assert_1 = __importDefault(require("node:assert"));
7
- const vitest_1 = require("vitest");
8
7
  const isDeepEqualData_js_1 = require("./isDeepEqualData.cjs");
9
- (0, vitest_1.test)("checks if two primitives are equal", async () => {
8
+ it("should check if two primitives are equal", async () => {
10
9
  let x = 1;
11
10
  let y = 1;
12
11
  let result = (0, isDeepEqualData_js_1.isDeepEqualData)(x, y);
@@ -16,48 +15,48 @@ const isDeepEqualData_js_1 = require("./isDeepEqualData.cjs");
16
15
  result = (0, isDeepEqualData_js_1.isDeepEqualData)(x, y);
17
16
  node_assert_1.default.equal(result, false);
18
17
  });
19
- (0, vitest_1.test)("returns false for different types", async () => {
18
+ it("should return false for different types", async () => {
20
19
  const obj = { a: 1 };
21
20
  const num = 1;
22
21
  const result = (0, isDeepEqualData_js_1.isDeepEqualData)(obj, num);
23
22
  node_assert_1.default.equal(result, false);
24
23
  });
25
- (0, vitest_1.test)("returns false for null values compared with objects", async () => {
24
+ it("should return false for null values compared with objects", async () => {
26
25
  const obj = { a: 1 };
27
26
  const result = (0, isDeepEqualData_js_1.isDeepEqualData)(obj, null);
28
27
  node_assert_1.default.equal(result, false);
29
28
  });
30
- (0, vitest_1.test)("identifies two equal objects", async () => {
29
+ it("should identify two equal objects", async () => {
31
30
  const obj1 = { a: 1, b: 2 };
32
31
  const obj2 = { a: 1, b: 2 };
33
32
  const result = (0, isDeepEqualData_js_1.isDeepEqualData)(obj1, obj2);
34
33
  node_assert_1.default.equal(result, true);
35
34
  });
36
- (0, vitest_1.test)("identifies two objects with different values", async () => {
35
+ it("should identify two objects with different values", async () => {
37
36
  const obj1 = { a: 1, b: 2 };
38
37
  const obj2 = { a: 1, b: 3 };
39
38
  const result = (0, isDeepEqualData_js_1.isDeepEqualData)(obj1, obj2);
40
39
  node_assert_1.default.equal(result, false);
41
40
  });
42
- (0, vitest_1.test)("identifies two objects with different number of keys", async () => {
41
+ it("should identify two objects with different number of keys", async () => {
43
42
  const obj1 = { a: 1, b: 2 };
44
43
  const obj2 = { a: 1, b: 2, c: 3 };
45
44
  const result = (0, isDeepEqualData_js_1.isDeepEqualData)(obj1, obj2);
46
45
  node_assert_1.default.equal(result, false);
47
46
  });
48
- (0, vitest_1.test)("handles nested objects", async () => {
47
+ it("should handle nested objects", async () => {
49
48
  const obj1 = { a: { c: 1 }, b: 2 };
50
49
  const obj2 = { a: { c: 1 }, b: 2 };
51
50
  const result = (0, isDeepEqualData_js_1.isDeepEqualData)(obj1, obj2);
52
51
  node_assert_1.default.equal(result, true);
53
52
  });
54
- (0, vitest_1.test)("detects inequality in nested objects", async () => {
53
+ it("should detect inequality in nested objects", async () => {
55
54
  const obj1 = { a: { c: 1 }, b: 2 };
56
55
  const obj2 = { a: { c: 2 }, b: 2 };
57
56
  const result = (0, isDeepEqualData_js_1.isDeepEqualData)(obj1, obj2);
58
57
  node_assert_1.default.equal(result, false);
59
58
  });
60
- (0, vitest_1.test)("compares arrays correctly", async () => {
59
+ it("should compare arrays correctly", async () => {
61
60
  const arr1 = [1, 2, 3];
62
61
  const arr2 = [1, 2, 3];
63
62
  const result = (0, isDeepEqualData_js_1.isDeepEqualData)(arr1, arr2);
@@ -67,18 +66,18 @@ const isDeepEqualData_js_1 = require("./isDeepEqualData.cjs");
67
66
  const result2 = (0, isDeepEqualData_js_1.isDeepEqualData)(arr3, arr4);
68
67
  node_assert_1.default.equal(result2, false);
69
68
  });
70
- (0, vitest_1.test)("returns false for null comparison with object", () => {
69
+ it("should return false for null comparison with object", () => {
71
70
  const obj = { a: 1 };
72
71
  const result = (0, isDeepEqualData_js_1.isDeepEqualData)(obj, null);
73
72
  node_assert_1.default.equal(result, false);
74
73
  });
75
- (0, vitest_1.test)("distinguishes between array and object with same enumerable properties", () => {
74
+ it("should distinguish between array and object with same enumerable properties", () => {
76
75
  const obj = { 0: "one", 1: "two", length: 2 };
77
76
  const arr = ["one", "two"];
78
77
  const result = (0, isDeepEqualData_js_1.isDeepEqualData)(obj, arr);
79
78
  node_assert_1.default.equal(result, false);
80
79
  });
81
- (0, vitest_1.test)("returns false when comparing objects with different prototypes", () => {
80
+ it("should return false when comparing objects with different prototypes", () => {
82
81
  const obj1 = Object.create({ a: 1 });
83
82
  const obj2 = Object.create(null);
84
83
  obj1.b = 2;
@@ -86,14 +85,14 @@ const isDeepEqualData_js_1 = require("./isDeepEqualData.cjs");
86
85
  const result = (0, isDeepEqualData_js_1.isDeepEqualData)(obj1, obj2);
87
86
  node_assert_1.default.equal(result, false);
88
87
  });
89
- (0, vitest_1.test)("handles date object comparisons correctly", () => {
88
+ it("should handle date object comparisons correctly", () => {
90
89
  const date1 = new Date(2000, 0, 1);
91
90
  const date2 = new Date(2000, 0, 1);
92
91
  const date3 = new Date(2000, 0, 2);
93
92
  node_assert_1.default.equal((0, isDeepEqualData_js_1.isDeepEqualData)(date1, date2), true);
94
93
  node_assert_1.default.equal((0, isDeepEqualData_js_1.isDeepEqualData)(date1, date3), false);
95
94
  });
96
- (0, vitest_1.test)("handles function comparisons", () => {
95
+ it("should handle function comparisons", () => {
97
96
  const func1 = () => {
98
97
  console.log("hello");
99
98
  };
@@ -1,7 +1,6 @@
1
1
  import assert from "node:assert";
2
- import { test } from "vitest";
3
2
  import { isDeepEqualData } from "./isDeepEqualData.js";
4
- test("checks if two primitives are equal", async () => {
3
+ it("should check if two primitives are equal", async () => {
5
4
  let x = 1;
6
5
  let y = 1;
7
6
  let result = isDeepEqualData(x, y);
@@ -11,48 +10,48 @@ test("checks if two primitives are equal", async () => {
11
10
  result = isDeepEqualData(x, y);
12
11
  assert.equal(result, false);
13
12
  });
14
- test("returns false for different types", async () => {
13
+ it("should return false for different types", async () => {
15
14
  const obj = { a: 1 };
16
15
  const num = 1;
17
16
  const result = isDeepEqualData(obj, num);
18
17
  assert.equal(result, false);
19
18
  });
20
- test("returns false for null values compared with objects", async () => {
19
+ it("should return false for null values compared with objects", async () => {
21
20
  const obj = { a: 1 };
22
21
  const result = isDeepEqualData(obj, null);
23
22
  assert.equal(result, false);
24
23
  });
25
- test("identifies two equal objects", async () => {
24
+ it("should identify two equal objects", async () => {
26
25
  const obj1 = { a: 1, b: 2 };
27
26
  const obj2 = { a: 1, b: 2 };
28
27
  const result = isDeepEqualData(obj1, obj2);
29
28
  assert.equal(result, true);
30
29
  });
31
- test("identifies two objects with different values", async () => {
30
+ it("should identify two objects with different values", async () => {
32
31
  const obj1 = { a: 1, b: 2 };
33
32
  const obj2 = { a: 1, b: 3 };
34
33
  const result = isDeepEqualData(obj1, obj2);
35
34
  assert.equal(result, false);
36
35
  });
37
- test("identifies two objects with different number of keys", async () => {
36
+ it("should identify two objects with different number of keys", async () => {
38
37
  const obj1 = { a: 1, b: 2 };
39
38
  const obj2 = { a: 1, b: 2, c: 3 };
40
39
  const result = isDeepEqualData(obj1, obj2);
41
40
  assert.equal(result, false);
42
41
  });
43
- test("handles nested objects", async () => {
42
+ it("should handle nested objects", async () => {
44
43
  const obj1 = { a: { c: 1 }, b: 2 };
45
44
  const obj2 = { a: { c: 1 }, b: 2 };
46
45
  const result = isDeepEqualData(obj1, obj2);
47
46
  assert.equal(result, true);
48
47
  });
49
- test("detects inequality in nested objects", async () => {
48
+ it("should detect inequality in nested objects", async () => {
50
49
  const obj1 = { a: { c: 1 }, b: 2 };
51
50
  const obj2 = { a: { c: 2 }, b: 2 };
52
51
  const result = isDeepEqualData(obj1, obj2);
53
52
  assert.equal(result, false);
54
53
  });
55
- test("compares arrays correctly", async () => {
54
+ it("should compare arrays correctly", async () => {
56
55
  const arr1 = [1, 2, 3];
57
56
  const arr2 = [1, 2, 3];
58
57
  const result = isDeepEqualData(arr1, arr2);
@@ -62,18 +61,18 @@ test("compares arrays correctly", async () => {
62
61
  const result2 = isDeepEqualData(arr3, arr4);
63
62
  assert.equal(result2, false);
64
63
  });
65
- test("returns false for null comparison with object", () => {
64
+ it("should return false for null comparison with object", () => {
66
65
  const obj = { a: 1 };
67
66
  const result = isDeepEqualData(obj, null);
68
67
  assert.equal(result, false);
69
68
  });
70
- test("distinguishes between array and object with same enumerable properties", () => {
69
+ it("should distinguish between array and object with same enumerable properties", () => {
71
70
  const obj = { 0: "one", 1: "two", length: 2 };
72
71
  const arr = ["one", "two"];
73
72
  const result = isDeepEqualData(obj, arr);
74
73
  assert.equal(result, false);
75
74
  });
76
- test("returns false when comparing objects with different prototypes", () => {
75
+ it("should return false when comparing objects with different prototypes", () => {
77
76
  const obj1 = Object.create({ a: 1 });
78
77
  const obj2 = Object.create(null);
79
78
  obj1.b = 2;
@@ -81,14 +80,14 @@ test("returns false when comparing objects with different prototypes", () => {
81
80
  const result = isDeepEqualData(obj1, obj2);
82
81
  assert.equal(result, false);
83
82
  });
84
- test("handles date object comparisons correctly", () => {
83
+ it("should handle date object comparisons correctly", () => {
85
84
  const date1 = new Date(2000, 0, 1);
86
85
  const date2 = new Date(2000, 0, 1);
87
86
  const date3 = new Date(2000, 0, 2);
88
87
  assert.equal(isDeepEqualData(date1, date2), true);
89
88
  assert.equal(isDeepEqualData(date1, date3), false);
90
89
  });
91
- test("handles function comparisons", () => {
90
+ it("should handle function comparisons", () => {
92
91
  const func1 = () => {
93
92
  console.log("hello");
94
93
  };
@@ -1,58 +1,57 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const vitest_1 = require("vitest");
4
3
  const runSafe_js_1 = require("./runSafe.cjs");
5
- (0, vitest_1.test)("catch thrown error in sync function", async () => {
4
+ it("should catch thrown error in sync function", async () => {
6
5
  const error = new Error("test error");
7
6
  const result = await (0, runSafe_js_1.runSafe)(() => {
8
7
  throw error;
9
8
  });
10
- (0, vitest_1.expect)(result).toEqual({
9
+ expect(result).toEqual({
11
10
  ok: false,
12
11
  error,
13
12
  });
14
13
  });
15
- (0, vitest_1.test)("catch thrown string in sync function", async () => {
14
+ it("should catch thrown string in sync function", async () => {
16
15
  const result = await (0, runSafe_js_1.runSafe)(() => {
17
16
  throw "test error";
18
17
  });
19
- (0, vitest_1.expect)(result).toEqual({
18
+ expect(result).toEqual({
20
19
  ok: false,
21
20
  error: "test error",
22
21
  });
23
22
  });
24
- (0, vitest_1.test)("catch thrown error in async function", async () => {
23
+ it("should catch thrown error in async function", async () => {
25
24
  const error = new Error("test error");
26
25
  const result = await (0, runSafe_js_1.runSafe)(async () => {
27
26
  throw error;
28
27
  });
29
- (0, vitest_1.expect)(result).toEqual({
28
+ expect(result).toEqual({
30
29
  ok: false,
31
30
  error,
32
31
  });
33
32
  });
34
- (0, vitest_1.test)("catch thrown string in async function", async () => {
33
+ it("should catch thrown string in async function", async () => {
35
34
  const result = await (0, runSafe_js_1.runSafe)(async () => {
36
35
  throw "test error";
37
36
  });
38
- (0, vitest_1.expect)(result).toEqual({
37
+ expect(result).toEqual({
39
38
  ok: false,
40
39
  error: "test error",
41
40
  });
42
41
  });
43
- (0, vitest_1.test)("catch rejected Promise", async () => {
42
+ it("should catch rejected Promise", async () => {
44
43
  const error = new Error("test error");
45
44
  const result = await (0, runSafe_js_1.runSafe)(async () => {
46
45
  return Promise.reject(error);
47
46
  });
48
- (0, vitest_1.expect)(result).toEqual({
47
+ expect(result).toEqual({
49
48
  ok: false,
50
49
  error,
51
50
  });
52
51
  });
53
- (0, vitest_1.test)("no error", async () => {
52
+ it("should not throw error", async () => {
54
53
  const result = await (0, runSafe_js_1.runSafe)(async () => "result");
55
- (0, vitest_1.expect)(result).toEqual({
54
+ expect(result).toEqual({
56
55
  ok: true,
57
56
  value: "result",
58
57
  });
@@ -1,6 +1,5 @@
1
- import { expect, test } from "vitest";
2
1
  import { runSafe } from "./runSafe.js";
3
- test("catch thrown error in sync function", async () => {
2
+ it("should catch thrown error in sync function", async () => {
4
3
  const error = new Error("test error");
5
4
  const result = await runSafe(() => {
6
5
  throw error;
@@ -10,7 +9,7 @@ test("catch thrown error in sync function", async () => {
10
9
  error,
11
10
  });
12
11
  });
13
- test("catch thrown string in sync function", async () => {
12
+ it("should catch thrown string in sync function", async () => {
14
13
  const result = await runSafe(() => {
15
14
  throw "test error";
16
15
  });
@@ -19,7 +18,7 @@ test("catch thrown string in sync function", async () => {
19
18
  error: "test error",
20
19
  });
21
20
  });
22
- test("catch thrown error in async function", async () => {
21
+ it("should catch thrown error in async function", async () => {
23
22
  const error = new Error("test error");
24
23
  const result = await runSafe(async () => {
25
24
  throw error;
@@ -29,7 +28,7 @@ test("catch thrown error in async function", async () => {
29
28
  error,
30
29
  });
31
30
  });
32
- test("catch thrown string in async function", async () => {
31
+ it("should catch thrown string in async function", async () => {
33
32
  const result = await runSafe(async () => {
34
33
  throw "test error";
35
34
  });
@@ -38,7 +37,7 @@ test("catch thrown string in async function", async () => {
38
37
  error: "test error",
39
38
  });
40
39
  });
41
- test("catch rejected Promise", async () => {
40
+ it("should catch rejected Promise", async () => {
42
41
  const error = new Error("test error");
43
42
  const result = await runSafe(async () => {
44
43
  return Promise.reject(error);
@@ -48,7 +47,7 @@ test("catch rejected Promise", async () => {
48
47
  error,
49
48
  });
50
49
  });
51
- test("no error", async () => {
50
+ it("should not throw error", async () => {
52
51
  const result = await runSafe(async () => "result");
53
52
  expect(result).toEqual({
54
53
  ok: true,
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getGlobalFunctionLogging = exports.setGlobalFunctionLogging = void 0;
4
- let globalFunctionLogging = undefined;
5
- function setGlobalFunctionLogging(logLevel) {
6
- globalFunctionLogging = logLevel;
7
- }
8
- exports.setGlobalFunctionLogging = setGlobalFunctionLogging;
9
- function getGlobalFunctionLogging() {
10
- return globalFunctionLogging;
11
- }
12
- exports.getGlobalFunctionLogging = getGlobalFunctionLogging;
@@ -1,3 +0,0 @@
1
- import { FunctionLogging } from "./FunctionOptions.js";
2
- export declare function setGlobalFunctionLogging(logLevel: FunctionLogging): void;
3
- export declare function getGlobalFunctionLogging(): FunctionLogging;
@@ -1,7 +0,0 @@
1
- let globalFunctionLogging = undefined;
2
- export function setGlobalFunctionLogging(logLevel) {
3
- globalFunctionLogging = logLevel;
4
- }
5
- export function getGlobalFunctionLogging() {
6
- return globalFunctionLogging;
7
- }
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getGlobalFunctionObservers = exports.setGlobalFunctionObservers = void 0;
4
- let globalFunctionObservers = [];
5
- function setGlobalFunctionObservers(functionObservers) {
6
- globalFunctionObservers = functionObservers;
7
- }
8
- exports.setGlobalFunctionObservers = setGlobalFunctionObservers;
9
- function getGlobalFunctionObservers() {
10
- return globalFunctionObservers;
11
- }
12
- exports.getGlobalFunctionObservers = getGlobalFunctionObservers;
@@ -1,3 +0,0 @@
1
- import { FunctionObserver } from "./FunctionObserver.js";
2
- export declare function setGlobalFunctionObservers(functionObservers: FunctionObserver[]): void;
3
- export declare function getGlobalFunctionObservers(): FunctionObserver[];
@@ -1,7 +0,0 @@
1
- let globalFunctionObservers = [];
2
- export function setGlobalFunctionObservers(functionObservers) {
3
- globalFunctionObservers = functionObservers;
4
- }
5
- export function getGlobalFunctionObservers() {
6
- return globalFunctionObservers;
7
- }