@empiricalrun/test-gen 0.22.3 → 0.22.4

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,16 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.22.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 2b9cf45: fix: text for agent being used
8
+ - 1274236: fix: langfuse missing spans
9
+ - Updated dependencies [1274236]
10
+ - Updated dependencies [28d91a9]
11
+ - @empiricalrun/llm@0.7.2
12
+ - @empiricalrun/reporter@0.17.0
13
+
3
14
  ## 0.22.3
4
15
 
5
16
  ### Patch Changes
package/dist/bin/index.js CHANGED
@@ -16,6 +16,7 @@ const utils_2 = require("./utils");
16
16
  dotenv_1.default.config({
17
17
  path: [".env.local", ".env"],
18
18
  });
19
+ process.on("beforeExit", async () => await (0, llm_1.flushAllTraces)());
19
20
  process.on("exit", async () => await (0, llm_1.flushAllTraces)());
20
21
  process.on("SIGINT", async () => await (0, llm_1.flushAllTraces)());
21
22
  process.on("SIGTERM", async () => await (0, llm_1.flushAllTraces)());
@@ -24,7 +25,7 @@ async function runAgent(sourceFile, testGenConfig) {
24
25
  const { specPath, testCase } = testGenConfig;
25
26
  if (testGenConfig.options?.agent !== "code") {
26
27
  // this assumes we have only one scenario in test config
27
- logger.success("Generating test using browsing agent");
28
+ logger.success(`Generating test using ${testGenConfig.options?.agent} agent`);
28
29
  await (0, utils_1.prepareFileForBrowsingAgent)(testGenConfig);
29
30
  await (0, run_1.generateTestsUsingBrowsingAgent)(specPath);
30
31
  await (0, reporter_1.reportTestGenVideos)({
@@ -53,5 +54,7 @@ async function runAgent(sourceFile, testGenConfig) {
53
54
  await runAgent(sourceFile, testGenConfig);
54
55
  // TODO: move these reporters to a better lifecycle
55
56
  await (0, ci_1.reportOnCI)(testGenConfig.testCase);
57
+ await (0, llm_1.flushAllTraces)();
58
+ await (0, logger_1.waitForLogsToFlush)();
56
59
  process.exit(0);
57
60
  })();
@@ -10,4 +10,5 @@ export declare class CustomLogger {
10
10
  error(message?: string, ...optionalParams: any[]): void;
11
11
  logEmptyLine(): void;
12
12
  }
13
+ export declare function waitForLogsToFlush(): Promise<void>;
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/logger/index.ts"],"names":[],"mappings":"AAKA,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAkB;gBACzB,EAAE,WAAkB,EAAE;;KAAK;IAIvC,OAAO,CAAC,aAAa;IASrB,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE;IAK9C,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE;IAK/C,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE;IAKlD,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE;IAKhD,YAAY;CAGb"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/logger/index.ts"],"names":[],"mappings":"AAOA,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAkB;gBACzB,EAAE,WAAkB,EAAE;;KAAK;IAIvC,OAAO,CAAC,aAAa;IAYrB,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE;IAK9C,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE;IAK/C,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE;IAKlD,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE;IAKhD,YAAY;CAGb;AAED,wBAAsB,kBAAkB,kBAWvC"}
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CustomLogger = void 0;
3
+ exports.waitForLogsToFlush = exports.CustomLogger = void 0;
4
4
  const reporter_1 = require("@empiricalrun/reporter");
5
5
  const picocolors_1 = require("picocolors");
6
6
  const reporter_2 = require("../../reporter");
7
+ let queuedReporterMessages = [];
7
8
  class CustomLogger {
8
9
  useReporter = false;
9
10
  constructor({ useReporter = true } = {}) {
@@ -11,8 +12,11 @@ class CustomLogger {
11
12
  }
12
13
  logToReporter(message) {
13
14
  if (this.useReporter) {
14
- (async () => {
15
- await (0, reporter_2.getReporter)()?.report(new reporter_1.ProcessLogMessageBuilder({ message: message }));
15
+ (() => {
16
+ const promise = (0, reporter_2.getReporter)()?.report(new reporter_1.ProcessLogMessageBuilder({ message: message }));
17
+ if (promise) {
18
+ queuedReporterMessages.push(promise);
19
+ }
16
20
  })();
17
21
  }
18
22
  }
@@ -37,3 +41,17 @@ class CustomLogger {
37
41
  }
38
42
  }
39
43
  exports.CustomLogger = CustomLogger;
44
+ async function waitForLogsToFlush() {
45
+ if (queuedReporterMessages.length === 0) {
46
+ return;
47
+ }
48
+ try {
49
+ await Promise.all(queuedReporterMessages);
50
+ }
51
+ catch (e) {
52
+ console.warn("Error while flushing logs", e);
53
+ // resolving this as this is not a critical operation
54
+ return Promise.resolve();
55
+ }
56
+ }
57
+ exports.waitForLogsToFlush = waitForLogsToFlush;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAWlC,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,iBA0BnE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAYlC,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,iBA0BnE"}
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ const browsing_1 = require("./agent/browsing");
9
9
  const utils_1 = require("./bin/utils");
10
10
  const client_1 = __importDefault(require("./file/client"));
11
11
  const reporter_1 = require("./reporter");
12
+ process.on("beforeExit", async () => await (0, llm_1.flushAllTraces)());
12
13
  process.on("exit", async () => await (0, llm_1.flushAllTraces)());
13
14
  process.on("SIGINT", async () => await (0, llm_1.flushAllTraces)());
14
15
  process.on("SIGTERM", async () => await (0, llm_1.flushAllTraces)());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.22.3",
3
+ "version": "0.22.4",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -41,8 +41,8 @@
41
41
  "ts-morph": "^23.0.0",
42
42
  "tsx": "^4.16.2",
43
43
  "typescript": "^5.3.3",
44
- "@empiricalrun/llm": "^0.7.1",
45
- "@empiricalrun/reporter": "^0.16.1"
44
+ "@empiricalrun/llm": "^0.7.2",
45
+ "@empiricalrun/reporter": "^0.17.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/detect-port": "^1.3.5",