@empiricalrun/test-run 0.7.2 → 0.7.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 +12 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +20 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @empiricalrun/test-run
|
|
2
2
|
|
|
3
|
+
## 0.7.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b070af3: fix: error handling in test run tool
|
|
8
|
+
|
|
9
|
+
## 0.7.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- b14d5bf: feat: support headed executions of test run tool
|
|
14
|
+
|
|
3
15
|
## 0.7.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { TestCase } from "./types";
|
|
2
|
-
export declare function runSingleTest({ testName, suites, fileName, projects, }: {
|
|
2
|
+
export declare function runSingleTest({ testName, suites, fileName, projects, headed, }: {
|
|
3
3
|
testName: string;
|
|
4
4
|
suites: string[];
|
|
5
5
|
fileName: string;
|
|
6
6
|
projects?: string[];
|
|
7
|
+
headed?: boolean;
|
|
7
8
|
}): Promise<{
|
|
8
9
|
hasTestPassed: boolean;
|
|
9
10
|
summaryJson: any;
|
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;AAG7C,wBAAsB,aAAa,CAAC,EAClC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,
|
|
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,EACR,MAAM,GACP,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;;;GAuBA;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,12 +9,13 @@ const path_1 = __importDefault(require("path"));
|
|
|
9
9
|
const lib_1 = require("./lib");
|
|
10
10
|
const types_1 = require("./types");
|
|
11
11
|
const utils_1 = require("./utils");
|
|
12
|
-
async function runSingleTest({ testName, suites, fileName, projects, }) {
|
|
12
|
+
async function runSingleTest({ testName, suites, fileName, projects, headed, }) {
|
|
13
13
|
const testDir = "tests";
|
|
14
14
|
const filePath = path_1.default.relative(process.cwd(), fileName);
|
|
15
|
+
const pwOptions = headed ? "--headed" : "";
|
|
15
16
|
const result = await (0, lib_1._runTest)({
|
|
16
17
|
tests: [{ name: testName, dir: testDir, filePath, suites }],
|
|
17
|
-
pwOptions
|
|
18
|
+
pwOptions,
|
|
18
19
|
platform: types_1.Platform.WEB,
|
|
19
20
|
projects,
|
|
20
21
|
});
|
|
@@ -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,EAE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D,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
|
@@ -28,12 +28,23 @@ function setupProcessSignalHandlers(proc) {
|
|
|
28
28
|
}
|
|
29
29
|
process.exit(0);
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
process.once(signal,
|
|
31
|
+
const sigintHandler = async () => await handleSignal("SIGINT");
|
|
32
|
+
const sigtermHandler = async () => await handleSignal("SIGTERM");
|
|
33
|
+
const otherSignalHandlers = ["SIGABRT", "SIGHUP", "SIGQUIT"].map((signal) => {
|
|
34
|
+
const handler = () => console.log(`Received ${signal}, which is a no-op`);
|
|
35
|
+
process.once(signal, handler);
|
|
36
|
+
return { signal, handler };
|
|
36
37
|
});
|
|
38
|
+
process.once("SIGINT", sigintHandler);
|
|
39
|
+
process.once("SIGTERM", sigtermHandler);
|
|
40
|
+
// Return a cleanup function that removes all signal handlers
|
|
41
|
+
return () => {
|
|
42
|
+
process.removeListener("SIGINT", sigintHandler);
|
|
43
|
+
process.removeListener("SIGTERM", sigtermHandler);
|
|
44
|
+
otherSignalHandlers.forEach(({ signal, handler }) => {
|
|
45
|
+
process.removeListener(signal, handler);
|
|
46
|
+
});
|
|
47
|
+
};
|
|
37
48
|
}
|
|
38
49
|
async function cmd(command, options) {
|
|
39
50
|
let output = options.captureOutput ? "" : undefined;
|
|
@@ -45,8 +56,8 @@ async function cmd(command, options) {
|
|
|
45
56
|
// Ensure child process receives signals
|
|
46
57
|
detached: false,
|
|
47
58
|
});
|
|
48
|
-
// Setup signal handlers
|
|
49
|
-
setupProcessSignalHandlers(p);
|
|
59
|
+
// Setup signal handlers and get cleanup function
|
|
60
|
+
const cleanupSignalHandlers = setupProcessSignalHandlers(p);
|
|
50
61
|
p.stdout.on("data", (x) => {
|
|
51
62
|
const log = x.toString();
|
|
52
63
|
if (options.captureOutput) {
|
|
@@ -65,6 +76,8 @@ async function cmd(command, options) {
|
|
|
65
76
|
errorLogs.push(log);
|
|
66
77
|
});
|
|
67
78
|
p.on("exit", (code) => {
|
|
79
|
+
// Clean up signal handlers when the process exits
|
|
80
|
+
cleanupSignalHandlers();
|
|
68
81
|
if (code != 0) {
|
|
69
82
|
// assuming last log is the error message before exiting
|
|
70
83
|
rejectFunc(errorLogs.slice(-3).join("\n"));
|