@empiricalrun/test-gen 0.38.35 → 0.38.37
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,18 @@
|
|
|
1
1
|
# @empiricalrun/test-gen
|
|
2
2
|
|
|
3
|
+
## 0.38.37
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e9daf03: chore: log line when update flow output is dropped
|
|
8
|
+
- a552a6e: fix: convert trace url into hyperlink for coding agent
|
|
9
|
+
|
|
10
|
+
## 0.38.36
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- c7c0cc7: feat: migrate from testcase to session for test generation
|
|
15
|
+
|
|
3
16
|
## 0.38.35
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-flow.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/update-flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAiB3B,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAI7D,KAAK,eAAe,GAAG,QAAQ,GAAG;IAChC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;
|
|
1
|
+
{"version":3,"file":"update-flow.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/update-flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAiB3B,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAI7D,KAAK,eAAe,GAAG,QAAQ,GAAG;IAChC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AA2IF,wBAAsB,2BAA2B,CAAC,EAChD,QAAQ,EACR,eAAe,EACf,SAAS,EACT,SAAS,EACT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BAAoB,CAAC;IAC/B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CA4C7B"}
|
|
@@ -81,7 +81,12 @@ async function applyFileChanges({ validateTypes = true, trace, testCase, fileCha
|
|
|
81
81
|
// since we dont know what is getting updated,
|
|
82
82
|
// we believe that the patch is correct and contains few before and after lines
|
|
83
83
|
// to make the change unique for search & replace
|
|
84
|
-
|
|
84
|
+
if (contents.includes(fileChange.oldCode)) {
|
|
85
|
+
contents = contents.replace(fileChange.oldCode, `\n\n${fileChange.newCode}`);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
logger.error(`Unable to find the code to update in ${fileChange.filePath}`);
|
|
89
|
+
}
|
|
85
90
|
}
|
|
86
91
|
await fs_extra_1.default.writeFile(fileChange.filePath, contents, "utf-8");
|
|
87
92
|
readWriteFileSpan?.end({ output: { contents } });
|
|
@@ -194,7 +199,7 @@ async function updateTest(testCase, file, options, logging = true, validate = tr
|
|
|
194
199
|
nonSpecFilePrompt: nonSpecFilePrompt,
|
|
195
200
|
});
|
|
196
201
|
if (trace) {
|
|
197
|
-
logger.log(`
|
|
202
|
+
logger.log(`View [trace](${trace.getTraceUrl()})`);
|
|
198
203
|
}
|
|
199
204
|
generatedTestCases.push({
|
|
200
205
|
...testCase,
|
|
@@ -332,7 +337,7 @@ async function appendCreateTestBlock({ testCase, file, options, trace, validateT
|
|
|
332
337
|
validateTypes,
|
|
333
338
|
});
|
|
334
339
|
if (trace) {
|
|
335
|
-
logger.log(`
|
|
340
|
+
logger.log(`View [trace](${trace.getTraceUrl()})`);
|
|
336
341
|
}
|
|
337
342
|
generatedTestCases.push({
|
|
338
343
|
...testCase,
|
package/dist/bin/index.js
CHANGED
|
@@ -12,7 +12,6 @@ const run_2 = require("../agent/codegen/run");
|
|
|
12
12
|
const infer_agent_1 = require("../agent/infer-agent");
|
|
13
13
|
const run_3 = require("../agent/planner/run");
|
|
14
14
|
const reporter_1 = require("../reporter");
|
|
15
|
-
const ci_1 = require("../reporter/ci");
|
|
16
15
|
const session_1 = require("../session");
|
|
17
16
|
const test_build_1 = require("../test-build");
|
|
18
17
|
const logger_1 = require("./logger");
|
|
@@ -141,7 +140,6 @@ async function runAgent(testGenConfig) {
|
|
|
141
140
|
});
|
|
142
141
|
}
|
|
143
142
|
// TODO: move these reporters to a better lifecycle
|
|
144
|
-
await (0, ci_1.reportOnCI)(testGenConfig.testCase);
|
|
145
143
|
await (0, llm_1.flushAllTraces)();
|
|
146
144
|
await (0, logger_1.waitForLogsToFlush)();
|
|
147
145
|
await (0, session_1.endSession)();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/test-gen",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.37",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
"ts-morph": "^24.0.0",
|
|
72
72
|
"tsx": "^4.16.2",
|
|
73
73
|
"typescript": "^5.3.3",
|
|
74
|
+
"@empiricalrun/r2-uploader": "^0.3.7",
|
|
74
75
|
"@empiricalrun/reporter": "^0.21.4",
|
|
75
|
-
"@empiricalrun/llm": "^0.9.28"
|
|
76
|
-
"@empiricalrun/r2-uploader": "^0.3.7"
|
|
76
|
+
"@empiricalrun/llm": "^0.9.28"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@types/detect-port": "^1.3.5",
|
package/dist/reporter/ci.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ci.d.ts","sourceRoot":"","sources":["../../src/reporter/ci.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGpC,wBAAsB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAWtE"}
|
package/dist/reporter/ci.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.reportOnCI = void 0;
|
|
27
|
-
const core = __importStar(require("@actions/core"));
|
|
28
|
-
const slug_1 = require("../utils/slug");
|
|
29
|
-
async function reportOnCI(testCase) {
|
|
30
|
-
if (process.env.CI) {
|
|
31
|
-
const slug = await (0, slug_1.asyncGenerateRandomSlug)(10);
|
|
32
|
-
const branchName = `test-${testCase.id}-${slug}`;
|
|
33
|
-
const scenariosOutput = `**Scenario:** ${testCase.name} \n\n**Steps:**\n - ${testCase.steps.join("\n - ")}`;
|
|
34
|
-
core.setOutput("summary", scenariosOutput);
|
|
35
|
-
core.setOutput("test_names", testCase.name);
|
|
36
|
-
core.setOutput("branch_name", branchName);
|
|
37
|
-
}
|
|
38
|
-
return testCase;
|
|
39
|
-
}
|
|
40
|
-
exports.reportOnCI = reportOnCI;
|