@empiricalrun/test-gen 0.52.6 → 0.52.8
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 +17 -0
- package/dist/agent/chat/index.js +1 -1
- package/dist/bin/index.js +7 -3
- package/dist/bin/utils/index.d.ts +1 -0
- package/dist/bin/utils/index.d.ts.map +1 -1
- package/dist/bin/utils/index.js +37 -1
- package/dist/reporter/index.d.ts.map +1 -1
- package/dist/reporter/index.js +0 -1
- package/dist/tools/test-gen-browser.d.ts.map +1 -1
- package/dist/tools/test-gen-browser.js +16 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @empiricalrun/test-gen
|
|
2
2
|
|
|
3
|
+
## 0.52.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 40b4619: fix: update browser agent prompt for todo prep
|
|
8
|
+
- 7026a35: fix: missing package.json for cli launch
|
|
9
|
+
|
|
10
|
+
## 0.52.7
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- b7115ea: feat: add ascii art banner to cli
|
|
15
|
+
- 3d634c9: feat: added disk persistence for gemini
|
|
16
|
+
- Updated dependencies [cebf4dc]
|
|
17
|
+
- Updated dependencies [3d634c9]
|
|
18
|
+
- @empiricalrun/llm@0.13.5
|
|
19
|
+
|
|
3
20
|
## 0.52.6
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/agent/chat/index.js
CHANGED
|
@@ -37,7 +37,7 @@ function createChatModel(useDiskForChatState, selectedModel) {
|
|
|
37
37
|
return new chat_1.ClaudeChatModel(useDiskForChatState);
|
|
38
38
|
}
|
|
39
39
|
if (selectedModel.startsWith("gemini")) {
|
|
40
|
-
return new chat_1.GeminiChatModel();
|
|
40
|
+
return new chat_1.GeminiChatModel(useDiskForChatState);
|
|
41
41
|
}
|
|
42
42
|
throw new Error(`Unsupported model: ${selectedModel}`);
|
|
43
43
|
}
|
package/dist/bin/index.js
CHANGED
|
@@ -187,9 +187,9 @@ async function runAgentsWorkflow(testGenConfig, testGenToken) {
|
|
|
187
187
|
}
|
|
188
188
|
return agent;
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
async function main() {
|
|
191
191
|
const removeListeners = setupProcessListeners(flushEvents);
|
|
192
|
-
|
|
192
|
+
(0, utils_2.printBanner)();
|
|
193
193
|
const program = new commander_1.Command();
|
|
194
194
|
program
|
|
195
195
|
.option("--token <token>", "Test generation token")
|
|
@@ -256,4 +256,8 @@ async function runAgentsWorkflow(testGenConfig, testGenToken) {
|
|
|
256
256
|
else {
|
|
257
257
|
process.exit(0);
|
|
258
258
|
}
|
|
259
|
-
}
|
|
259
|
+
}
|
|
260
|
+
main().catch((error) => {
|
|
261
|
+
console.error("Unhandled error in main function:", error);
|
|
262
|
+
process.exit(1);
|
|
263
|
+
});
|
|
@@ -10,4 +10,5 @@ export interface CliOptions {
|
|
|
10
10
|
chatModel?: "claude-3-7" | "3-7" | "claude-3-5" | "3-5" | "claude-3-7-sonnet-20250219" | "claude-3-5-sonnet-20241022" | "gemini-2.5-pro-preview-03-25";
|
|
11
11
|
}
|
|
12
12
|
export declare function validateAndCompleteCliOptions(options: CliOptions): Promise<CliOptions>;
|
|
13
|
+
export declare function printBanner(): void;
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EACN,YAAY,GACZ,KAAK,GACL,YAAY,GACZ,KAAK,GACL,4BAA4B,GAC5B,4BAA4B,GAC5B,8BAA8B,CAAC;CACpC;AAQD,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC,CAyDrB"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EACN,YAAY,GACZ,KAAK,GACL,YAAY,GACZ,KAAK,GACL,4BAA4B,GAC5B,4BAA4B,GAC5B,8BAA8B,CAAC;CACpC;AAQD,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC,CAyDrB;AAED,wBAAgB,WAAW,SAgC1B"}
|
package/dist/bin/utils/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.validateAndCompleteCliOptions = void 0;
|
|
6
|
+
exports.printBanner = exports.validateAndCompleteCliOptions = void 0;
|
|
7
7
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
8
8
|
async function validateAndCompleteCliOptions(options) {
|
|
9
9
|
// For existing flow between dashboard <> test-gen (via ci-worker)
|
|
@@ -61,3 +61,39 @@ async function validateAndCompleteCliOptions(options) {
|
|
|
61
61
|
return options;
|
|
62
62
|
}
|
|
63
63
|
exports.validateAndCompleteCliOptions = validateAndCompleteCliOptions;
|
|
64
|
+
function printBanner() {
|
|
65
|
+
const gray = "\x1b[90m";
|
|
66
|
+
const reset = "\x1b[0m";
|
|
67
|
+
const asciiArtRaw = `
|
|
68
|
+
,_,
|
|
69
|
+
{o,o}
|
|
70
|
+
/)__)
|
|
71
|
+
--"-"-`;
|
|
72
|
+
const version = require("../../../package.json").version;
|
|
73
|
+
const logLine1 = `Running test-gen v${version}`;
|
|
74
|
+
const logLine2 = `from ${__dirname}`;
|
|
75
|
+
// Process ASCII art
|
|
76
|
+
const asciiLines = asciiArtRaw
|
|
77
|
+
.split("\n")
|
|
78
|
+
.filter((line) => line.trim() !== "");
|
|
79
|
+
const maxWidth = Math.max(...asciiLines.map((line) => line.length));
|
|
80
|
+
const middleIndex = Math.floor(asciiLines.length / 2);
|
|
81
|
+
const spacing = " "; // 4 spaces for padding
|
|
82
|
+
// Print formatted output (art default, logs gray)
|
|
83
|
+
asciiLines.forEach((line, index) => {
|
|
84
|
+
const paddedLine = line.padEnd(maxWidth, " ");
|
|
85
|
+
if (index === middleIndex) {
|
|
86
|
+
// Print art line (default color) + first log line (gray)
|
|
87
|
+
console.log(`${paddedLine}${spacing}${gray}${logLine1}${reset}`);
|
|
88
|
+
}
|
|
89
|
+
else if (index === middleIndex + 1) {
|
|
90
|
+
// Print corresponding art line (default color) + second log line (gray)
|
|
91
|
+
console.log(`${paddedLine}${spacing}${gray}${logLine2}${reset}`);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// Print other art lines (default color)
|
|
95
|
+
console.log(paddedLine);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
exports.printBanner = printBanner;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reporter/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAkB,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjD,KAAK,kBAAkB,GAAG;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAKF,wBAAgB,WAAW,IAAI,QAAQ,GAAG,SAAS,CAUlD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reporter/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAkB,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjD,KAAK,kBAAkB,GAAG;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAKF,wBAAgB,WAAW,IAAI,QAAQ,GAAG,SAAS,CAUlD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAElE;AAED,qBAAa,sBAAsB;IACjC,OAAO,CAAC,OAAO,CAAS;;IAKlB,eAAe,CAAC,EACpB,eAAe,EACf,QAAQ,GACT,EAAE;QACD,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC;KAClB;IAgDK,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA8C9C,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY3C,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY1C,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAWxD"}
|
package/dist/reporter/index.js
CHANGED
|
@@ -29,7 +29,6 @@ exports.getReporter = getReporter;
|
|
|
29
29
|
* method won't throw error if it fails to report
|
|
30
30
|
*/
|
|
31
31
|
function setReporterConfig(config) {
|
|
32
|
-
console.info("initialised reporter config");
|
|
33
32
|
reporterConfig = config;
|
|
34
33
|
}
|
|
35
34
|
exports.setReporterConfig = setReporterConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-gen-browser.d.ts","sourceRoot":"","sources":["../../src/tools/test-gen-browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"test-gen-browser.d.ts","sourceRoot":"","sources":["../../src/tools/test-gen-browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAwEnD,eAAO,MAAM,4BAA4B,EAAE,IA0E1C,CAAC"}
|
|
@@ -46,8 +46,22 @@ For the above file, the browser environment will execute the steps before the TO
|
|
|
46
46
|
to the browser agent. The agent will do the actions described in the TODO comment and then resume control back to the
|
|
47
47
|
test code.
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
Note that you CANNOT add TODO comments in the middle of a multi-line statement. This will break the tool.
|
|
50
|
+
|
|
51
|
+
For example, this is invalid:
|
|
52
|
+
|
|
53
|
+
\`\`\`
|
|
54
|
+
await extPage
|
|
55
|
+
.getByTestId("virtuoso-item-list")
|
|
56
|
+
// TODO(agent): Click on the STARS button
|
|
57
|
+
.getByText("STARS", { exact: true })
|
|
58
|
+
.click();
|
|
59
|
+
// This is invalid, because the TODO is in the middle of a multi-line statement
|
|
60
|
+
// Instead, add the TODO before or after the multi-line statement
|
|
61
|
+
\`\`\`
|
|
62
|
+
|
|
63
|
+
After execution, the browser agent will return a summary of actions that it took, and the generated Playwright code for them.
|
|
64
|
+
You can then use the text editor tool to replace the TODO comment with the generated Playwright code.
|
|
51
65
|
`;
|
|
52
66
|
exports.generateTestWithBrowserAgent = {
|
|
53
67
|
schema: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/test-gen",
|
|
3
|
-
"version": "0.52.
|
|
3
|
+
"version": "0.52.8",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"tsx": "^4.16.2",
|
|
69
69
|
"typescript": "^5.3.3",
|
|
70
70
|
"zod": "^3.23.8",
|
|
71
|
-
"@empiricalrun/llm": "^0.13.
|
|
71
|
+
"@empiricalrun/llm": "^0.13.5",
|
|
72
72
|
"@empiricalrun/r2-uploader": "^0.3.8",
|
|
73
73
|
"@empiricalrun/test-run": "^0.7.6"
|
|
74
74
|
},
|