@empiricalrun/test-run 0.7.0 → 0.7.2
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 +15 -0
- package/dist/bin/index.js +4 -4
- package/dist/index.d.ts +9 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +70 -18
- package/dist/lib/index.d.ts +5 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +20 -0
- package/dist/lib/run-all-tests.d.ts +9 -0
- package/dist/lib/run-all-tests.d.ts.map +1 -0
- package/dist/{run-all-tests.js → lib/run-all-tests.js} +5 -9
- package/dist/lib/run-specific-test.d.ts +10 -0
- package/dist/lib/run-specific-test.d.ts.map +1 -0
- package/dist/{run-specific-test.js → lib/run-specific-test.js} +6 -7
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts +13 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +18 -6
- package/package.json +1 -1
- package/dist/run-all-tests.d.ts +0 -13
- package/dist/run-all-tests.d.ts.map +0 -1
- package/dist/run-specific-test.d.ts +0 -10
- package/dist/run-specific-test.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @empiricalrun/test-run
|
|
2
2
|
|
|
3
|
+
## 0.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 049102a: fix: support suites in agent tool calls
|
|
8
|
+
|
|
9
|
+
## 0.7.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 72a8cf2: feat: expose projects in test-run tool call interface
|
|
14
|
+
- 242f659: feat: new method to list all tests
|
|
15
|
+
- 6328aaf: feat: test-gen can use test-run package as a tool call
|
|
16
|
+
- d995e4c: feat: enable conversation along with test-run tool call
|
|
17
|
+
|
|
3
18
|
## 0.7.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/dist/bin/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const commander_1 = require("commander");
|
|
5
|
-
const __1 = require("..");
|
|
6
5
|
const dashboard_1 = require("../dashboard");
|
|
6
|
+
const lib_1 = require("../lib");
|
|
7
7
|
const types_1 = require("../types");
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
const config_parser_1 = require("../utils/config-parser");
|
|
@@ -11,10 +11,10 @@ const config_parser_1 = require("../utils/config-parser");
|
|
|
11
11
|
// TODO: add documentation of the test run
|
|
12
12
|
commander_1.program
|
|
13
13
|
.option("-n, --name <test-name>", "Name of the test to run")
|
|
14
|
+
.option("-s, --suites <suites>", "Suites under which the test is defined")
|
|
14
15
|
.option("-d, --dir <test-dir>", "Path to the test directory")
|
|
15
16
|
.option("-f, --file <test-file-path>", "Path to the test file")
|
|
16
17
|
.option("-p, --project <project-name...>", "Test projects to run")
|
|
17
|
-
.option("-s, --suites <suites>", "suites under which the test is defined")
|
|
18
18
|
.option("--payload <payload>", "Payload to run tests")
|
|
19
19
|
.option("--skip-teardown", "This options skips running teardown tests")
|
|
20
20
|
.option("--forbid-only", `This options forbids the use of ".only" in the test files`)
|
|
@@ -89,12 +89,12 @@ const config_parser_1 = require("../utils/config-parser");
|
|
|
89
89
|
platform,
|
|
90
90
|
filteringSets: [...options.project, ...environmentSpecificProjects],
|
|
91
91
|
});
|
|
92
|
-
pwOptions.push(...projectFilters);
|
|
93
92
|
if (options.skipTeardown) {
|
|
94
93
|
await (0, utils_1.handleTeardownSkipFlag)(directory);
|
|
95
94
|
}
|
|
96
|
-
const { hasTestPassed } = await (0,
|
|
95
|
+
const { hasTestPassed } = await (0, lib_1._runTest)({
|
|
97
96
|
tests,
|
|
97
|
+
projects: projectFilters,
|
|
98
98
|
pwOptions: pwOptions.join(" "),
|
|
99
99
|
platform,
|
|
100
100
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { TestCase } from "./types";
|
|
2
|
+
export declare function runSingleTest({ testName, suites, fileName, projects, }: {
|
|
3
|
+
testName: string;
|
|
4
|
+
suites: string[];
|
|
5
|
+
fileName: string;
|
|
6
|
+
projects?: string[];
|
|
7
|
+
}): Promise<{
|
|
8
8
|
hasTestPassed: boolean;
|
|
9
|
+
summaryJson: any;
|
|
9
10
|
}>;
|
|
11
|
+
export declare function listAllTests(cwd?: string): Promise<Record<string, TestCase>>;
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
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":"AAIA,OAAO,EAAY,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG7C,wBAAsB,aAAa,CAAC,EAClC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;;;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
|
@@ -1,21 +1,73 @@
|
|
|
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
|
-
exports.
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
exports.listAllTests = exports.runSingleTest = void 0;
|
|
7
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const lib_1 = require("./lib");
|
|
10
|
+
const types_1 = require("./types");
|
|
11
|
+
const utils_1 = require("./utils");
|
|
12
|
+
async function runSingleTest({ testName, suites, fileName, projects, }) {
|
|
13
|
+
const testDir = "tests";
|
|
14
|
+
const filePath = path_1.default.relative(process.cwd(), fileName);
|
|
15
|
+
const result = await (0, lib_1._runTest)({
|
|
16
|
+
tests: [{ name: testName, dir: testDir, filePath, suites }],
|
|
17
|
+
pwOptions: "",
|
|
18
|
+
platform: types_1.Platform.WEB,
|
|
19
|
+
projects,
|
|
20
|
+
});
|
|
21
|
+
const jsonFilePath = path_1.default.join(process.cwd(), "playwright-report", `summary.json`);
|
|
22
|
+
const jsonFileContents = await promises_1.default.readFile(jsonFilePath, "utf8");
|
|
23
|
+
// TODO: Add types for this
|
|
24
|
+
const summaryJson = JSON.parse(jsonFileContents);
|
|
25
|
+
return {
|
|
26
|
+
hasTestPassed: result.hasTestPassed,
|
|
27
|
+
summaryJson,
|
|
28
|
+
};
|
|
20
29
|
}
|
|
21
|
-
exports.
|
|
30
|
+
exports.runSingleTest = runSingleTest;
|
|
31
|
+
async function listAllTests(cwd) {
|
|
32
|
+
const testRunner = (0, utils_1.getTestRunner)(types_1.Platform.WEB);
|
|
33
|
+
const env = Object({ ...process.env });
|
|
34
|
+
const command = ["npx", testRunner, "test", "--list"];
|
|
35
|
+
const { output } = await (0, utils_1.cmdWithOutput)(command, {
|
|
36
|
+
env,
|
|
37
|
+
cwd,
|
|
38
|
+
});
|
|
39
|
+
// Parse the output to extract test information
|
|
40
|
+
// Example format: "[chromium] › home.spec.ts:9:9 › describe 1 › describe 2 › has title"
|
|
41
|
+
const result = {};
|
|
42
|
+
output
|
|
43
|
+
.split("\n")
|
|
44
|
+
.filter((line) => line.trim() &&
|
|
45
|
+
line.trim().startsWith("[") &&
|
|
46
|
+
line.includes(".spec.ts:"))
|
|
47
|
+
.forEach((line) => {
|
|
48
|
+
// Extract project, file, line, and test name with suites
|
|
49
|
+
const match = line.match(/\[(.*?)\]\s+›\s+(.*?):(\d+):\d+\s+›\s+(.*)/);
|
|
50
|
+
if (!match || !match[1] || !match[2] || !match[3] || !match[4]) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const file = match[2];
|
|
54
|
+
const testPath = match[4];
|
|
55
|
+
const parts = testPath.split("›").map((p) => p.trim());
|
|
56
|
+
if (parts.length === 0) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const name = parts[parts.length - 1];
|
|
60
|
+
if (!name) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const suites = parts.length > 1 ? parts.slice(0, -1) : undefined;
|
|
64
|
+
const testCase = {
|
|
65
|
+
name,
|
|
66
|
+
filePath: file,
|
|
67
|
+
suites,
|
|
68
|
+
};
|
|
69
|
+
result[line.trim()] = testCase;
|
|
70
|
+
});
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
exports.listAllTests = listAllTests;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAI7C,wBAAsB,QAAQ,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,GACT,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,CAaD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._runTest = void 0;
|
|
4
|
+
const run_all_tests_1 = require("./run-all-tests");
|
|
5
|
+
const run_specific_test_1 = require("./run-specific-test");
|
|
6
|
+
async function _runTest({ tests, projects, pwOptions, platform, }) {
|
|
7
|
+
const hasTestsFilter = tests && tests.length > 0;
|
|
8
|
+
if (hasTestsFilter) {
|
|
9
|
+
return await (0, run_specific_test_1.runSpecificTests)({
|
|
10
|
+
tests,
|
|
11
|
+
projects,
|
|
12
|
+
pwOptions,
|
|
13
|
+
platform,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return await (0, run_all_tests_1.runAllTests)({ projects, pwOptions, platform });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports._runTest = _runTest;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Platform } from "../types";
|
|
2
|
+
export declare function runAllTests({ projects, pwOptions, platform, }: {
|
|
3
|
+
projects?: string[];
|
|
4
|
+
pwOptions?: string;
|
|
5
|
+
platform: Platform;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
hasTestPassed: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=run-all-tests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-all-tests.d.ts","sourceRoot":"","sources":["../../src/lib/run-all-tests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGpC,wBAAsB,WAAW,CAAC,EAChC,QAAQ,EACR,SAAS,EACT,QAAQ,GACT,EAAE;IACD,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACpB,GAAG,OAAO,CAAC;IACV,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,CAoBD"}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runAllTests = void 0;
|
|
4
|
-
const utils_1 = require("
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
* @export
|
|
8
|
-
* @param {TestRunParameters} { name, dir, pwOptions }
|
|
9
|
-
*/
|
|
10
|
-
async function runAllTests({ pwOptions, platform, }) {
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
async function runAllTests({ projects, pwOptions, platform, }) {
|
|
11
6
|
let hasTestPassed = true;
|
|
12
7
|
try {
|
|
13
8
|
const testRunner = (0, utils_1.getTestRunner)(platform);
|
|
14
|
-
|
|
15
|
-
const
|
|
9
|
+
let pwOptionsWithProjects = `${pwOptions} ${projects?.map((project) => `--project ${project}`).join(" ")}`;
|
|
10
|
+
const env = Object({ ...process.env, PW_TEST_HTML_REPORT_OPEN: "never" });
|
|
11
|
+
const testRunCmd = `npx ${testRunner} test ${pwOptionsWithProjects}`;
|
|
16
12
|
console.log(`${testRunner} test command:`, testRunCmd, {
|
|
17
13
|
arr: testRunCmd.split(" "),
|
|
18
14
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TestRunParameters } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @param {TestRunParameters} { name, dir, pwOptions }
|
|
6
|
+
*/
|
|
7
|
+
export declare function runSpecificTests({ tests, projects, pwOptions, platform, }: TestRunParameters): Promise<{
|
|
8
|
+
hasTestPassed: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=run-specific-test.d.ts.map
|
|
@@ -0,0 +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;AAY7C;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,KAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,GACT,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,CA0FD"}
|
|
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.runSpecificTests = void 0;
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
9
|
-
const utils_1 = require("
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
12
12
|
* @export
|
|
13
13
|
* @param {TestRunParameters} { name, dir, pwOptions }
|
|
14
14
|
*/
|
|
15
|
-
async function runSpecificTests({ tests = [], pwOptions, platform, }) {
|
|
15
|
+
async function runSpecificTests({ tests = [], projects, pwOptions, platform, }) {
|
|
16
16
|
if (!tests || tests.length === 0) {
|
|
17
17
|
throw new Error("No tests found");
|
|
18
18
|
}
|
|
@@ -57,9 +57,6 @@ async function runSpecificTests({ tests = [], pwOptions, platform, }) {
|
|
|
57
57
|
});
|
|
58
58
|
const parentDescribe = (0, utils_1.findFirstSerialDescribeBlock)(testCaseNode);
|
|
59
59
|
const isFileMarkedSerial = await (0, utils_1.hasTopLevelDescribeConfigureWithSerialMode)(matchingFilePath);
|
|
60
|
-
console.log("Identified test block:", !!testCaseNode);
|
|
61
|
-
console.log("Is parent describe block marked serial:", !!parentDescribe);
|
|
62
|
-
console.log("Is file marked serial:", isFileMarkedSerial);
|
|
63
60
|
const currentFileContent = await promises_1.default.readFile(matchingFilePath, "utf-8");
|
|
64
61
|
// if file is not marked as touched, mark it as touched
|
|
65
62
|
if (!touchedFiles[matchingFilePath]) {
|
|
@@ -83,8 +80,9 @@ async function runSpecificTests({ tests = [], pwOptions, platform, }) {
|
|
|
83
80
|
let hasTestPassed = true;
|
|
84
81
|
try {
|
|
85
82
|
const testRunner = (0, utils_1.getTestRunner)(platform);
|
|
86
|
-
|
|
87
|
-
const
|
|
83
|
+
let pwOptionsWithProjects = `${pwOptions} ${projects?.map((project) => `--project ${project}`).join(" ")}`;
|
|
84
|
+
const env = Object({ ...process.env, PW_TEST_HTML_REPORT_OPEN: "never" });
|
|
85
|
+
const testRunCmd = `npx ${testRunner} test ${Object.keys(touchedFiles).join(" ")} ${pwOptionsWithProjects}`;
|
|
88
86
|
console.log(`${testRunner} test command:`, testRunCmd);
|
|
89
87
|
await (0, utils_1.cmd)(testRunCmd.split(" "), {
|
|
90
88
|
env,
|
|
@@ -93,6 +91,7 @@ async function runSpecificTests({ tests = [], pwOptions, platform, }) {
|
|
|
93
91
|
catch (e) {
|
|
94
92
|
hasTestPassed = false;
|
|
95
93
|
}
|
|
94
|
+
revertFileContent();
|
|
96
95
|
return {
|
|
97
96
|
hasTestPassed,
|
|
98
97
|
};
|
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,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,MAAM,GACd;IACE,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,GACD,SAAS,CAAC;AAEd,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,M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nB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAEF,oBAAY,QAAQ;IAClB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,GAAG,QAAQ;CACZ;AAED,oBAAY,aAAa;IACvB,UAAU,eAAe;IACzB,SAAS,cAAc;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"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -2,7 +2,19 @@ import { Node, SourceFile } from "ts-morph";
|
|
|
2
2
|
import { Platform, TestFramework } from "../types";
|
|
3
3
|
export declare function cmd(command: string[], options: {
|
|
4
4
|
env?: Record<string, string>;
|
|
5
|
-
|
|
5
|
+
cwd?: string;
|
|
6
|
+
captureOutput?: boolean;
|
|
7
|
+
}): Promise<number | {
|
|
8
|
+
code: number;
|
|
9
|
+
output: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function cmdWithOutput(command: string[], options: {
|
|
12
|
+
env?: Record<string, string>;
|
|
13
|
+
cwd?: string;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
code: number;
|
|
16
|
+
output: string;
|
|
17
|
+
}>;
|
|
6
18
|
/**
|
|
7
19
|
*
|
|
8
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAW,UAAU,EAAc,MAAM,UAAU,CAAC;AAGjE,OAAO,EAEL,QAAQ,EAER,aAAa,EACd,MAAM,UAAU,CAAC;AA6BlB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAW,UAAU,EAAc,MAAM,UAAU,CAAC;AAGjE,OAAO,EAEL,QAAQ,EAER,aAAa,EACd,MAAM,UAAU,CAAC;AA6BlB,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,CA4CpD;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,CAAA;CAAO,GAClC,OAAO,CAAC,MAAM,EAAE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AgB,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
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getTypescriptTestBlock = exports.handleTeardownSkipFlag = exports.getTestRunner = exports.downloadBuild = exports.pickNameFromPackageJson = exports.buildRepoName = exports.generateProjectFilters = exports.filterArrayByGlobMatchersSet = exports.getProjectsFromPlaywrightConfig = exports.markTestAsOnly = exports.hasTopLevelDescribeConfigureWithSerialMode = exports.findFirstSerialDescribeBlock = exports.hasTestBlock = exports.getTestCaseNode = exports.getTestModuleAliasFromSourceFile = exports.getAllFilePaths = exports.cmd = void 0;
|
|
6
|
+
exports.getTypescriptTestBlock = exports.handleTeardownSkipFlag = exports.getTestRunner = exports.downloadBuild = exports.pickNameFromPackageJson = exports.buildRepoName = exports.generateProjectFilters = exports.filterArrayByGlobMatchersSet = exports.getProjectsFromPlaywrightConfig = exports.markTestAsOnly = exports.hasTopLevelDescribeConfigureWithSerialMode = exports.findFirstSerialDescribeBlock = exports.hasTestBlock = exports.getTestCaseNode = exports.getTestModuleAliasFromSourceFile = exports.getAllFilePaths = exports.cmdWithOutput = exports.cmd = void 0;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
@@ -35,11 +35,13 @@ function setupProcessSignalHandlers(proc) {
|
|
|
35
35
|
process.once(signal, () => console.log(`Received ${signal}, which is a no-op`));
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
function cmd(command, options) {
|
|
38
|
+
async function cmd(command, options) {
|
|
39
|
+
let output = options.captureOutput ? "" : undefined;
|
|
39
40
|
let errorLogs = [];
|
|
40
41
|
return new Promise((resolveFunc, rejectFunc) => {
|
|
41
42
|
const p = (0, child_process_1.spawn)(command[0], command.slice(1), {
|
|
42
43
|
env: { ...process.env, ...options.env },
|
|
44
|
+
cwd: options.cwd,
|
|
43
45
|
// Ensure child process receives signals
|
|
44
46
|
detached: false,
|
|
45
47
|
});
|
|
@@ -47,14 +49,19 @@ function cmd(command, options) {
|
|
|
47
49
|
setupProcessSignalHandlers(p);
|
|
48
50
|
p.stdout.on("data", (x) => {
|
|
49
51
|
const log = x.toString();
|
|
52
|
+
if (options.captureOutput) {
|
|
53
|
+
output += log;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
process.stdout.write(log);
|
|
57
|
+
}
|
|
50
58
|
if (log.includes("Error")) {
|
|
51
59
|
errorLogs.push(log);
|
|
52
60
|
}
|
|
53
|
-
process.stdout.write(log);
|
|
54
61
|
});
|
|
55
62
|
p.stderr.on("data", (x) => {
|
|
56
63
|
const log = x.toString();
|
|
57
|
-
process.stderr.write(
|
|
64
|
+
process.stderr.write(log);
|
|
58
65
|
errorLogs.push(log);
|
|
59
66
|
});
|
|
60
67
|
p.on("exit", (code) => {
|
|
@@ -63,12 +70,17 @@ function cmd(command, options) {
|
|
|
63
70
|
rejectFunc(errorLogs.slice(-3).join("\n"));
|
|
64
71
|
}
|
|
65
72
|
else {
|
|
66
|
-
resolveFunc(code);
|
|
73
|
+
resolveFunc(options.captureOutput ? { code: code, output: output } : code);
|
|
67
74
|
}
|
|
68
75
|
});
|
|
69
76
|
});
|
|
70
77
|
}
|
|
71
78
|
exports.cmd = cmd;
|
|
79
|
+
async function cmdWithOutput(command, options) {
|
|
80
|
+
const result = await cmd(command, { ...options, captureOutput: true });
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
exports.cmdWithOutput = cmdWithOutput;
|
|
72
84
|
/**
|
|
73
85
|
*
|
|
74
86
|
*
|
|
@@ -246,7 +258,7 @@ const generateProjectFilters = async ({ platform, filteringSets, }) => {
|
|
|
246
258
|
if (filteredProjects.length === 0) {
|
|
247
259
|
throw new Error("No projects found in playwright config that matches the filtering criteria");
|
|
248
260
|
}
|
|
249
|
-
return filteredProjects
|
|
261
|
+
return filteredProjects;
|
|
250
262
|
};
|
|
251
263
|
exports.generateProjectFilters = generateProjectFilters;
|
|
252
264
|
function buildRepoName(projectName) {
|
package/package.json
CHANGED
package/dist/run-all-tests.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Platform } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @export
|
|
5
|
-
* @param {TestRunParameters} { name, dir, pwOptions }
|
|
6
|
-
*/
|
|
7
|
-
export declare function runAllTests({ pwOptions, platform, }: {
|
|
8
|
-
pwOptions?: string;
|
|
9
|
-
platform: Platform;
|
|
10
|
-
}): Promise<{
|
|
11
|
-
hasTestPassed: boolean;
|
|
12
|
-
}>;
|
|
13
|
-
//# sourceMappingURL=run-all-tests.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-all-tests.d.ts","sourceRoot":"","sources":["../src/run-all-tests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGnC;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,EAChC,SAAS,EACT,QAAQ,GACT,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACpB,GAAG,OAAO,CAAC;IACV,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,CAoBD"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { TestRunParameters } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @export
|
|
5
|
-
* @param {TestRunParameters} { name, dir, pwOptions }
|
|
6
|
-
*/
|
|
7
|
-
export declare function runSpecificTests({ tests, pwOptions, platform, }: TestRunParameters): Promise<{
|
|
8
|
-
hasTestPassed: boolean;
|
|
9
|
-
}>;
|
|
10
|
-
//# sourceMappingURL=run-specific-test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-specific-test.d.ts","sourceRoot":"","sources":["../src/run-specific-test.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAY5C;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,KAAU,EACV,SAAS,EACT,QAAQ,GACT,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,CA4FD"}
|