@aigne/test-utils 0.5.2 → 0.5.3
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 +14 -0
- package/lib/run-example-test.d.ts +1 -3
- package/lib/run-example-test.js +8 -26
- package/package.json +2 -2
- package/src/run-example-test.ts +8 -32
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.5.3](https://github.com/AIGNE-io/aigne-framework/compare/test-utils-v0.5.2...test-utils-v0.5.3) (2025-07-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **model:** ensure last message is not system role for gemini ([#231](https://github.com/AIGNE-io/aigne-framework/issues/231)) ([1b72e1e](https://github.com/AIGNE-io/aigne-framework/commit/1b72e1e6be98060aa32e68585142b2eea401d109))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @aigne/core bumped to 1.32.1
|
|
16
|
+
|
|
3
17
|
## [0.5.2](https://github.com/AIGNE-io/aigne-framework/compare/test-utils-v0.5.1...test-utils-v0.5.2) (2025-07-08)
|
|
4
18
|
|
|
5
19
|
|
package/lib/run-example-test.js
CHANGED
|
@@ -1,30 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
export function runExampleTest(config) {
|
|
3
|
+
export async function runExampleTest(config) {
|
|
4
4
|
const scriptPath = config?.scriptPath ?? join(process.cwd(), "index.ts");
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
env
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
let stdout = "";
|
|
14
|
-
let stderr = "";
|
|
15
|
-
child.stdout.on("data", (data) => {
|
|
16
|
-
// GitHub Action runner is not a TTY, avoid writing to stdout to prevent long ANSI output. https://github.com/actions/runner/issues/241
|
|
17
|
-
stdout += data;
|
|
18
|
-
});
|
|
19
|
-
child.stderr.on("data", (data) => {
|
|
20
|
-
process.stderr.write(data);
|
|
21
|
-
stderr += data;
|
|
22
|
-
});
|
|
23
|
-
child.on("close", (code) => {
|
|
24
|
-
resolve({ stdout, stderr, code });
|
|
25
|
-
});
|
|
26
|
-
child.on("error", (err) => {
|
|
27
|
-
reject(err);
|
|
28
|
-
});
|
|
5
|
+
return spawnSync("bun", [scriptPath], {
|
|
6
|
+
stdio: ["inherit", "inherit", "inherit"],
|
|
7
|
+
env: {
|
|
8
|
+
...process.env,
|
|
9
|
+
INITIAL_CALL: config?.initialCall ?? process.env.INITIAL_CALL,
|
|
10
|
+
},
|
|
29
11
|
});
|
|
30
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/test-utils",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Test utils for AIGNE framework",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aigne/core": "^1.32.
|
|
27
|
+
"@aigne/core": "^1.32.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/bun": "^1.2.17",
|
package/src/run-example-test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
|
|
4
4
|
export interface TestConfig {
|
|
@@ -6,38 +6,14 @@ export interface TestConfig {
|
|
|
6
6
|
scriptPath?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export function runExampleTest(
|
|
10
|
-
config?: TestConfig,
|
|
11
|
-
): Promise<{ stdout: string; stderr: string; code: number | null }> {
|
|
9
|
+
export async function runExampleTest(config?: TestConfig): Promise<{ status: number | null }> {
|
|
12
10
|
const scriptPath = config?.scriptPath ?? join(process.cwd(), "index.ts");
|
|
13
|
-
return new Promise((resolve, reject) => {
|
|
14
|
-
const child = spawn("bun", [scriptPath], {
|
|
15
|
-
stdio: ["inherit", "pipe", "pipe"],
|
|
16
|
-
env: {
|
|
17
|
-
...process.env,
|
|
18
|
-
INITIAL_CALL: config?.initialCall ?? process.env.INITIAL_CALL,
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
11
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
child.stderr.on("data", (data) => {
|
|
31
|
-
process.stderr.write(data);
|
|
32
|
-
stderr += data;
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
child.on("close", (code) => {
|
|
36
|
-
resolve({ stdout, stderr, code });
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
child.on("error", (err) => {
|
|
40
|
-
reject(err);
|
|
41
|
-
});
|
|
12
|
+
return spawnSync("bun", [scriptPath], {
|
|
13
|
+
stdio: ["inherit", "inherit", "inherit"],
|
|
14
|
+
env: {
|
|
15
|
+
...process.env,
|
|
16
|
+
INITIAL_CALL: config?.initialCall ?? process.env.INITIAL_CALL,
|
|
17
|
+
},
|
|
42
18
|
});
|
|
43
19
|
}
|