Skip to content

Commit

Permalink
fix: supertape: formatter: comment
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Feb 29, 2024
1 parent 8a6b7d1 commit 8b457ff
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/supertape/bin/formatter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const createFormatter = (parentPort) => {
}]);
});

formatter.on('comment', (message) => {
parentPort.postMessage(['test:end', {
formatter.on('comment', ({message}) => {
parentPort.postMessage(['comment', {
message,
}]);
});
Expand Down
25 changes: 24 additions & 1 deletion packages/supertape/bin/formatter.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
stub,
} from '../lib/supertape.mjs';

test('supertape: bin: formatter', (t) => {
test('supertape: bin: formatter: success', (t) => {
const postMessage = stub();
const parentPort = {
postMessage,
Expand All @@ -28,3 +28,26 @@ test('supertape: bin: formatter', (t) => {
t.calledWith(postMessage, expected);
t.end();
});

test('supertape: bin: formatter: comment', (t) => {
const postMessage = stub();
const parentPort = {
postMessage,
};

const formatter = createFormatter(parentPort);

const emit = formatter.emit.bind(formatter);
emit('comment', {
message: 'hello',
});

const expected = [
['comment', {
message: 'hello',
}],
];

t.calledWith(postMessage, expected);
t.end();
});

0 comments on commit 8b457ff

Please sign in to comment.