@empiricalrun/test-run 0.4.6 → 0.5.0
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/bin/index.js +6 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/run-specific-test.d.ts +1 -1
- package/dist/run-specific-test.d.ts.map +1 -1
- package/dist/run-specific-test.js +4 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +11 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/bin/index.js
CHANGED
|
@@ -11,8 +11,9 @@ const utils_1 = require("../utils");
|
|
|
11
11
|
commander_1.program
|
|
12
12
|
.option("-n, --name <test-name>", "Name of the test to run")
|
|
13
13
|
.option("-d, --dir <test-dir>", "Path to the test directory")
|
|
14
|
+
.option("-f, --file <test-file-path>", "Path to the test file")
|
|
14
15
|
.option("-p, --project <project-name...>", "Test projects to run")
|
|
15
|
-
.option("--skip-teardown",
|
|
16
|
+
.option("--skip-teardown", "This options skips running teardown tests")
|
|
16
17
|
.option("--forbid-only", `This options forbids the use of ".only" in the test files`)
|
|
17
18
|
.allowUnknownOption();
|
|
18
19
|
commander_1.program.parse(process.argv);
|
|
@@ -27,6 +28,8 @@ const utils_1 = require("../utils");
|
|
|
27
28
|
"-n",
|
|
28
29
|
"--name",
|
|
29
30
|
"--skip-teardown",
|
|
31
|
+
"-f",
|
|
32
|
+
"--file",
|
|
30
33
|
"-d",
|
|
31
34
|
"--dir",
|
|
32
35
|
"-p",
|
|
@@ -34,6 +37,7 @@ const utils_1 = require("../utils");
|
|
|
34
37
|
options.skipTeardown,
|
|
35
38
|
options.name,
|
|
36
39
|
options.dir,
|
|
40
|
+
options.file,
|
|
37
41
|
...options.project, // an array of comma separated project names/pattern matching globs *,premium-*,super-premium-*,safari
|
|
38
42
|
];
|
|
39
43
|
const pwOptions = process.argv
|
|
@@ -67,6 +71,7 @@ const utils_1 = require("../utils");
|
|
|
67
71
|
}
|
|
68
72
|
const { hasTestPassed } = await (0, __1.runTest)({
|
|
69
73
|
name: options.name,
|
|
74
|
+
filePath: options.file,
|
|
70
75
|
dir: directory,
|
|
71
76
|
pwOptions: pwOptions.join(" "),
|
|
72
77
|
platform,
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { TestRunParameters } from "./types";
|
|
|
4
4
|
* @export
|
|
5
5
|
* @param {TestRunParameters} { name, dir, pwOptions }
|
|
6
6
|
*/
|
|
7
|
-
export declare function runTest({ name, dir, pwOptions, platform, }: TestRunParameters): Promise<{
|
|
7
|
+
export declare function runTest({ name, filePath, dir, pwOptions, platform, }: TestRunParameters): Promise<{
|
|
8
8
|
hasTestPassed: boolean;
|
|
9
9
|
}>;
|
|
10
10
|
//# 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":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,EAC5B,IAAI,EACJ,GAAG,EACH,SAAS,EACT,QAAQ,GACT,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,CAMD"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,EAC5B,IAAI,EACJ,QAAQ,EACR,GAAG,EACH,SAAS,EACT,QAAQ,GACT,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,CAMD"}
|
package/dist/index.js
CHANGED
|
@@ -8,9 +8,9 @@ const run_specific_test_1 = require("./run-specific-test");
|
|
|
8
8
|
* @export
|
|
9
9
|
* @param {TestRunParameters} { name, dir, pwOptions }
|
|
10
10
|
*/
|
|
11
|
-
async function runTest({ name, dir, pwOptions, platform, }) {
|
|
11
|
+
async function runTest({ name, filePath, dir, pwOptions, platform, }) {
|
|
12
12
|
if (name) {
|
|
13
|
-
return await (0, run_specific_test_1.runSpecificTest)({ name, dir, pwOptions, platform });
|
|
13
|
+
return await (0, run_specific_test_1.runSpecificTest)({ name, dir, filePath, pwOptions, platform });
|
|
14
14
|
}
|
|
15
15
|
return await (0, run_all_tests_1.runAllTests)({ pwOptions, platform });
|
|
16
16
|
}
|
|
@@ -4,7 +4,7 @@ import { TestRunParameters } from "./types";
|
|
|
4
4
|
* @export
|
|
5
5
|
* @param {TestRunParameters} { name, dir, pwOptions }
|
|
6
6
|
*/
|
|
7
|
-
export declare function runSpecificTest({ name, dir, pwOptions, platform, }: TestRunParameters): Promise<{
|
|
7
|
+
export declare function runSpecificTest({ name, filePath, dir, pwOptions, platform, }: TestRunParameters): Promise<{
|
|
8
8
|
hasTestPassed: boolean;
|
|
9
9
|
}>;
|
|
10
10
|
//# sourceMappingURL=run-specific-test.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-specific-test.d.ts","sourceRoot":"","sources":["../src/run-specific-test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAY5C;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,EACpC,IAAI,EACJ,GAAG,EACH,SAAS,EACT,QAAQ,GACT,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,
|
|
1
|
+
{"version":3,"file":"run-specific-test.d.ts","sourceRoot":"","sources":["../src/run-specific-test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAY5C;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,EACpC,IAAI,EACJ,QAAQ,EACR,GAAG,EACH,SAAS,EACT,QAAQ,GACT,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,CA0ED"}
|
|
@@ -11,8 +11,10 @@ const utils_1 = require("./utils");
|
|
|
11
11
|
* @export
|
|
12
12
|
* @param {TestRunParameters} { name, dir, pwOptions }
|
|
13
13
|
*/
|
|
14
|
-
async function runSpecificTest({ name, dir, pwOptions, platform, }) {
|
|
15
|
-
const files = await (0, utils_1.getAllFilePaths)(dir
|
|
14
|
+
async function runSpecificTest({ name, filePath, dir, pwOptions, platform, }) {
|
|
15
|
+
const files = await (0, utils_1.getAllFilePaths)(dir, {
|
|
16
|
+
filePath,
|
|
17
|
+
});
|
|
16
18
|
let matchingFilePath = "";
|
|
17
19
|
// find the first file that contains the test block
|
|
18
20
|
// TODO: add suites support
|
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,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,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,EAA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AAY,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
|
@@ -9,7 +9,9 @@ export declare function cmd(command: string[], options: {
|
|
|
9
9
|
* @param {string} [directoryPath=""]
|
|
10
10
|
* @return {*} {Promise<string[]>}
|
|
11
11
|
*/
|
|
12
|
-
export declare function getAllFilePaths(directoryPath?: string
|
|
12
|
+
export declare function getAllFilePaths(directoryPath?: string, filters?: {
|
|
13
|
+
filePath?: string;
|
|
14
|
+
}): Promise<string[]>;
|
|
13
15
|
export declare const getTestModuleAliasFromSourceFile: (sourceFile: SourceFile) => string;
|
|
14
16
|
export declare function getTestCaseNode({ filePath, scenarioName, }: {
|
|
15
17
|
filePath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAW,UAAU,EAAc,MAAM,UAAU,CAAC;AAGjE,OAAO,EAEL,QAAQ,EAER,aAAa,EACd,MAAM,UAAU,CAAC;AAElB,wBAAgB,GAAG,CACjB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GACxC,OAAO,CAAC,MAAM,CAAC,CA2BjB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,aAAa,GAAE,MAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":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,CAAC;IACtC,YAAY,EAAE,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,iBAgBA;AAED,wBAAsB,+BAA+B,CAAC,QAAQ,EAAE,QAAQ,gBAevE;AAED,eAAO,MAAM,4BAA4B,UAEhC,MAAM,EAAE,mBAGE,MAAM,EAAE,EAAE,KAC1B,MAAM,EAUR,CAAC;AAEF,eAAO,MAAM,sBAAsB;cAIvB,QAAQ;mBACH,MAAM,EAAE;MACrB,QAAQ,MAAM,EAAE,CAmBnB,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"}
|
package/dist/utils/index.js
CHANGED
|
@@ -47,23 +47,30 @@ exports.cmd = cmd;
|
|
|
47
47
|
* @param {string} [directoryPath=""]
|
|
48
48
|
* @return {*} {Promise<string[]>}
|
|
49
49
|
*/
|
|
50
|
-
async function getAllFilePaths(directoryPath = "") {
|
|
50
|
+
async function getAllFilePaths(directoryPath = "", filters = {}) {
|
|
51
51
|
let filePaths = [];
|
|
52
52
|
try {
|
|
53
53
|
const files = await fs_extra_1.default.readdir(directoryPath);
|
|
54
|
+
let allFilePaths = [];
|
|
54
55
|
for (const file of files) {
|
|
55
56
|
const filePath = path_1.default.join(directoryPath, file);
|
|
56
57
|
const stat = await fs_extra_1.default.lstat(filePath);
|
|
57
58
|
if (stat.isDirectory()) {
|
|
58
59
|
// If it's a directory, recursively get file paths from the directory
|
|
59
|
-
const nestedFiles = await getAllFilePaths(filePath);
|
|
60
|
-
|
|
60
|
+
const nestedFiles = await getAllFilePaths(filePath, filters);
|
|
61
|
+
allFilePaths = allFilePaths.concat(nestedFiles);
|
|
61
62
|
}
|
|
62
63
|
else {
|
|
63
64
|
// If it's a file, push its path to the array
|
|
64
|
-
|
|
65
|
+
allFilePaths.push(filePath);
|
|
65
66
|
}
|
|
66
67
|
}
|
|
68
|
+
filePaths = allFilePaths.filter((filePath) => {
|
|
69
|
+
if (filters.filePath) {
|
|
70
|
+
return filePath.includes(filters.filePath);
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
});
|
|
67
74
|
}
|
|
68
75
|
catch (err) {
|
|
69
76
|
console.error("Error reading directory:", err);
|