Comparing version 5.2.1 to 5.3.0
28
index.js
@@ -57,6 +57,7 @@ import * as assert from './assert.js' | ||
skipped++ | ||
if (only && !test.only) return | ||
if (only && !test.only) return test | ||
isNode ? | ||
console.log(`${CYAN}≫ ${test.name}${test.tag ? ` (${test.tag})` : ''}${RESET}`) : | ||
console.log(`${CYAN}» ${test.name}${test.tag ? ` (${test.tag})` : ''}${RESET}`) : | ||
console.log(`%c${test.name} ≫` + (test.tag ? ` (${test.tag})` : ''), 'color: #dadada') | ||
return test | ||
}) | ||
@@ -67,5 +68,6 @@ } | ||
queue = queue.then(() => { | ||
if (only && !test.only) { skipped++; return } | ||
isNode ? console.log(`${CYAN}≫ ${test.name}${test.tag ? ` (${test.tag})` : ''}${RESET}`) : | ||
if (only && !test.only) { skipped++; return test } | ||
isNode ? console.log(`${CYAN}» ${test.name}${test.tag ? ` (${test.tag})` : ''}${RESET}`) : | ||
console.log(`%c${test.name} 🚧` + (test.tag ? ` (${test.tag})` : ''), 'color: #dadada') | ||
return test | ||
}) | ||
@@ -86,3 +88,3 @@ } | ||
isNode ? | ||
console.log(`${GREEN}✔ ${assertIndex} — ${msg}${RESET}`) : | ||
console.log(`${GREEN}√ ${assertIndex} — ${msg}${RESET}`) : | ||
console.log(`%c✔ ${assertIndex} — ${msg}`, 'color: #229944') | ||
@@ -95,3 +97,3 @@ if (!test.demo) { | ||
isNode ? ( | ||
console.log(`${RED}✖ ${assertIndex} — ${msg}`), | ||
console.log(`${RED}× ${assertIndex} — ${msg}`), | ||
info && ( | ||
@@ -113,6 +115,6 @@ console.info(`actual:${RESET}`, typeof info.actual === 'string' ? JSON.stringify(info.actual) : info.actual, RED), | ||
queue = queue.then(async () => { | ||
if (only && !test.only) { skipped++; return } | ||
queue = queue.then(async (prev) => { | ||
if (only && !test.only) { skipped++; return test } | ||
isNode ? console.log(`▶ ${test.name}${test.tag ? ` (${test.tag})` : ''}`) : | ||
isNode ? console.log(`${RESET}${prev && (prev.skip || prev.todo) ? '\n' : ''}► ${test.name}${test.tag ? ` (${test.tag})` : ''}`) : | ||
console.group(test.name + (test.tag ? ` (${test.tag})` : '')) | ||
@@ -127,10 +129,12 @@ | ||
failed += 1 | ||
// FIXME: this syntax is due to chrome not always able to grasp the stack trace from source maps | ||
console.error(e.stack) | ||
console.error(RED + e.stack, RESET) | ||
} | ||
finally { | ||
if (!isNode) console.groupEnd() | ||
else console.log() | ||
} | ||
return result | ||
return test | ||
}) | ||
@@ -150,3 +154,3 @@ } | ||
// summary | ||
console.log(`---`) | ||
console.log(`\n---\n`) | ||
const total = passed + failed + skipped | ||
@@ -153,0 +157,0 @@ if (only) console.log(`# only ${only} cases`) |
{ | ||
"name": "tst", | ||
"description": "Tape-compatible test runner", | ||
"version": "5.2.1", | ||
"version": "5.3.0", | ||
"repository": "dy/tst", | ||
@@ -6,0 +6,0 @@ "author": "Dmitry Yv", |
@@ -53,2 +53,3 @@ import t from './index.js' | ||
await new Promise(ok => setTimeout(ok)) | ||
// t.fail('test failed') | ||
throw Error('xxx') | ||
@@ -55,0 +56,0 @@ }) |
15558
358