Comparing version 5.0.6 to 5.0.7
@@ -6,11 +6,11 @@ import deq from 'dequal' | ||
export function fail (msg) { | ||
export function fail(msg) { | ||
this.log(false, 'fail', msg) | ||
} | ||
export function pass (msg) { | ||
export function pass(msg) { | ||
this.log(true, 'pass', msg) | ||
} | ||
export function ok (value, msg = 'should be truthy') { | ||
export function ok(value, msg = 'should be truthy') { | ||
this.log(Boolean(value), 'ok', msg, { | ||
@@ -22,3 +22,3 @@ actual: value, | ||
export function notOk (value, msg = 'should be falsy') { | ||
export function notOk(value, msg = 'should be falsy') { | ||
this.log(!value, 'notOk', msg, { | ||
@@ -30,3 +30,3 @@ actual: value, | ||
export function equal (a, b, msg = 'should be equal') { | ||
export function equal(a, b, msg = 'should be equal') { | ||
this.log(Object.is(a, b), 'equal', msg, { | ||
@@ -38,4 +38,4 @@ actual: a, | ||
export function notEqual (a, b, msg = 'should not be equal') { | ||
this.log(a !== b, 'notEqual', msg, { | ||
export function notEqual(a, b, msg = 'should not be equal') { | ||
this.log(!Object.is(a, b), 'notEqual', msg, { | ||
actual: a, | ||
@@ -46,3 +46,3 @@ expected: b | ||
export function deepEqual (a, b, msg = 'should deep equal') { | ||
export function deepEqual(a, b, msg = 'should deep equal') { | ||
this.log(deq(a, b), 'deepEqual', msg, { | ||
@@ -54,2 +54,9 @@ actual: a, | ||
export function notDeepEqual(a, b, msg = 'should deep equal') { | ||
this.log(!deq(a, b), 'notDeepEqual', msg, { | ||
actual: a, | ||
expected: b | ||
}) | ||
} | ||
export function is(a, b, msg = 'should be the same') { | ||
@@ -62,3 +69,3 @@ this.log(isPrimitive(a) || isPrimitive(b) ? Object.is(a, b) : deq(a, b), 'is', msg, { | ||
export function throws (fn, expected, msg = 'should throw') { | ||
export function throws(fn, expected, msg = 'should throw') { | ||
try { | ||
@@ -65,0 +72,0 @@ fn() |
10
index.js
@@ -5,2 +5,3 @@ import * as assert from './assert.js' | ||
const hasImport = typeof require === 'undefined' | ||
const GREEN = '\u001b[32m', RED = '\u001b[31m', YELLOW = '\u001b[33m', RESET = '\u001b[0m', CYAN = '\u001b[36m' | ||
@@ -59,3 +60,3 @@ let summaryTimeout | ||
isNode ? | ||
console.log(`≫ ${test.name}` + (test.tag ? ` (${test.tag})` : '')) : | ||
console.log(`${CYAN}≫ ${test.name}${test.tag ? ` (${test.tag})` : ''}${RESET}`) : | ||
console.log(`%c${test.name} ≫` + (test.tag ? ` (${test.tag})` : ''), 'color: #dadada') | ||
@@ -68,3 +69,3 @@ }) | ||
if (only && !test.only) { skipped++; return } | ||
isNode ? console.log(`≫ ${test.name}` + (test.tag ? ` (${test.tag})` : '')) : | ||
isNode ? console.log(`${CYAN}≫ ${test.name}${test.tag ? ` (${test.tag})` : ''}${RESET}`) : | ||
console.log(`%c${test.name} 🚧` + (test.tag ? ` (${test.tag})` : ''), 'color: #dadada') | ||
@@ -86,3 +87,3 @@ }) | ||
isNode ? | ||
console.log(`✔ ${assertIndex} — ${msg}`) : | ||
console.log(`${GREEN}✔ ${RESET}${assertIndex} — ${msg}`) : | ||
console.log(`%c✔ ${assertIndex} — ${msg}`, 'color: #229944') | ||
@@ -94,3 +95,4 @@ if (!test.demo) { | ||
} else { | ||
console.assert(false, `${assertIndex} — ${msg}`, info, (new Error())) | ||
isNode ? (console.log(`${RED}✖ ${RESET}${assertIndex} — ${msg}`), console.log(info), console.error(new Error)) : | ||
console.assert(false, `${assertIndex} — ${msg}`, info, new Error) | ||
if (!test.demo) { | ||
@@ -97,0 +99,0 @@ test.assertion.push({ idx: assertIndex, msg, info, error: new Error() }) |
{ | ||
"name": "tst", | ||
"description": "Tape-compatible test runner", | ||
"version": "5.0.6", | ||
"version": "5.0.7", | ||
"repository": "dy/tst", | ||
@@ -6,0 +6,0 @@ "author": "Dmitry Yv", |
11252
265