@empiricalrun/test-run 0.8.0 → 0.8.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 +8 -0
- package/dist/bin/index.js +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/lib/run-all-tests.d.ts +1 -1
- package/dist/lib/run-all-tests.d.ts.map +1 -1
- package/dist/lib/run-all-tests.js +2 -3
- package/dist/lib/run-specific-test.d.ts +1 -1
- package/dist/lib/run-specific-test.d.ts.map +1 -1
- package/dist/lib/run-specific-test.js +2 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +24 -6
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @empiricalrun/test-run
|
|
2
2
|
|
|
3
|
+
## 0.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3831109: fix: use platform from environment to support mobile runs with bin entrypoint
|
|
8
|
+
- a58ac3f: feat: add dashboard agent integration and optimize tsx handling
|
|
9
|
+
- f77e33d: feat: load dotenv in test-run package
|
|
10
|
+
|
|
3
11
|
## 0.8.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/dist/bin/index.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
3
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
7
|
const commander_1 = require("commander");
|
|
8
|
+
const dotenv_1 = __importDefault(require("dotenv"));
|
|
5
9
|
const dashboard_1 = require("../dashboard");
|
|
6
10
|
const run_all_tests_1 = require("../lib/run-all-tests");
|
|
7
11
|
const run_specific_test_1 = require("../lib/run-specific-test");
|
|
8
12
|
const types_1 = require("../types");
|
|
9
13
|
const utils_1 = require("../utils");
|
|
10
14
|
const config_parser_1 = require("../utils/config-parser");
|
|
15
|
+
dotenv_1.default.config({
|
|
16
|
+
path: [".env.local", ".env"],
|
|
17
|
+
});
|
|
11
18
|
(async function main() {
|
|
12
19
|
// TODO: add documentation of the test run
|
|
13
20
|
commander_1.program
|
|
@@ -100,12 +107,14 @@ const config_parser_1 = require("../utils/config-parser");
|
|
|
100
107
|
tests,
|
|
101
108
|
projects: projectFilters,
|
|
102
109
|
pwOptions: pwOptions.join(" "),
|
|
110
|
+
platform,
|
|
103
111
|
});
|
|
104
112
|
}
|
|
105
113
|
else {
|
|
106
114
|
testResult = await (0, run_all_tests_1.runAllTests)({
|
|
107
115
|
projects: projectFilters,
|
|
108
116
|
pwOptions: pwOptions.join(" "),
|
|
117
|
+
platform,
|
|
109
118
|
});
|
|
110
119
|
}
|
|
111
120
|
if (!testResult.hasTestPassed) {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAY,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAY,QAAQ,EAAE,MAAM,SAAS,CAAC;AAO7C,wBAAsB,aAAa,CAAC,EAClC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,YAAY,GACb,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;;;GAqBA;AAED,wBAAsB,YAAY,CAChC,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CA6CnC"}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,9 @@ const path_1 = __importDefault(require("path"));
|
|
|
9
9
|
const run_specific_test_1 = require("./lib/run-specific-test");
|
|
10
10
|
const types_1 = require("./types");
|
|
11
11
|
const utils_1 = require("./utils");
|
|
12
|
+
// For test-run package, the library entrypoint, we only support web platform
|
|
13
|
+
// The bin entrypoint has support for mobile also
|
|
14
|
+
const supportedPlatform = types_1.Platform.WEB;
|
|
12
15
|
async function runSingleTest({ testName, suites, fileName, projects, envOverrides, }) {
|
|
13
16
|
const testDir = "tests";
|
|
14
17
|
const filePath = path_1.default.relative(process.cwd(), fileName);
|
|
@@ -17,6 +20,7 @@ async function runSingleTest({ testName, suites, fileName, projects, envOverride
|
|
|
17
20
|
pwOptions: "",
|
|
18
21
|
projects,
|
|
19
22
|
envOverrides,
|
|
23
|
+
platform: supportedPlatform,
|
|
20
24
|
});
|
|
21
25
|
const jsonFilePath = path_1.default.join(process.cwd(), "playwright-report", `summary.json`);
|
|
22
26
|
const jsonFileContents = await promises_1.default.readFile(jsonFilePath, "utf8");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TestRunParameters } from "../types";
|
|
2
|
-
export declare function runAllTests({ projects, pwOptions, filesFilter, envOverrides, }: TestRunParameters): Promise<{
|
|
2
|
+
export declare function runAllTests({ projects, pwOptions, filesFilter, envOverrides, platform, }: TestRunParameters): Promise<{
|
|
3
3
|
hasTestPassed: boolean;
|
|
4
4
|
}>;
|
|
5
5
|
//# sourceMappingURL=run-all-tests.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-all-tests.d.ts","sourceRoot":"","sources":["../../src/lib/run-all-tests.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"run-all-tests.d.ts","sourceRoot":"","sources":["../../src/lib/run-all-tests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG7C,wBAAsB,WAAW,CAAC,EAChC,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,EACZ,QAAQ,GACT,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,CAoBD"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runAllTests = void 0;
|
|
4
|
-
const types_1 = require("../types");
|
|
5
4
|
const utils_1 = require("../utils");
|
|
6
|
-
async function runAllTests({ projects, pwOptions, filesFilter, envOverrides, }) {
|
|
5
|
+
async function runAllTests({ projects, pwOptions, filesFilter, envOverrides, platform, }) {
|
|
7
6
|
let hasTestPassed = true;
|
|
8
7
|
try {
|
|
9
|
-
const testRunner = (0, utils_1.getTestRunner)(
|
|
8
|
+
const testRunner = (0, utils_1.getTestRunner)(platform);
|
|
10
9
|
let pwOptionsWithProjects = `${pwOptions} ${projects?.map((project) => `--project ${project}`).join(" ")}`;
|
|
11
10
|
const env = Object.assign({ ...process.env, PW_TEST_HTML_REPORT_OPEN: "never" }, envOverrides);
|
|
12
11
|
const testRunCmd = `npx ${testRunner} test ${filesFilter || ""} ${pwOptionsWithProjects}`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TestRunParameters } from "../types";
|
|
2
|
-
export declare function runSpecificTests({ tests, projects, pwOptions, envOverrides, }: TestRunParameters): Promise<{
|
|
2
|
+
export declare function runSpecificTests({ tests, projects, pwOptions, platform, envOverrides, }: TestRunParameters): Promise<{
|
|
3
3
|
hasTestPassed: boolean;
|
|
4
4
|
}>;
|
|
5
5
|
//# sourceMappingURL=run-specific-test.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-specific-test.d.ts","sourceRoot":"","sources":["../../src/lib/run-specific-test.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAmB7C,wBAAsB,gBAAgB,CAAC,EACrC,KAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,GACb,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,
|
|
1
|
+
{"version":3,"file":"run-specific-test.d.ts","sourceRoot":"","sources":["../../src/lib/run-specific-test.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAmB7C,wBAAsB,gBAAgB,CAAC,EACrC,KAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,YAAY,GACb,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,CA+ED"}
|
|
@@ -15,7 +15,7 @@ function setupProcessListeners(cleanup) {
|
|
|
15
15
|
events.forEach((event) => process.removeListener(event, cleanup));
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
async function runSpecificTests({ tests = [], projects, pwOptions, envOverrides, }) {
|
|
18
|
+
async function runSpecificTests({ tests = [], projects, pwOptions, platform, envOverrides, }) {
|
|
19
19
|
if (!tests || tests.length === 0) {
|
|
20
20
|
throw new Error("No tests found");
|
|
21
21
|
}
|
|
@@ -81,6 +81,7 @@ async function runSpecificTests({ tests = [], projects, pwOptions, envOverrides,
|
|
|
81
81
|
pwOptions,
|
|
82
82
|
projects,
|
|
83
83
|
envOverrides,
|
|
84
|
+
platform,
|
|
84
85
|
});
|
|
85
86
|
removeListeners();
|
|
86
87
|
revertFileContent();
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,M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;CACxB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAW,UAAU,EAAc,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAW,UAAU,EAAc,MAAM,UAAU,CAAC;AAOjE,OAAO,EAEL,QAAQ,EAER,aAAa,EACd,MAAM,UAAU,CAAC;AA0ClB,wBAAsB,GAAG,CACvB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE;IACP,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GACA,OAAO,CAAC,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CA+CpD;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtD,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAG3C;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,aAAa,GAAE,MAAgB,EAC/B,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAA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Q,MAAM,EAAE,CAgBnB,CAAC;AAEF,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,eAAO,MAAM,uBAAuB,QAAa,QAC/C,MAAM,GAAG,SAAS,CAMnB,CAAC;AAEF,eAAO,MAAM,aAAa,aAAoB,MAAM,KAAG,QAAQ,IAAI,CAWlE,CAAC;AAEF,eAAO,MAAM,aAAa,aAAc,QAAQ,KAAG,aAIlD,CAAC;AA4DF,eAAO,MAAM,sBAAsB,cAAqB,MAAM,kBAkB7D,CAAC;AA0BF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,YAAY,EACZ,MAAM,EACN,OAAO,GACR,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG;IACF,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;CACxB,CA8CA"}
|
package/dist/utils/index.js
CHANGED
|
@@ -10,7 +10,8 @@ const promises_1 = __importDefault(require("fs/promises"));
|
|
|
10
10
|
const minimatch_1 = require("minimatch");
|
|
11
11
|
const path_1 = __importDefault(require("path"));
|
|
12
12
|
const ts_morph_1 = require("ts-morph");
|
|
13
|
-
|
|
13
|
+
// For TypeScript type safety
|
|
14
|
+
let tsxImport = null;
|
|
14
15
|
const util_1 = require("util");
|
|
15
16
|
const types_1 = require("../types");
|
|
16
17
|
function setupProcessSignalHandlers(proc) {
|
|
@@ -240,12 +241,29 @@ async function getProjectsFromPlaywrightConfig(platform) {
|
|
|
240
241
|
const configName = platform === types_1.Platform.WEB ? "playwright.config.ts" : "appwright.config.ts";
|
|
241
242
|
const directoryPath = ".";
|
|
242
243
|
const pwFile = path_1.default.resolve(directoryPath, configName);
|
|
244
|
+
if (typeof window !== "undefined") {
|
|
245
|
+
throw new Error("readPlaywrightConfig cannot be used in browser environments");
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
// Only initialize on server side
|
|
249
|
+
// This will only execute on the server
|
|
250
|
+
await import("tsx/cjs/api")
|
|
251
|
+
.then((module) => {
|
|
252
|
+
tsxImport = module;
|
|
253
|
+
})
|
|
254
|
+
.catch((err) => {
|
|
255
|
+
console.error("Failed to import tsx:", err);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
if (!tsxImport) {
|
|
259
|
+
throw new Error("tsx module not available");
|
|
260
|
+
}
|
|
261
|
+
const repoDir = process.cwd();
|
|
262
|
+
const [lastDir] = repoDir.split("/").reverse();
|
|
243
263
|
try {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
const projectConfig = await (0, api_1.tsImport)(pwFile, __filename);
|
|
248
|
-
return projectConfig?.default?.default?.projects?.map((projectConfig) => projectConfig.name);
|
|
264
|
+
const playwrightConfig = (await tsxImport.require(pwFile, `${repoDir}/${lastDir}`)).default;
|
|
265
|
+
const projectConfig = playwrightConfig.projects;
|
|
266
|
+
return projectConfig.map((projectConfig) => projectConfig.name);
|
|
249
267
|
}
|
|
250
268
|
catch (err) {
|
|
251
269
|
console.error("Error getting project list from playwright config", err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/test-run",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"async-retry": "^1.3.3",
|
|
19
19
|
"commander": "^12.1.0",
|
|
20
|
+
"dotenv": "^16.4.5",
|
|
20
21
|
"minimatch": "^10.0.1",
|
|
21
22
|
"ts-morph": "^23.0.0",
|
|
22
23
|
"tsx": "^4.16.2"
|