@empiricalrun/test-gen 0.7.0 → 0.7.2
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 +13 -0
- package/dist/bin/ai/trace/index.d.ts +1 -0
- package/dist/bin/ai/trace/index.d.ts.map +1 -1
- package/dist/bin/ai/trace/index.js +3 -0
- package/dist/bin/index.js +7 -3
- package/dist/bin/logger/index.js +2 -2
- package/dist/bin/utils/platform/web/index.d.ts.map +1 -1
- package/dist/bin/utils/platform/web/index.js +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @empiricalrun/test-gen
|
|
2
2
|
|
|
3
|
+
## 0.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9c3ee14: fix: import statements not getting detected correctly
|
|
8
|
+
- 6ec6f56: fix: flag getting picked incorrectly
|
|
9
|
+
|
|
10
|
+
## 0.7.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 0aaf594: fix: make it easier to open trace
|
|
15
|
+
|
|
3
16
|
## 0.7.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/ai/trace/index.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAe5B,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,OAAO,CAAC,KAAK,CAAsB;gBACvB,EAAE,IAAuB,EAAE,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAO;IAS/D,IAAI,EAAE,WAEL;IAED,KAAK,CAAC,EACJ,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,GACP,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,GAAG,CAA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d;IAID,MAAM,CAAC,EACL,KAAU,EACV,MAAW,EACX,QAAa,GACd,EAAE;QACD,KAAK,CAAC,EAAE,GAAG,CAAC;QACZ,MAAM,CAAC,EAAE,GAAG,CAAC;QACb,QAAQ,CAAC,EAAE,GAAG,CAAC;KAChB;IAID,SAAS,CACP,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAC/B,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;;oBAIJ,OAAO,MAAM,EAAE,GAAG,CAAC;;;IAMnD,eAAe,CAAC,EACd,IAAS,EACT,KAAU,EACV,UAAe,EACf,KAAU,GACX,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAChC,KAAK,EAAE,GAAG,CAAC;KACZ;;oBAYa,MAAM;;cAEZ,IAAI;;CAcb"}
|
package/dist/bin/index.js
CHANGED
|
@@ -83,7 +83,11 @@ async function generateTest(scenarios, file, isUpdate) {
|
|
|
83
83
|
counter += 1;
|
|
84
84
|
if (counter > maxIteration) {
|
|
85
85
|
trace.event({ name: "code-fix-iteration-max-out" });
|
|
86
|
-
logger.error(
|
|
86
|
+
logger.error([
|
|
87
|
+
`Unable to fix typescript errors. Please review ${file} manually and fix the typescript errors.`,
|
|
88
|
+
`Run the test-gen command again, once errors are fixed.`,
|
|
89
|
+
`[Trace: ${trace.url}]`,
|
|
90
|
+
].join("\n"));
|
|
87
91
|
break;
|
|
88
92
|
}
|
|
89
93
|
trace.event({ name: "Found errors fixing" });
|
|
@@ -115,7 +119,7 @@ async function generateTest(scenarios, file, isUpdate) {
|
|
|
115
119
|
}
|
|
116
120
|
trace.event({ name: "format-file" });
|
|
117
121
|
await (0, web_1.formatCode)(file);
|
|
118
|
-
logger.success("File formatted successfully!", `[Trace: ${trace.
|
|
122
|
+
logger.success("File formatted successfully!", `[Trace: ${trace.url}]`);
|
|
119
123
|
generatedScenarios.push(scenario);
|
|
120
124
|
trace.update({ input: { scenario }, output: { response } });
|
|
121
125
|
}
|
|
@@ -127,7 +131,7 @@ async function generateTest(scenarios, file, isUpdate) {
|
|
|
127
131
|
process.exit(1);
|
|
128
132
|
}
|
|
129
133
|
const scenariosPath = process.argv[2];
|
|
130
|
-
const scenario = process.argv[3];
|
|
134
|
+
const scenario = process.argv[3] === "-u" ? "" : process.argv[3];
|
|
131
135
|
const isUpdate = process.argv.includes("-u");
|
|
132
136
|
let testGenConfigs = await (0, scenarios_1.generateScenarios)(scenariosPath);
|
|
133
137
|
if (scenario) {
|
package/dist/bin/logger/index.js
CHANGED
|
@@ -4,10 +4,10 @@ exports.CustomLogger = void 0;
|
|
|
4
4
|
const picocolors_1 = require("picocolors");
|
|
5
5
|
class CustomLogger {
|
|
6
6
|
log(message, ...optionalParams) {
|
|
7
|
-
console.log("🪵
|
|
7
|
+
console.log("🪵", (0, picocolors_1.cyan)(message), ...optionalParams);
|
|
8
8
|
}
|
|
9
9
|
warn(message, ...optionalParams) {
|
|
10
|
-
console.log("🟡
|
|
10
|
+
console.log("🟡", (0, picocolors_1.yellow)(message), ...optionalParams);
|
|
11
11
|
}
|
|
12
12
|
success(message, ...optionalParams) {
|
|
13
13
|
console.log("✅", (0, picocolors_1.green)(message), ...optionalParams);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/bin/utils/platform/web/index.ts"],"names":[],"mappings":"AAKA,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,0BAG3E;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAwC7D;AAED,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/bin/utils/platform/web/index.ts"],"names":[],"mappings":"AAKA,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,0BAG3E;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAwC7D;AAED,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,qBAM3D;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,iBAOhD;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,iBAQhD"}
|
|
@@ -52,8 +52,9 @@ function validateTypescript(filePath) {
|
|
|
52
52
|
}
|
|
53
53
|
exports.validateTypescript = validateTypescript;
|
|
54
54
|
async function stripAndPrependImports(content) {
|
|
55
|
-
const
|
|
56
|
-
const
|
|
55
|
+
const importRegexp = /import\s+\{[^}]*\}\s+from\s+["'][^"']+["'];?/g;
|
|
56
|
+
const imports = content.match(importRegexp);
|
|
57
|
+
const strippedContent = content.replace(importRegexp, "");
|
|
57
58
|
const prependContent = (imports?.join("\n") || "") + "\n\n";
|
|
58
59
|
return [prependContent, strippedContent];
|
|
59
60
|
}
|