@empiricalrun/test-gen 0.38.40 → 0.38.43

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,23 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.38.43
4
+
5
+ ### Patch Changes
6
+
7
+ - 05f9a03: fix: apply file changes works without test case context
8
+
9
+ ## 0.38.42
10
+
11
+ ### Patch Changes
12
+
13
+ - 2e5073f: feat: add new session button
14
+
15
+ ## 0.38.41
16
+
17
+ ### Patch Changes
18
+
19
+ - eb46866: test: skip inspiration test that fails a lot
20
+
3
21
  ## 0.38.40
4
22
 
5
23
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"repo-edit.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/repo-edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAarE,wBAAsB,aAAa,CAAC,EAClC,KAAK,EACL,IAAI,GACL,EAAE;IACD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,iBA4IA"}
1
+ {"version":3,"file":"repo-edit.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/repo-edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAarE,wBAAsB,aAAa,CAAC,EAClC,KAAK,EACL,IAAI,GACL,EAAE;IACD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,iBA+IA"}
@@ -68,7 +68,7 @@ Directory structure for the repository:
68
68
  Explanation of repository structure:
69
69
  - tests: this is a directory where all tests and fixtures are kept. all spec files here end with ".spec.ts" as naming convention. There is an expection for Playwright fixtures file. Fixtures file is named as "fixtures.ts"
70
70
  - test-data: this is a directory where all the test data are kept.
71
- - pages: this is a directory where all page object models are kept. the page object models are written in a pure functional convention. this is also a directory where all the utility methods are kept which can be executed independent of the Playwright tests.
71
+ - pages: this is a directory where all reusable page object model methods are kept. Page object model methods are written in a pure functional convention. These methods are reusable methods created to be used across tests. This is also a directory where all the utility methods are kept which can be executed independent of the Playwright tests.
72
72
 
73
73
  Coding principles and guidelines:
74
74
 
@@ -103,7 +103,7 @@ ${repoPrompt}
103
103
  Task: ${task}
104
104
 
105
105
 
106
- Follow these instructions before responding with output:
106
+ ## Follow these instructions before responding with output:
107
107
  - Read the code line by line and ensure that achieve the task provided to you
108
108
  - Read the dependencies of the code block by scanning through file paths and file provided to you. refer the same file path while responding with output.
109
109
  - Focus only on the test case provided and associated JS methods called from the test case.
@@ -116,6 +116,7 @@ Follow these instructions before responding with output:
116
116
  - The reason for change should adhere to coding principles provided and review if the updated code is present in the file path mentioned
117
117
  - The code change should belong to the right file path
118
118
  - The response must start with <file_path>
119
+ - Use the repository structure provided, whenever needed create directories which are not present
119
120
  `,
120
121
  },
121
122
  ];
@@ -146,7 +147,7 @@ Follow these instructions before responding with output:
146
147
  validateTypes: false,
147
148
  trace,
148
149
  testCase: {},
149
- fileChanges: updates,
150
+ fileChanges: updates.filter((f) => f.filePath && fsSync.existsSync(f.filePath)),
150
151
  });
151
152
  // TODO: identify new file updates
152
153
  const newFileUpdates = updates.filter((f) => !fsSync.existsSync(f.filePath));
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAMhD,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAG7D;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG;IACjD,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO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,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,EAAE,CAgBF;AAED,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG;IACvC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,EACrC,aAAoB,EACpB,KAAK,EACL,QAAQ,EACR,WAAW,EACX,MAAM,EACN,cAAc,EACd,SAAS,EACT,iBAAiB,GAClB,EAAE;IACD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE;QACX,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;QAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;QAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;KAC5B,EAAE,CAAC;IACJ,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,iBA4HA"}
@@ -93,11 +93,20 @@ async function applyFileChanges({ validateTypes = true, trace, testCase, fileCha
93
93
  if (!fileChange.filePath) {
94
94
  return;
95
95
  }
96
- const { testBlock: testBlockUpdate } = (0, web_1.getTypescriptTestBlock)({
97
- scenarioName: testCase?.name || "",
98
- content: fileChange.newCode || "",
99
- 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
100
- });
96
+ const hasTestCaseAsUpdateContext = !!testCase?.name;
97
+ let testBlockUpdate = undefined;
98
+ if (hasTestCaseAsUpdateContext) {
99
+ const applyFileChangesSpan = trace?.span({
100
+ name: "apply-file-changes",
101
+ });
102
+ const block = (0, web_1.getTypescriptTestBlock)({
103
+ scenarioName: testCase?.name,
104
+ content: fileChange.newCode || "",
105
+ 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
106
+ });
107
+ testBlockUpdate = block.testBlock;
108
+ applyFileChangesSpan?.end({ output: { testBlock: testBlockUpdate } });
109
+ }
101
110
  if (testBlockUpdate) {
102
111
  // assuming the test case getting updated
103
112
  // maintaining the previous accuracy of the test case update
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.38.40",
3
+ "version": "0.38.43",
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/llm": "^0.9.28",
75
- "@empiricalrun/reporter": "^0.21.6",
76
- "@empiricalrun/r2-uploader": "^0.3.7"
76
+ "@empiricalrun/reporter": "^0.21.6"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@types/detect-port": "^1.3.5",