diff --git a/lib/test.js b/lib/test.js index 02d68e940..441ef4e61 100644 --- a/lib/test.js +++ b/lib/test.js @@ -83,8 +83,10 @@ class ExecutionContext extends assert.Assertions { let {title, isSet, isValid, isEmpty} = buildTitle(implementation); if (!isSet || isEmpty) { - title = `${test.title} (attempt ${test.attemptCount + 1})`; - } else if (!isValid) { + title = `${test.title} ─ attempt ${test.attemptCount + 1}`; + } else if (isValid) { + title = `${test.title} ─ ${title}`; + } else { throw new TypeError('`t.try()` titles must be strings'); // Throw synchronously! } diff --git a/test/test-try-commit.js b/test/test-try-commit.js index a163220c5..2ba492cc4 100644 --- a/test/test-try-commit.js +++ b/test/test-try-commit.js @@ -209,15 +209,15 @@ test('try-commit has proper titles, when going in depth and width', async t => { await Promise.all([ a.try(async b => { - t.is(b.title, 'test (attempt 1)'); + t.is(b.title, 'test ─ attempt 1'); await Promise.all([ - b.try(c => t.is(c.title, 'test (attempt 1) (attempt 1)')), - b.try(c => t.is(c.title, 'test (attempt 1) (attempt 2)')) + b.try(c => t.is(c.title, 'test ─ attempt 1 ─ attempt 1')), + b.try(c => t.is(c.title, 'test ─ attempt 1 ─ attempt 2')) ]); }), - a.try(b => t.is(b.title, 'test (attempt 2)')), - a.try(b => t.is(b.title, 'test (attempt 3)')) + a.try(b => t.is(b.title, 'test ─ attempt 2')), + a.try(b => t.is(b.title, 'test ─ attempt 3')) ]); }).run(); }); @@ -404,11 +404,11 @@ test('try-commit does not allow to use .end() in attempt when parent is regular test('try-commit accepts macros', async t => { const macro = b => { - t.is(b.title, ' Title'); + t.is(b.title, 'test ─ Title'); b.pass(); }; - macro.title = providedTitle => `${providedTitle ? providedTitle : ''} Title`; + macro.title = (providedTitle = '') => `${providedTitle} Title`.trim(); const result = await ava(async a => { const res = await a.try(macro);