@empiricalrun/test-run 0.4.3 → 0.4.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 +6 -0
- package/dist/dashboard.d.ts.map +1 -1
- package/dist/dashboard.js +31 -9
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
package/dist/dashboard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../src/dashboard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../src/dashboard.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAK7C,eAAO,MAAM,wBAAwB,QAAa,QAAQ;IACxD,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;CACd,CAyDA,CAAC"}
|
package/dist/dashboard.js
CHANGED
|
@@ -1,22 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.fetchEnvironmentAndBuild = void 0;
|
|
7
|
+
const async_retry_1 = __importDefault(require("async-retry"));
|
|
4
8
|
const utils_1 = require("./utils");
|
|
5
9
|
const DOMAIN = process.env.DASHBOARD_DOMAIN || "https://dash.empirical.run";
|
|
6
10
|
const fetchEnvironmentAndBuild = async () => {
|
|
11
|
+
if (!process.env.PROJECT_NAME) {
|
|
12
|
+
throw new Error("PROJECT_NAME is required for fetching environment and latest build");
|
|
13
|
+
}
|
|
7
14
|
const projectRepo = (0, utils_1.buildRepoName)(process.env.PROJECT_NAME);
|
|
8
15
|
const environmentSlug = `${process.env.TEST_RUN_ENVIRONMENT}`;
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
const data = await (0, async_retry_1.default)(async (bail) => {
|
|
17
|
+
const resp = await fetch(`${DOMAIN}/api/environments?project_repo_name=${projectRepo}&environment_slug=${environmentSlug}`, {
|
|
18
|
+
method: "GET",
|
|
19
|
+
headers: {
|
|
20
|
+
"Content-Type": "application/json",
|
|
21
|
+
Authorization: `weQPMWKT`,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
if (!resp.ok) {
|
|
25
|
+
if (resp.status === 400) {
|
|
26
|
+
const erroredResponse = await resp.json();
|
|
27
|
+
bail(new Error(erroredResponse?.error?.message));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
throw new Error(`Failed to fetch environment and latest build from dashboard for project: ${projectRepo} and env slug: ${environmentSlug}`);
|
|
31
|
+
}
|
|
32
|
+
return (await resp.json());
|
|
33
|
+
}, {
|
|
34
|
+
retries: 3,
|
|
35
|
+
minTimeout: 1000,
|
|
36
|
+
maxTimeout: 60000,
|
|
37
|
+
factor: 3,
|
|
15
38
|
});
|
|
16
|
-
if (!
|
|
17
|
-
throw new Error(`Failed to fetch environment from dashboard for project: ${projectRepo} and env slug: ${environmentSlug}
|
|
39
|
+
if (!data?.data) {
|
|
40
|
+
throw new Error(`Failed to fetch environment and latest build from dashboard for project: ${projectRepo} and env slug: ${environmentSlug}.`);
|
|
18
41
|
}
|
|
19
|
-
const data = (await resp.json());
|
|
20
42
|
return data.data;
|
|
21
43
|
};
|
|
22
44
|
exports.fetchEnvironmentAndBuild = fetchEnvironmentAndBuild;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/test-run",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"author": "Empirical Team <hey@empirical.run>",
|
|
17
17
|
"dependencies": {
|
|
18
|
+
"async-retry": "^1.3.3",
|
|
18
19
|
"commander": "^12.1.0",
|
|
19
20
|
"fs-extra": "^11.2.0",
|
|
20
21
|
"minimatch": "^10.0.1",
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
"tsx": "^4.16.2"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
26
|
+
"@types/async-retry": "^1.4.8",
|
|
25
27
|
"@types/fs-extra": "^11.0.4",
|
|
26
28
|
"@types/node": "^22.5.5"
|
|
27
29
|
},
|