@tapjs/node-serialize
Version:
Stream TAP test data as a serialized node:test stream
23 lines • 864 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeStdio = void 0;
const loc_from_at_js_1 = require("./loc-from-at.js");
const serializeStdio = (stream, process, which) => {
const write = (m) => {
const message = String(m);
stream[which]({ ...(0, loc_from_at_js_1.locFromAt)(write), message });
};
const orig = process[which];
Object.defineProperty(process, which, {
configurable: true,
enumerable: true,
writable: true,
// create a new object that inherits from the original, but has
// a write() method that captures a test:stderr/test:stdout message
value: Object.defineProperties(Object.create(orig), {
write: { value: write },
}),
});
};
exports.serializeStdio = serializeStdio;
//# sourceMappingURL=stdio.js.map