Comparing version 5.0.11 to 5.1.0
@@ -44,4 +44,4 @@ import deq from 'dequal' | ||
this.log(deq(a, b), 'deepEqual', msg, { | ||
actual: a, | ||
expected: b | ||
actual: isPrimitive(a) ? a : a.slice ? a.slice() : Object.assign({}, a), | ||
expected: isPrimitive(b) ? b : b.slice ? b.slice() : Object.assign({}, b) | ||
}) | ||
@@ -52,4 +52,4 @@ } | ||
this.log(!deq(a, b), 'notDeepEqual', msg, { | ||
actual: a, | ||
expected: b | ||
actual: isPrimitive(a) ? a : a.slice ? a.slice() : Object.assign({}, a), | ||
expected: isPrimitive(b) ? b : b.slice ? b.slice() : Object.assign({}, b) | ||
}) | ||
@@ -60,4 +60,4 @@ } | ||
this.log(isPrimitive(a) || isPrimitive(b) ? Object.is(a, b) : deq(a, b), 'is', msg, { | ||
actual: a, | ||
expected: b | ||
actual: isPrimitive(a) ? a : a.slice ? a.slice() : Object.assign({}, a), | ||
expected: isPrimitive(b) ? b : b.slice ? b.slice() : Object.assign({}, b) | ||
}) | ||
@@ -64,0 +64,0 @@ } |
12
index.js
@@ -14,3 +14,2 @@ import * as assert from './assert.js' | ||
// some bundlers incur async tick (like parcel import().then) - safer to do macrotask | ||
let start | ||
@@ -59,3 +58,3 @@ let queue = new Promise(resolve => start = resolve) | ||
skipped++ | ||
if (only && !test.only) { return } | ||
if (only && !test.only) return | ||
isNode ? | ||
@@ -94,3 +93,8 @@ console.log(`${CYAN}≫ ${test.name}${test.tag ? ` (${test.tag})` : ''}${RESET}`) : | ||
} else { | ||
isNode ? (console.log(`${RED}✖ ${assertIndex} — ${msg}`), console.log(info), console.error(new Error, RESET)) : | ||
isNode ? ( | ||
console.log(`${RED}✖ ${assertIndex} — ${msg}`), | ||
console.info(`actual:${RESET}`, typeof info.actual === 'string' ? JSON.stringify(info.actual) : info.actual, RED), | ||
console.info(`expected:${RESET}`, typeof info.expected === 'string' ? JSON.stringify(info.expected) : info.expected, RED), | ||
console.error(new Error, RESET) | ||
) : | ||
console.assert(false, `${assertIndex} — ${msg}${RESET}`, info, new Error) | ||
@@ -136,3 +140,3 @@ if (!test.demo) { | ||
// summarise | ||
// summary | ||
console.log(`---`) | ||
@@ -139,0 +143,0 @@ const total = passed + failed + skipped |
{ | ||
"name": "tst", | ||
"description": "Tape-compatible test runner", | ||
"version": "5.0.11", | ||
"version": "5.1.0", | ||
"repository": "dy/tst", | ||
@@ -6,0 +6,0 @@ "author": "Dmitry Yv", |
# tst | ||
* tape-compatible | ||
* async functions | ||
* `t.todo`, `t.fixme` - broken/unfinished | ||
* `t.node`, `t.browser`, `t.require`, `t.import` - target env tests | ||
* async functions support | ||
* `t.todo`, `t.fixme` for broken / unfinished tests | ||
* `t.node`, `t.browser`, `t.require`, `t.import` - environment conditional tests | ||
* `t.demo` - demo-run (can fail) | ||
* `console.group` in browser | ||
* inspectable errors | ||
* correct stacktrace with sourcemaps | ||
* `t.is` assert <!-- almost, same --> | ||
* `t.is` for generic comparison <!-- almost, same --> | ||
* muted skipped | ||
* better colors | ||
* multiple `only` tests | ||
* run by `idle` | ||
* ES export | ||
@@ -45,3 +49,3 @@ ## Install | ||
t.is(42, '42'); | ||
t.is({}, {}); | ||
t.is({}, {x:1}); | ||
@@ -58,5 +62,5 @@ t.fail('nok') | ||
* tape-modern | ||
* @goto-bus-stop/tape-modern | ||
* [tape-modern](https://ghub.io/tape-modern) | ||
* [@goto-bus-stop/tape-modern](https://github.com/goto-bus-stop/tape-modern#readme) | ||
<p align="right">HK</p> |
12219
271
65