@empiricalrun/test-gen 0.42.27 → 0.42.28
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/agent/browsing/run.d.ts.map +1 -1
- package/dist/agent/browsing/run.js +25 -0
- package/dist/bin/index.d.ts +1 -1
- package/dist/bin/index.d.ts.map +1 -1
- package/dist/bin/index.js +87 -50
- package/dist/bin/utils/index.d.ts +2 -0
- package/dist/bin/utils/index.d.ts.map +1 -1
- package/dist/bin/utils/index.js +3 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -4
- package/dist/initSentry.d.ts +2 -0
- package/dist/initSentry.d.ts.map +1 -0
- package/dist/initSentry.js +37 -0
- package/dist/test-build/index.d.ts.map +1 -1
- package/dist/test-build/index.js +25 -0
- package/dist/utils/exec.d.ts +2 -0
- package/dist/utils/exec.d.ts.map +1 -1
- package/dist/utils/exec.js +66 -26
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/run.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/run.ts"],"names":[],"mappings":"AAoBA,KAAK,iBAAiB,GAAG;IACvB;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAsB,6BAA6B,CAAC,EAClD,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,GACjB,EAAE,iBAAiB,iBA8EnB"}
|
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
exports.generateTestsUsingMasterAgent = void 0;
|
|
30
|
+
const Sentry = __importStar(require("@sentry/node"));
|
|
7
31
|
const detect_port_1 = __importDefault(require("detect-port"));
|
|
8
32
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
33
|
const utils_1 = require("../../bin/utils");
|
|
@@ -57,6 +81,7 @@ async function generateTestsUsingMasterAgent({ testFilePath, filePathToUpdate, p
|
|
|
57
81
|
PAGE_VAR_NAME: pageVar || "page",
|
|
58
82
|
DISPLAY: ":99",
|
|
59
83
|
},
|
|
84
|
+
span: Sentry.getActiveSpan(),
|
|
60
85
|
});
|
|
61
86
|
}
|
|
62
87
|
catch (e) {
|
package/dist/bin/index.d.ts
CHANGED
package/dist/bin/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":";AAEA,OAAO,eAAe,CAAC"}
|
package/dist/bin/index.js
CHANGED
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
3
26
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
28
|
};
|
|
6
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
require("../initSentry");
|
|
7
31
|
const llm_1 = require("@empiricalrun/llm");
|
|
32
|
+
const Sentry = __importStar(require("@sentry/node"));
|
|
8
33
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
9
34
|
const run_1 = require("../agent/browsing/run");
|
|
10
35
|
const utils_1 = require("../agent/browsing/utils");
|
|
@@ -21,10 +46,14 @@ const utils_2 = require("./utils");
|
|
|
21
46
|
dotenv_1.default.config({
|
|
22
47
|
path: [".env.local", ".env"],
|
|
23
48
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
49
|
+
const flushEvents = async () => {
|
|
50
|
+
await (0, llm_1.flushAllTraces)();
|
|
51
|
+
await Sentry.flush();
|
|
52
|
+
};
|
|
53
|
+
process.on("beforeExit", async () => await flushEvents());
|
|
54
|
+
process.on("exit", async () => await flushEvents());
|
|
55
|
+
process.on("SIGINT", async () => await flushEvents());
|
|
56
|
+
process.on("SIGTERM", async () => await flushEvents());
|
|
28
57
|
async function resolveAgentUsingTask({ testCase, trace, }) {
|
|
29
58
|
const { response } = await (0, infer_agent_1.inferAgentBasedTask)({
|
|
30
59
|
task: testCase.steps.join("\n"),
|
|
@@ -32,7 +61,7 @@ async function resolveAgentUsingTask({ testCase, trace, }) {
|
|
|
32
61
|
});
|
|
33
62
|
return response;
|
|
34
63
|
}
|
|
35
|
-
async function runAgent(testGenConfig) {
|
|
64
|
+
async function runAgent(testGenConfig, span) {
|
|
36
65
|
const logger = new logger_1.CustomLogger();
|
|
37
66
|
const { specPath, testCase } = testGenConfig;
|
|
38
67
|
if (process.env.LOG_URL) {
|
|
@@ -40,6 +69,7 @@ async function runAgent(testGenConfig) {
|
|
|
40
69
|
void new reporter_1.TestGenUpdatesReporter().sendLogUrl(process.env.LOG_URL);
|
|
41
70
|
}
|
|
42
71
|
catch (e) {
|
|
72
|
+
span?.recordException(e);
|
|
43
73
|
console.warn("Failed to send log url to test gen update", e);
|
|
44
74
|
}
|
|
45
75
|
}
|
|
@@ -127,50 +157,57 @@ async function runAgent(testGenConfig) {
|
|
|
127
157
|
}
|
|
128
158
|
}
|
|
129
159
|
(async function main() {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
await Sentry.continueTrace({ sentryTrace: utils_2.sentryTrace, baggage: utils_2.baggage }, async () => {
|
|
161
|
+
await Sentry.startSpan({ name: "test-gen" }, async (span) => {
|
|
162
|
+
// this is where test gen starts executing on giving the command from ci
|
|
163
|
+
const logger = new logger_1.CustomLogger({ useReporter: false });
|
|
164
|
+
if (process.argv.length < 3) {
|
|
165
|
+
logger.error("Please provide path to scenarios using command:", "npx @empiricalrun/test-gen <TEST_GEN_TOKEN>");
|
|
166
|
+
process.exit(1);
|
|
167
|
+
}
|
|
168
|
+
const { testGenConfig } = await (0, utils_2.parseCliArgs)();
|
|
169
|
+
(0, reporter_1.setReporterConfig)({
|
|
170
|
+
projectRepoName: testGenConfig.options?.metadata.projectRepoName,
|
|
171
|
+
testSessionId: testGenConfig.options?.metadata.testSessionId,
|
|
172
|
+
generationId: testGenConfig.options?.metadata.generationId,
|
|
173
|
+
});
|
|
174
|
+
(0, session_1.setSessionDetails)({
|
|
175
|
+
sessionId: testGenConfig.options?.metadata.testSessionId,
|
|
176
|
+
generationId: testGenConfig.options?.metadata.generationId,
|
|
177
|
+
testCaseId: testGenConfig.testCase.id,
|
|
178
|
+
projectRepoName: testGenConfig.options?.metadata.projectRepoName,
|
|
179
|
+
});
|
|
180
|
+
let testGenFailed = false;
|
|
181
|
+
try {
|
|
182
|
+
// download the build if it exists
|
|
183
|
+
await (0, test_build_1.downloadBuild)(testGenConfig.build || {});
|
|
184
|
+
await runAgent(testGenConfig);
|
|
185
|
+
}
|
|
186
|
+
catch (e) {
|
|
187
|
+
span.recordException(e);
|
|
188
|
+
Sentry.captureException(e);
|
|
189
|
+
testGenFailed = true;
|
|
190
|
+
new logger_1.CustomLogger().error(`Failed to generate test for the scenario. ${process.env.LOG_URL ? `[view log](${process.env.LOG_URL})` : ""}`, e?.message, e?.stack);
|
|
191
|
+
}
|
|
192
|
+
if (testGenConfig.options?.agent !== "code" &&
|
|
193
|
+
testGenConfig.options?.agent !== "plan" &&
|
|
194
|
+
testGenConfig.testCase.name) {
|
|
195
|
+
await new reporter_1.TestGenUpdatesReporter().reportGenAssets({
|
|
196
|
+
projectRepoName: testGenConfig.options.metadata.projectRepoName,
|
|
197
|
+
testName: testGenConfig.testCase.name,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
// TODO: move these reporters to a better lifecycle
|
|
201
|
+
await (0, llm_1.flushAllTraces)();
|
|
202
|
+
await (0, logger_1.waitForLogsToFlush)();
|
|
203
|
+
await (0, session_1.endSession)();
|
|
204
|
+
span.end();
|
|
205
|
+
if (testGenFailed) {
|
|
206
|
+
process.exit(1);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
process.exit(0);
|
|
210
|
+
}
|
|
164
211
|
});
|
|
165
|
-
}
|
|
166
|
-
// TODO: move these reporters to a better lifecycle
|
|
167
|
-
await (0, llm_1.flushAllTraces)();
|
|
168
|
-
await (0, logger_1.waitForLogsToFlush)();
|
|
169
|
-
await (0, session_1.endSession)();
|
|
170
|
-
if (testGenFailed) {
|
|
171
|
-
process.exit(1);
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
process.exit(0);
|
|
175
|
-
}
|
|
212
|
+
});
|
|
176
213
|
})();
|
|
@@ -3,4 +3,6 @@ export declare function parseCliArgs(testGenToken?: string): Promise<{
|
|
|
3
3
|
testGenConfig: TestGenConfig;
|
|
4
4
|
}>;
|
|
5
5
|
export declare function getTestConfigCliArg(): string;
|
|
6
|
+
export declare const sentryTrace: string | undefined;
|
|
7
|
+
export declare const baggage: string | undefined;
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAIhE,wBAAsB,YAAY,CAChC,YAAY,GAAE,MAA8B;;GAM7C;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAIhE,wBAAsB,YAAY,CAChC,YAAY,GAAE,MAA8B;;GAM7C;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED,eAAO,MAAM,WAAW,oBAA2B,CAAC;AACpD,eAAO,MAAM,OAAO,oBAA6B,CAAC"}
|
package/dist/bin/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTestConfigCliArg = exports.parseCliArgs = void 0;
|
|
3
|
+
exports.baggage = exports.sentryTrace = exports.getTestConfigCliArg = exports.parseCliArgs = void 0;
|
|
4
4
|
const scenarios_1 = require("./scenarios");
|
|
5
5
|
async function parseCliArgs(testGenToken = getTestConfigCliArg()) {
|
|
6
6
|
const testGenConfig = await (0, scenarios_1.loadTestConfigs)(testGenToken);
|
|
@@ -13,3 +13,5 @@ function getTestConfigCliArg() {
|
|
|
13
13
|
return process.argv[2];
|
|
14
14
|
}
|
|
15
15
|
exports.getTestConfigCliArg = getTestConfigCliArg;
|
|
16
|
+
exports.sentryTrace = process.env.SENTRY_TRACE;
|
|
17
|
+
exports.baggage = process.env.SENTRY_BAGGAGE;
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAItB,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAOlC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAapC,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,SAAS,iBAuC3E"}
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
exports.createTest = void 0;
|
|
30
|
+
require("./initSentry");
|
|
7
31
|
const llm_1 = require("@empiricalrun/llm");
|
|
32
|
+
const Sentry = __importStar(require("@sentry/node"));
|
|
8
33
|
const run_1 = require("./agent/master/run");
|
|
9
34
|
const utils_1 = require("./bin/utils");
|
|
10
35
|
const client_1 = __importDefault(require("./file/client"));
|
|
11
36
|
const reporter_1 = require("./reporter");
|
|
12
37
|
const session_1 = require("./session");
|
|
13
38
|
const pw_test_1 = require("./utils/pw-test");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
39
|
+
const flushEvents = async () => {
|
|
40
|
+
await (0, llm_1.flushAllTraces)();
|
|
41
|
+
await Sentry.flush();
|
|
42
|
+
};
|
|
43
|
+
process.on("beforeExit", async () => await flushEvents());
|
|
44
|
+
process.on("exit", async () => await flushEvents());
|
|
45
|
+
process.on("SIGINT", async () => await flushEvents());
|
|
46
|
+
process.on("SIGTERM", async () => await flushEvents());
|
|
18
47
|
async function createTest(task, page, scope) {
|
|
19
48
|
const port = process.env.APP_PORT || 3030;
|
|
20
49
|
const testConfigArg = process.env.TEST_GEN_TOKEN;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initSentry.d.ts","sourceRoot":"","sources":["../src/initSentry.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const Sentry = __importStar(require("@sentry/node"));
|
|
27
|
+
Sentry.init({
|
|
28
|
+
enabled: process.env.NODE_ENV !== "development",
|
|
29
|
+
dsn: "https://87e61b11ede1431d7156bcd26da997cc@o4506822020235264.ingest.us.sentry.io/4508806031015936",
|
|
30
|
+
tracesSampleRate: 1.0,
|
|
31
|
+
serverName: "test-gen",
|
|
32
|
+
debug: process.env.NODE_ENV === "development",
|
|
33
|
+
integrations: [Sentry.consoleIntegration(), Sentry.httpIntegration()],
|
|
34
|
+
clientReportFlushInterval: 2000,
|
|
35
|
+
shutdownTimeout: 5000,
|
|
36
|
+
enableTracing: true,
|
|
37
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-build/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-build/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAWnD;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAa/D"}
|
package/dist/test-build/index.js
CHANGED
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
exports.downloadBuild = void 0;
|
|
30
|
+
const Sentry = __importStar(require("@sentry/node"));
|
|
7
31
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
32
|
const logger_1 = require("../bin/logger");
|
|
9
33
|
const exec_1 = require("../utils/exec");
|
|
@@ -24,6 +48,7 @@ async function downloadBuild(build) {
|
|
|
24
48
|
logger.log(`Downloading build from ${build.url}`);
|
|
25
49
|
await (0, exec_1.cmd)(`npm run download ${build.url}`.split(" "), {
|
|
26
50
|
env: { ...Object(process.env) },
|
|
51
|
+
span: Sentry.getActiveSpan(),
|
|
27
52
|
});
|
|
28
53
|
}
|
|
29
54
|
}
|
package/dist/utils/exec.d.ts
CHANGED
package/dist/utils/exec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/utils/exec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/utils/exec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AAMvC,wBAAsB,GAAG,CACvB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAA;CAAE,GAC5D,OAAO,CAAC,MAAM,CAAC,CA+CjB"}
|
package/dist/utils/exec.js
CHANGED
|
@@ -1,37 +1,77 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
exports.cmd = void 0;
|
|
30
|
+
const Sentry = __importStar(require("@sentry/node"));
|
|
7
31
|
const child_process_1 = require("child_process");
|
|
8
32
|
const process_1 = __importDefault(require("process"));
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const utils_1 = require("../bin/utils");
|
|
34
|
+
async function cmd(command, options) {
|
|
35
|
+
return Sentry.continueTrace({ sentryTrace: utils_1.sentryTrace, baggage: utils_1.baggage }, async () => {
|
|
36
|
+
return Sentry.startSpan({ name: "test-gen" }, async (span) => {
|
|
37
|
+
let errorLogs = [];
|
|
38
|
+
return new Promise((resolveFunc, rejectFunc) => {
|
|
39
|
+
if (!command[0]) {
|
|
40
|
+
rejectFunc(new Error("Command cannot be empty"));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
let p = (0, child_process_1.spawn)(command[0], command.slice(1), {
|
|
44
|
+
env: { ...process_1.default.env, ...options.env },
|
|
45
|
+
});
|
|
46
|
+
p.stdout.on("data", (x) => {
|
|
47
|
+
const log = x.toString();
|
|
48
|
+
if (log.includes("Error")) {
|
|
49
|
+
errorLogs.push(log);
|
|
50
|
+
}
|
|
51
|
+
process_1.default.stdout.write(log);
|
|
52
|
+
});
|
|
53
|
+
p.stderr.on("data", (x) => {
|
|
54
|
+
const log = x.toString();
|
|
55
|
+
process_1.default.stderr.write(log);
|
|
56
|
+
errorLogs.push(log);
|
|
57
|
+
});
|
|
58
|
+
p.on("error", async (err) => {
|
|
59
|
+
span?.recordException(err);
|
|
60
|
+
Sentry.captureException(err);
|
|
61
|
+
rejectFunc(err);
|
|
62
|
+
});
|
|
63
|
+
p.on("exit", async (code) => {
|
|
64
|
+
if (code !== 0) {
|
|
65
|
+
const errorMessage = errorLogs.slice(-3).join("\n");
|
|
66
|
+
span?.recordException(errorMessage);
|
|
67
|
+
Sentry.captureException(new Error(errorMessage));
|
|
68
|
+
rejectFunc(new Error(errorMessage));
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
resolveFunc(code ?? 1);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
35
75
|
});
|
|
36
76
|
});
|
|
37
77
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/test-gen",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.28",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@actions/core": "^1.10.1",
|
|
49
49
|
"@babel/parser": "^7.26.3",
|
|
50
|
+
"@sentry/node": "^8.54.0",
|
|
50
51
|
"@types/sanitize-html": "^2.11.0",
|
|
51
52
|
"commander": "^12.1.0",
|
|
52
53
|
"detect-port": "^1.6.1",
|
|
@@ -71,9 +72,9 @@
|
|
|
71
72
|
"ts-morph": "^23.0.0",
|
|
72
73
|
"tsx": "^4.16.2",
|
|
73
74
|
"typescript": "^5.3.3",
|
|
74
|
-
"@empiricalrun/reporter": "^0.23.1",
|
|
75
75
|
"@empiricalrun/llm": "^0.9.34",
|
|
76
|
-
"@empiricalrun/r2-uploader": "^0.3.8"
|
|
76
|
+
"@empiricalrun/r2-uploader": "^0.3.8",
|
|
77
|
+
"@empiricalrun/reporter": "^0.23.1"
|
|
77
78
|
},
|
|
78
79
|
"devDependencies": {
|
|
79
80
|
"@playwright/test": "1.47.1",
|