@empiricalrun/test-run 0.7.3 → 0.7.5
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/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +22 -9
- package/package.json +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @empiricalrun/test-run
|
|
2
2
|
|
|
3
|
+
## 0.7.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c907653: fix: Remove deprecated lodash.isequal in favor of node:util.isDeepStrictEqual
|
|
8
|
+
|
|
9
|
+
## 0.7.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- b070af3: fix: error handling in test run tool
|
|
14
|
+
|
|
3
15
|
## 0.7.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"
|
|
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;AAIjE,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,aAA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AAU,EAAE,UAAU,CAAC;IACvB,kBAAkB,CAAC,EAAE,IAAI,GAAG,SAAS,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,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
|
@@ -7,11 +7,11 @@ exports.getTypescriptTestBlock = exports.handleTeardownSkipFlag = exports.getTes
|
|
|
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"));
|
|
10
|
-
const lodash_isequal_1 = __importDefault(require("lodash.isequal"));
|
|
11
10
|
const minimatch_1 = require("minimatch");
|
|
12
11
|
const path_1 = __importDefault(require("path"));
|
|
13
12
|
const ts_morph_1 = require("ts-morph");
|
|
14
13
|
const api_1 = require("tsx/esm/api");
|
|
14
|
+
const util_1 = require("util");
|
|
15
15
|
const types_1 = require("../types");
|
|
16
16
|
function setupProcessSignalHandlers(proc) {
|
|
17
17
|
const handleSignal = async (signal) => {
|
|
@@ -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"));
|
|
@@ -406,7 +419,7 @@ function getTypescriptTestBlock({ scenarioName, suites, content, }) {
|
|
|
406
419
|
// Iterate over each test function node and check if the suites match
|
|
407
420
|
for (const testNode of matchingTestFunctionNodes) {
|
|
408
421
|
const parentDescribes = getParentDescribeNames(testNode);
|
|
409
|
-
if ((0,
|
|
422
|
+
if ((0, util_1.isDeepStrictEqual)(parentDescribes, suites)) {
|
|
410
423
|
// Found the matching test block
|
|
411
424
|
return {
|
|
412
425
|
testBlock: testNode.getText(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/test-run",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -15,10 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"author": "Empirical Team <hey@empirical.run>",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@types/lodash.isequal": "^4.5.8",
|
|
19
18
|
"async-retry": "^1.3.3",
|
|
20
19
|
"commander": "^12.1.0",
|
|
21
|
-
"lodash.isequal": "^4.5.0",
|
|
22
20
|
"minimatch": "^10.0.1",
|
|
23
21
|
"ts-morph": "^23.0.0",
|
|
24
22
|
"tsx": "^4.16.2"
|