@empiricalrun/test-gen 0.46.11 → 0.47.1

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,17 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.47.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 1116d14: feat: run test-gen without requiring an installation step
8
+
9
+ ## 0.47.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 9481edf: fix: import createTest from dist location instead of local package installation
14
+
3
15
  ## 0.46.11
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -1,38 +1,12 @@
1
1
  # test-gen
2
2
 
3
- Our agents that generate Playwright tests. There are 2 agents
4
-
5
- - browsing agent
6
- - code editing agent
7
-
8
3
  ## Usage
9
4
 
10
5
  ```sh
11
- npx @empiricalrun/test-gen --token TEST_GEN_TOKEN
6
+ npx @empiricalrun/test-gen@latest --token TEST_GEN_TOKEN
12
7
  ```
13
8
 
14
- ### Add new test
15
-
16
- ```sh
17
- npx @empiricalrun/test-gen --token TEST_GEN_TOKEN
18
- ```
19
-
20
- - This will trigger browsing agent to write a new test for this scenario
21
- - See [Test gen token: Base64 payload](#test-gen-token-base64-payload)
22
-
23
- ### Update existing test
24
-
25
- ```sh
26
- npx @empiricalrun/test-gen --token TEST_GEN_TOKEN
27
- ```
28
-
29
- - If the test case is already present in the file, the test gen agent will update the existing test as per the steps provided in the payload
30
- - This will trigger code editing agent to write a new test for this scenario
31
- - See [Test gen token: Base64 payload](#test-gen-token-base64-payload)
32
-
33
- ### Test gen token: Base64 payload
34
-
35
- Convert this object into a base64 payload - for new and update test.
9
+ To generate a token, use the below
36
10
 
37
11
  ```js
38
12
  const scenario = {
@@ -46,3 +20,9 @@ const scenario = {
46
20
  };
47
21
  btoa(JSON.stringify(scenario));
48
22
  ```
23
+
24
+ ### During development
25
+
26
+ ```
27
+ npx /path/to/packages/test-gen/.
28
+ ```
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI7E,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAsBvD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,CAKhD;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,UAIvD;AA8FD;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,aAAa,EACxB,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC,CA0DjB;AAyBD,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,iBA2HxD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,QAIjD;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,oBAAoB,CAAC,CAM/B;AAWD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,oBAAoB,EACtC,gBAAgB,GAAE,MAAM,EAAU,GACjC,OAAO,CAAC,MAAM,CAAC,CA+CjB;AAED,qBAAa,eAAe;IACd,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,MAAM;IACrC,OAAO,CAAC,aAAa,CAAqB;YAE5B,mBAAmB;YAUnB,gBAAgB;IAsBjB,OAAO;IAuBb,SAAS;CAKjB"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI7E,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAsBvD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,CAKhD;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,UAIvD;AAwGD;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,aAAa,EACxB,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC,CA0DjB;AAyBD,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,iBA2HxD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,QAIjD;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,oBAAoB,CAAC,CAM/B;AAWD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,oBAAoB,EACtC,gBAAgB,GAAE,MAAM,EAAU,GACjC,OAAO,CAAC,MAAM,CAAC,CA+CjB;AAED,qBAAa,eAAe;IACd,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,MAAM;IACrC,OAAO,CAAC,aAAa,CAAqB;YAE5B,mBAAmB;YAUnB,gBAAgB;IAsBjB,OAAO;IAuBb,SAAS;CAKjB"}
@@ -28,6 +28,15 @@ function prepareBrowsingAgentTask(steps) {
28
28
  return task;
29
29
  }
30
30
  exports.prepareBrowsingAgentTask = prepareBrowsingAgentTask;
31
+ async function addImportForCreateTest(testFilePath) {
32
+ // Instead of using "@empiricalrun/test-gen", we use the local dist file
33
+ // This is to avoid assuming that the test-gen package is installed in the project
34
+ const importSource = path_1.default.join(__dirname, "../../../dist/index.js");
35
+ if (!fs_extra_1.default.existsSync(importSource)) {
36
+ throw new Error(`createTest import source not found at ${importSource}`);
37
+ }
38
+ await fs_extra_1.default.writeFile(testFilePath, (0, web_1.addNewImport)(await fs_extra_1.default.readFile(testFilePath, "utf-8"), ["createTest"], importSource));
39
+ }
31
40
  /**
32
41
  * Function to prepare test file for update scenarios for master agent to run
33
42
  * @param {TestGenConfig} genConfig
@@ -76,7 +85,7 @@ async function prepareFileForUpdateScenario(genConfig, trace) {
76
85
  createTestFilePath,
77
86
  },
78
87
  });
79
- await fs_extra_1.default.writeFile(createTestFilePath, (0, web_1.addNewImport)(await fs_extra_1.default.readFile(createTestFilePath, "utf-8"), ["createTest"], "@empiricalrun/test-gen"));
88
+ await addImportForCreateTest(createTestFilePath);
80
89
  updateFileSpan?.end();
81
90
  const { pomPrompt, nonSpecFilePrompt } = await (0, context_1.contextForGeneration)(createTestFilePath);
82
91
  await (0, fix_ts_errors_1.validateAndFixTypescriptErrors)({
package/dist/bin/index.js CHANGED
@@ -151,6 +151,7 @@ async function runAgent(testGenConfig, testGenToken) {
151
151
  return agent;
152
152
  }
153
153
  (async function main() {
154
+ console.log(`Running test-gen v${require("../../package.json").version} from ${__dirname}`);
154
155
  const program = new commander_1.Command();
155
156
  program
156
157
  .option("--token <token>", "Test generation token")
@@ -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;CACjB;AASD,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC,CAiErB"}
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;AAQD,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC,CAmDrB"}
@@ -35,13 +35,6 @@ async function validateAndCompleteCliOptions(options) {
35
35
  validate: (input) => input.trim().length > 0 || "Test prompt is required",
36
36
  });
37
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
38
  if (questions.length > 0) {
46
39
  // Ask each question individually to avoid type issues
47
40
  const answers = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.46.11",
3
+ "version": "0.47.1",
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
+ "@empiricalrun/reporter": "^0.23.1",
77
77
  "@empiricalrun/r2-uploader": "^0.3.8",
78
- "@empiricalrun/reporter": "^0.23.1"
78
+ "@empiricalrun/llm": "^0.9.35"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@playwright/test": "1.47.1",