| 937 | } |
| 938 | |
| 939 | buildReport({ exitCode, terminal }) { |
| 940 | const results = ArrayPrototypeSlice(this.results); |
| 941 | ArrayPrototypePush(results, terminal); |
| 942 | return { |
| 943 | code: exitCode, |
| 944 | report: { |
| 945 | v: kProbeVersion, |
| 946 | probes: ArrayPrototypeMap(this.probes, ({ expr, target, maxHit }) => { |
| 947 | // Omit an unlimited maxHit, as Infinity would serialize to null in JSON. |
| 948 | const probe = { expr, target }; |
| 949 | if (maxHit !== Infinity) { probe.maxHit = maxHit; } |
| 950 | return probe; |
| 951 | }), |
| 952 | results, |
| 953 | }, |
| 954 | }; |
| 955 | } |
| 956 | |
| 957 | async cleanup() { |
| 958 | if (this.cleanupStarted) { return; } |