UNPKG

@tapjs/node-serialize

Version:

Stream TAP test data as a serialized node:test stream

29 lines 965 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.onAddFn = void 0; const test_nested_location_js_1 = require("./test-nested-location.js"); const onAddFn = (comment, diagsMap, subsMap) => { const onAdd = (t) => { const tt = t; const subs = []; const diags = diagsMap.get(t) || []; subsMap.set(t, subs); diagsMap.set(t, diags); if (typeof tt.comment === 'function') { tt.comment = comment; } else if (!tt.comment) { t.parser.on('comment', message => { message = message.replace(/^#/, '').trim(); diags.push({ ...(0, test_nested_location_js_1.testNestedLocation)(t), message }); }); } tt.on('subtestAdd', onAdd); if (t.parent) { subsMap.get(t.parent)?.push(t); } }; return onAdd; }; exports.onAddFn = onAddFn; //# sourceMappingURL=on-add.js.map