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

Method interpret

scripts/parser-tests/utils/parser-test-runner.js:200–255  ·  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

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