@empiricalrun/test-gen 0.28.3 → 0.28.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,11 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.28.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 2d27074: fix: add test for nested test update
8
+
3
9
  ## 0.28.3
4
10
 
5
11
  ### Patch Changes
@@ -77,7 +77,7 @@ async function generateTest(testCase, file, options) {
77
77
  logger.success("Test generated successfully!");
78
78
  const readWriteFileSpan = trace.span({ name: "write-to-file" });
79
79
  let contents = fs_extra_1.default.readFileSync(file, "utf-8");
80
- const [prependContent, strippedContent] = await (0, web_1.stripAndPrependImports)(response, testCase?.name, testCase?.suites);
80
+ const [prependContent, strippedContent] = await (0, web_1.stripAndPrependImports)(response, testCase?.name, []);
81
81
  let updatedContent = prependContent + contents + `\n\n${strippedContent}`;
82
82
  await fs_extra_1.default.writeFile(file, updatedContent, "utf-8");
83
83
  readWriteFileSpan.end({ output: { updatedContent } });
@@ -23,14 +23,14 @@ async function applyFileChanges({ validateTypes = true, trace, testCase, fileCha
23
23
  const { testBlock: testBlockUpdate } = (0, web_1.getTypescriptTestBlock)({
24
24
  scenarioName: testCase?.name || "",
25
25
  content: fileChange.newCode || "",
26
- suites: testCase?.suites,
26
+ suites: [], // suites should be empty here since we ask LLM to send immediate parent AST node for the code update. so there won't be any nesting here, just the test block
27
27
  });
28
28
  if (testBlockUpdate) {
29
29
  // assuming the test case getting updated
30
30
  // maintaining the previous accuracy of the test case update
31
31
  const readWriteFileSpan = trace.span({ name: "write-to-file" });
32
32
  let contents = await fs_extra_1.default.readFile(fileChange.filePath, "utf-8");
33
- const [prependContent, strippedContent] = await (0, web_1.stripAndPrependImports)(fileChange.newCode, testCase?.name, testCase?.suites);
33
+ const [prependContent, strippedContent] = await (0, web_1.stripAndPrependImports)(fileChange.newCode, testCase?.name, []);
34
34
  let updatedContent = prependContent + contents + `\n\n${strippedContent}`;
35
35
  const { testBlock } = (0, web_1.getTypescriptTestBlock)({
36
36
  scenarioName: testCase?.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.28.3",
3
+ "version": "0.28.4",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -44,8 +44,8 @@
44
44
  "tsx": "^4.16.2",
45
45
  "typescript": "^5.3.3",
46
46
  "@empiricalrun/r2-uploader": "^0.3.0",
47
- "@empiricalrun/reporter": "^0.18.2",
48
- "@empiricalrun/llm": "^0.9.2"
47
+ "@empiricalrun/llm": "^0.9.2",
48
+ "@empiricalrun/reporter": "^0.18.2"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/detect-port": "^1.3.5",
@@ -0,0 +1,10 @@
1
+ import { config as dotenvConfig } from "dotenv";
2
+ import { defineConfig } from "vitest/config";
3
+
4
+ dotenvConfig({ path: [".env.local", ".env"] });
5
+
6
+ export default defineConfig({
7
+ test: {
8
+ setupFiles: ["dotenv/config"],
9
+ },
10
+ });