MCPcopy Create free account
hub / github.com/babel/babel / interpret

Method interpret

scripts/parser-tests/utils/parser-test-runner.js:198–253  ·  view source on GitHub ↗

* Interpret the results of the tests. * @param {*} results * @param {*} allowlist * @returns {Summary}

(results, allowlist)

Source from the content-addressed store, hash-verified

196 * @returns {Summary}
197 */
198 interpret(results, allowlist) {
199 /**
200 * @type {Summary}
201 */
202 const summary = {
203 passed: true,
204 allowed: {
205 success: [],
206 failure: [],
207 falsePositive: [],
208 falseNegative: [],
209 },
210 disallowed: {
211 success: [],
212 failure: [],
213 falsePositive: [],
214 falseNegative: [],
215 },
216 unrecognized: [],
217 count: results.length,
218 };
219
220 results.forEach(function (result) {
221 let classification, isAllowed;
222 const inAllowlist = allowlist.has(result.id);
223 allowlist.delete(result.id);
224
225 if (!result.expectedError) {
226 if (!result.actualError) {
227 classification = "success";
228 isAllowed = !inAllowlist;
229 } else {
230 classification = "falseNegative";
231 isAllowed = inAllowlist;
232 }
233 } else {
234 if (!result.actualError) {
235 classification = "falsePositive";
236 isAllowed = inAllowlist;
237 } else {
238 classification = "failure";
239 isAllowed = !inAllowlist;
240 }
241 }
242
243 summary.passed &&= isAllowed;
244 summary[isAllowed ? "allowed" : "disallowed"][classification].push(
245 result
246 );
247 });
248
249 summary.unrecognized = Array.from(allowlist);
250 summary.passed = !!summary.passed && summary.unrecognized.length === 0;
251
252 return summary;
253 }
254
255 async output(summary) {

Callers 1

runMethod · 0.95

Calls 3

deleteMethod · 0.65
hasMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected