as-test 1.1.5 → 1.1.7
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 +16 -1
- package/README.md +4 -9
- package/assembly/index.ts +10 -15
- package/assembly/src/expectation.ts +11 -11
- package/assembly/src/fuzz.ts +11 -7
- package/assembly/src/log.ts +2 -2
- package/assembly/src/suite.ts +5 -5
- package/assembly/src/tests.ts +8 -8
- package/assembly/util/wipc.ts +5 -1
- package/bin/build-worker-pool.js +146 -142
- package/bin/build-worker.js +37 -34
- package/bin/commands/build-core.js +577 -465
- package/bin/commands/build.js +49 -29
- package/bin/commands/clean-core.js +120 -113
- package/bin/commands/clean.js +14 -8
- package/bin/commands/doctor-core.js +288 -289
- package/bin/commands/doctor.js +1 -1
- package/bin/commands/fuzz-core.js +467 -414
- package/bin/commands/fuzz.js +27 -10
- package/bin/commands/init-core.js +905 -794
- package/bin/commands/init.js +2 -2
- package/bin/commands/run-core.js +2675 -2344
- package/bin/commands/run.js +43 -25
- package/bin/commands/test.js +56 -32
- package/bin/commands/web-runner-source.js +1 -1
- package/bin/commands/web-session.js +516 -525
- package/bin/coverage-points.js +363 -341
- package/bin/crash-store.js +56 -66
- package/bin/index.js +4092 -3150
- package/bin/reporters/default.js +1090 -890
- package/bin/reporters/tap.js +319 -325
- package/bin/types.js +67 -67
- package/bin/util.js +1290 -1239
- package/bin/wipc.js +70 -73
- package/lib/build/index.d.ts +3 -1
- package/lib/build/index.js +1039 -1034
- package/lib/build/web-runner/client.js +1 -1
- package/lib/build/web-runner/html.js +1 -1
- package/lib/build/web-runner/worker.js +1 -1
- package/package.json +6 -3
- package/transform/lib/coverage.js +4 -4
- package/transform/lib/log.js +9 -5
- package/assembly/util/json.ts +0 -112
package/bin/crash-store.js
CHANGED
|
@@ -1,77 +1,67 @@
|
|
|
1
1
|
import { mkdirSync, writeFileSync } from "fs";
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
export function persistCrashRecord(rootDir, record) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
const entry = record.entryKey?.length
|
|
5
|
+
? record.entryKey
|
|
6
|
+
: crashEntryKey(record.file);
|
|
7
|
+
const dir = path.resolve(process.cwd(), rootDir);
|
|
8
|
+
mkdirSync(dir, { recursive: true });
|
|
9
|
+
const jsonPath = path.join(dir, `${entry}.json`);
|
|
10
|
+
const logPath = path.join(dir, `${entry}.log`);
|
|
11
|
+
const payload = {
|
|
12
|
+
timestamp: new Date().toISOString(),
|
|
13
|
+
...record,
|
|
14
|
+
};
|
|
15
|
+
const log = buildCrashLog(payload);
|
|
16
|
+
writeFileSync(jsonPath, JSON.stringify(payload, null, 2));
|
|
17
|
+
writeFileSync(logPath, log);
|
|
18
|
+
return { jsonPath, logPath };
|
|
19
19
|
}
|
|
20
20
|
function crashEntryKey(file) {
|
|
21
|
-
|
|
21
|
+
return path.basename(file).replace(/\.ts$/, "");
|
|
22
22
|
}
|
|
23
23
|
function buildCrashLog(payload) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (payload.reproCommand)
|
|
41
|
-
lines.push(`repro: ${payload.reproCommand}`);
|
|
24
|
+
const lines = [
|
|
25
|
+
`timestamp: ${payload.timestamp}`,
|
|
26
|
+
`kind: ${payload.kind}`,
|
|
27
|
+
`stage: ${payload.stage ?? "run"}`,
|
|
28
|
+
`file: ${payload.file}`,
|
|
29
|
+
];
|
|
30
|
+
if (payload.mode) lines.push(`mode: ${payload.mode}`);
|
|
31
|
+
if (typeof payload.seed == "number") lines.push(`seed: ${payload.seed}`);
|
|
32
|
+
if (payload.cwd) lines.push(`cwd: ${payload.cwd}`);
|
|
33
|
+
if (payload.buildCommand) lines.push(`build: ${payload.buildCommand}`);
|
|
34
|
+
if (payload.runCommand) lines.push(`run: ${payload.runCommand}`);
|
|
35
|
+
if (payload.reproCommand) lines.push(`repro: ${payload.reproCommand}`);
|
|
36
|
+
lines.push("");
|
|
37
|
+
lines.push("[error]");
|
|
38
|
+
lines.push(payload.error);
|
|
39
|
+
if (payload.failure) {
|
|
42
40
|
lines.push("");
|
|
43
|
-
lines.push("[
|
|
44
|
-
lines.push(payload.
|
|
45
|
-
if (payload.failure) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
lines.push(`instr: ${payload.failure.instr}`);
|
|
50
|
-
if (payload.failure.left)
|
|
51
|
-
lines.push(`left: ${payload.failure.left}`);
|
|
52
|
-
if (payload.failure.right)
|
|
53
|
-
lines.push(`right: ${payload.failure.right}`);
|
|
54
|
-
if (payload.failure.message) {
|
|
55
|
-
lines.push(`message: ${payload.failure.message}`);
|
|
56
|
-
}
|
|
41
|
+
lines.push("[failure]");
|
|
42
|
+
if (payload.failure.instr) lines.push(`instr: ${payload.failure.instr}`);
|
|
43
|
+
if (payload.failure.left) lines.push(`left: ${payload.failure.left}`);
|
|
44
|
+
if (payload.failure.right) lines.push(`right: ${payload.failure.right}`);
|
|
45
|
+
if (payload.failure.message) {
|
|
46
|
+
lines.push(`message: ${payload.failure.message}`);
|
|
57
47
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
lines.push("[fuzz-failures]");
|
|
61
|
-
for (const failure of payload.failures) {
|
|
62
|
-
lines.push(`run: ${failure.run}`);
|
|
63
|
-
lines.push(`seed: ${failure.seed}`);
|
|
64
|
-
if (failure.input)
|
|
65
|
-
lines.push(`input: ${JSON.stringify(failure.input)}`);
|
|
66
|
-
lines.push("");
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
lines.push("");
|
|
70
|
-
lines.push("[stdout]");
|
|
71
|
-
lines.push(payload.stdout ?? "");
|
|
48
|
+
}
|
|
49
|
+
if (payload.failures?.length) {
|
|
72
50
|
lines.push("");
|
|
73
|
-
lines.push("[
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
51
|
+
lines.push("[fuzz-failures]");
|
|
52
|
+
for (const failure of payload.failures) {
|
|
53
|
+
lines.push(`run: ${failure.run}`);
|
|
54
|
+
lines.push(`seed: ${failure.seed}`);
|
|
55
|
+
if (failure.input) lines.push(`input: ${JSON.stringify(failure.input)}`);
|
|
56
|
+
lines.push("");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
lines.push("");
|
|
60
|
+
lines.push("[stdout]");
|
|
61
|
+
lines.push(payload.stdout ?? "");
|
|
62
|
+
lines.push("");
|
|
63
|
+
lines.push("[stderr]");
|
|
64
|
+
lines.push(payload.stderr ?? "");
|
|
65
|
+
lines.push("");
|
|
66
|
+
return lines.join("\n");
|
|
77
67
|
}
|