as-test 1.1.6 → 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 +13 -0
- 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/log.js +9 -5
- package/assembly/util/json.ts +0 -112
package/bin/wipc.js
CHANGED
|
@@ -1,83 +1,80 @@
|
|
|
1
1
|
export var MessageType;
|
|
2
2
|
(function (MessageType) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
MessageType[(MessageType["OPEN"] = 0)] = "OPEN";
|
|
4
|
+
MessageType[(MessageType["CLOSE"] = 1)] = "CLOSE";
|
|
5
|
+
MessageType[(MessageType["CALL"] = 2)] = "CALL";
|
|
6
|
+
MessageType[(MessageType["DATA"] = 3)] = "DATA";
|
|
7
7
|
})(MessageType || (MessageType = {}));
|
|
8
8
|
export class Channel {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
this.buffer = this.buffer.subarray(flushLength);
|
|
39
|
-
}
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (idx > 0) {
|
|
43
|
-
this.onPassthrough(this.buffer.subarray(0, idx));
|
|
44
|
-
this.buffer = this.buffer.subarray(idx);
|
|
45
|
-
}
|
|
46
|
-
if (this.buffer.length < Channel.HEADER_SIZE)
|
|
47
|
-
return;
|
|
48
|
-
const type = this.buffer.readUInt8(4);
|
|
49
|
-
const length = this.buffer.readUInt32LE(5);
|
|
50
|
-
const frameSize = Channel.HEADER_SIZE + length;
|
|
51
|
-
if (this.buffer.length < frameSize)
|
|
52
|
-
return;
|
|
53
|
-
const payload = this.buffer.subarray(Channel.HEADER_SIZE, frameSize);
|
|
54
|
-
this.buffer = this.buffer.subarray(frameSize);
|
|
55
|
-
this.handleFrame(type, payload);
|
|
9
|
+
constructor(input = process.stdin, output = process.stdout) {
|
|
10
|
+
this.input = input;
|
|
11
|
+
this.output = output;
|
|
12
|
+
this.buffer = Buffer.alloc(0);
|
|
13
|
+
this.input.on("data", (chunk) => this.onData(chunk));
|
|
14
|
+
}
|
|
15
|
+
send(type, payload) {
|
|
16
|
+
const body = payload ?? Buffer.alloc(0);
|
|
17
|
+
const header = Buffer.alloc(Channel.HEADER_SIZE);
|
|
18
|
+
Channel.MAGIC.copy(header, 0);
|
|
19
|
+
header.writeUInt8(type, 4);
|
|
20
|
+
header.writeUInt32LE(body.length, 5);
|
|
21
|
+
this.output.write(Buffer.concat([header, body]));
|
|
22
|
+
}
|
|
23
|
+
sendJSON(type, msg) {
|
|
24
|
+
const json = Buffer.from(JSON.stringify(msg), "utf8");
|
|
25
|
+
this.send(type, json);
|
|
26
|
+
}
|
|
27
|
+
onData(chunk) {
|
|
28
|
+
this.buffer = Buffer.concat([this.buffer, chunk]);
|
|
29
|
+
while (true) {
|
|
30
|
+
if (this.buffer.length === 0) return;
|
|
31
|
+
const idx = this.buffer.indexOf(Channel.MAGIC);
|
|
32
|
+
if (idx === -1) {
|
|
33
|
+
const keep = Math.min(this.buffer.length, Channel.MAGIC_PREFIX_MAX);
|
|
34
|
+
const flushLength = this.buffer.length - keep;
|
|
35
|
+
if (flushLength > 0) {
|
|
36
|
+
this.onPassthrough(this.buffer.subarray(0, flushLength));
|
|
37
|
+
this.buffer = this.buffer.subarray(flushLength);
|
|
56
38
|
}
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (idx > 0) {
|
|
42
|
+
this.onPassthrough(this.buffer.subarray(0, idx));
|
|
43
|
+
this.buffer = this.buffer.subarray(idx);
|
|
44
|
+
}
|
|
45
|
+
if (this.buffer.length < Channel.HEADER_SIZE) return;
|
|
46
|
+
const type = this.buffer.readUInt8(4);
|
|
47
|
+
const length = this.buffer.readUInt32LE(5);
|
|
48
|
+
const frameSize = Channel.HEADER_SIZE + length;
|
|
49
|
+
if (this.buffer.length < frameSize) return;
|
|
50
|
+
const payload = this.buffer.subarray(Channel.HEADER_SIZE, frameSize);
|
|
51
|
+
this.buffer = this.buffer.subarray(frameSize);
|
|
52
|
+
this.handleFrame(type, payload);
|
|
57
53
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
54
|
+
}
|
|
55
|
+
handleFrame(type, payload) {
|
|
56
|
+
switch (type) {
|
|
57
|
+
case MessageType.OPEN:
|
|
58
|
+
this.onOpen();
|
|
59
|
+
break;
|
|
60
|
+
case MessageType.CLOSE:
|
|
61
|
+
this.onClose();
|
|
62
|
+
break;
|
|
63
|
+
case MessageType.CALL:
|
|
64
|
+
this.onCall(JSON.parse(payload.toString("utf8")));
|
|
65
|
+
break;
|
|
66
|
+
case MessageType.DATA:
|
|
67
|
+
this.onDataMessage(payload);
|
|
68
|
+
break;
|
|
69
|
+
default:
|
|
70
|
+
throw new Error(`Unknown frame type: ${type}`);
|
|
75
71
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
}
|
|
73
|
+
onPassthrough(_data) {}
|
|
74
|
+
onOpen() {}
|
|
75
|
+
onClose() {}
|
|
76
|
+
onCall(_msg) {}
|
|
77
|
+
onDataMessage(_data) {}
|
|
81
78
|
}
|
|
82
79
|
Channel.MAGIC = Buffer.from("WIPC");
|
|
83
80
|
Channel.HEADER_SIZE = 9;
|
package/lib/build/index.d.ts
CHANGED