@empiricalrun/test-gen 0.46.10 → 0.46.11
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 +6 -0
- package/dist/bin/index.js +7 -7
- package/dist/bin/utils/index.d.ts +1 -1
- package/dist/bin/utils/index.d.ts.map +1 -1
- package/dist/bin/utils/index.js +59 -7
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/bin/index.js
CHANGED
|
@@ -160,13 +160,13 @@ async function runAgent(testGenConfig, testGenToken) {
|
|
|
160
160
|
.option("--suites <suites>", "Comma separated list of describe blocks")
|
|
161
161
|
.parse(process.argv);
|
|
162
162
|
const options = program.opts();
|
|
163
|
-
(0, utils_2.
|
|
164
|
-
const testGenConfig =
|
|
165
|
-
? (0, scenarios_1.loadTestConfigs)(
|
|
166
|
-
: (0, scenarios_1.buildTestConfigFromOptions)(
|
|
167
|
-
const testGenToken =
|
|
168
|
-
?
|
|
169
|
-
: (0, scenarios_1.buildTokenFromOptions)(
|
|
163
|
+
const completedOptions = await (0, utils_2.validateAndCompleteCliOptions)(options);
|
|
164
|
+
const testGenConfig = completedOptions.token
|
|
165
|
+
? (0, scenarios_1.loadTestConfigs)(completedOptions.token)
|
|
166
|
+
: (0, scenarios_1.buildTestConfigFromOptions)(completedOptions);
|
|
167
|
+
const testGenToken = completedOptions.token
|
|
168
|
+
? completedOptions.token
|
|
169
|
+
: (0, scenarios_1.buildTokenFromOptions)(completedOptions);
|
|
170
170
|
(0, reporter_1.setReporterConfig)({
|
|
171
171
|
projectRepoName: testGenConfig.options?.metadata.projectRepoName,
|
|
172
172
|
testSessionId: testGenConfig.options?.metadata.testSessionId,
|
|
@@ -5,5 +5,5 @@ export interface CliOptions {
|
|
|
5
5
|
prompt?: string;
|
|
6
6
|
suites?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function validateAndCompleteCliOptions(options: CliOptions): Promise<CliOptions>;
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"
|
|
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;CACjB;AASD,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC,CAiErB"}
|
package/dist/bin/utils/index.js
CHANGED
|
@@ -1,12 +1,64 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
6
|
+
exports.validateAndCompleteCliOptions = void 0;
|
|
7
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
8
|
+
async function validateAndCompleteCliOptions(options) {
|
|
5
9
|
const hasToken = !!options.token;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
console.error("Invalid arguments. Provide either --token OR all of --name, --file, and --prompt");
|
|
9
|
-
process.exit(1);
|
|
10
|
+
if (hasToken) {
|
|
11
|
+
return options;
|
|
10
12
|
}
|
|
13
|
+
const questions = [];
|
|
14
|
+
if (!options.name) {
|
|
15
|
+
questions.push({
|
|
16
|
+
type: "input",
|
|
17
|
+
name: "name",
|
|
18
|
+
message: "Enter the test name:",
|
|
19
|
+
validate: (input) => input.trim().length > 0 || "Test name is required",
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
if (!options.file) {
|
|
23
|
+
questions.push({
|
|
24
|
+
type: "input",
|
|
25
|
+
name: "file",
|
|
26
|
+
message: "Enter the test file path (inside tests dir):",
|
|
27
|
+
validate: (input) => input.trim().length > 0 || "Test file path is required",
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (!options.prompt) {
|
|
31
|
+
questions.push({
|
|
32
|
+
type: "editor",
|
|
33
|
+
name: "prompt",
|
|
34
|
+
message: "Enter the test prompt (opens in your editor):",
|
|
35
|
+
validate: (input) => input.trim().length > 0 || "Test prompt is required",
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (!options.suites) {
|
|
39
|
+
questions.push({
|
|
40
|
+
type: "input",
|
|
41
|
+
name: "suites",
|
|
42
|
+
message: "Enter comma-separated test suites (optional):",
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (questions.length > 0) {
|
|
46
|
+
// Ask each question individually to avoid type issues
|
|
47
|
+
const answers = {};
|
|
48
|
+
for (const question of questions) {
|
|
49
|
+
const answer = await inquirer_1.default.prompt({
|
|
50
|
+
type: question.type,
|
|
51
|
+
name: "value",
|
|
52
|
+
message: question.message,
|
|
53
|
+
validate: question.validate,
|
|
54
|
+
});
|
|
55
|
+
answers[question.name] = answer.value;
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
...options,
|
|
59
|
+
...answers,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return options;
|
|
11
63
|
}
|
|
12
|
-
exports.
|
|
64
|
+
exports.validateAndCompleteCliOptions = validateAndCompleteCliOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/test-gen",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"ts-morph": "^23.0.0",
|
|
74
74
|
"tsx": "^4.16.2",
|
|
75
75
|
"typescript": "^5.3.3",
|
|
76
|
+
"@empiricalrun/llm": "^0.9.35",
|
|
76
77
|
"@empiricalrun/r2-uploader": "^0.3.8",
|
|
77
|
-
"@empiricalrun/reporter": "^0.23.1"
|
|
78
|
-
"@empiricalrun/llm": "^0.9.35"
|
|
78
|
+
"@empiricalrun/reporter": "^0.23.1"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@playwright/test": "1.47.1",
|