Skip to content

Commit

Permalink
feature: @supertape/formatter-progress-bar: add support of WebStorm
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Feb 15, 2024
1 parent 6a7f41f commit 3b9155c
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/formatter-progress-bar/lib/progress-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const end = ({barStore, out}) => ({count, passed, failed, skiped}) => {
out(`# pass ${passed}`);

if (skiped)
out(`# ⚠️ skip ${skiped}`);
out(formatSkip(skiped));

out('');

Expand Down Expand Up @@ -198,3 +198,10 @@ function _createProgress({total, color, test}) {

return bar;
}

function formatSkip(skiped) {
const {TERMINAL_EMULATOR} = process.env;
const spaces = /JetBrains/.test(TERMINAL_EMULATOR) ? '' : ' ';

return `# ⚠️ ${spaces}skip ${skiped}`;
}
50 changes: 50 additions & 0 deletions packages/formatter-progress-bar/lib/progress-bar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,56 @@ test('supertape: format: progress bar: skip', async (t) => {
t.end();
});

test('supertape: format: progress bar: skip: webstorm', async (t) => {
const fn = (t) => {
t.ok(true);
t.end();
};

const message = 'skip: success';
const {
CI,
TERMINAL_EMULATOR,
} = env;

env.CI = 1;
env.TERMINAL_EMULATOR = 'JetBrains-JediTerm';

const {
run,
test,
stream,
} = await createTest({
formatter: progressBar,
});

test(message, fn, {
skip: true,
});

const [result] = await Promise.all([
pull(stream, 8),
run(),
]);

env.CI = CI;
env.TERMINAL_EMULATOR = TERMINAL_EMULATOR;

const expected = montag`
TAP version 13
1..0
# tests 0
# pass 0
# ⚠️ skip 1
# ✅ ok
`;

t.equal(result, expected);
t.end();
});

test('supertape: format: progress bar: color', async (t) => {
const fn = (t) => {
t.ok(true);
Expand Down

0 comments on commit 3b9155c

Please sign in to comment.