Comparing version 4.0.0-beta.0 to 4.0.0-beta.1
20
index.js
@@ -39,8 +39,12 @@ 'use strict' | ||
const handlErr = (msg, err, noExit) => { | ||
const handleErr = (msg, err, noExit) => { | ||
process.stderr.write(`${char('fail')} ${msg}\n`) | ||
err = err || `Failed: ${msg}` | ||
console.error(err instanceof Error ? err : new Error(err)) | ||
err = err instanceof Error ? err : new Error(err) | ||
return noExit ? null : process.exit(1) | ||
console.error(err) | ||
if (noExit) throw err | ||
return process.exit(1) | ||
} | ||
@@ -58,3 +62,3 @@ | ||
} catch (ex) { | ||
if (!failing) return handlErr(msg, ex, noExit) | ||
if (!failing) return handleErr(msg, ex, noExit) | ||
@@ -70,3 +74,3 @@ if (!verbose) return | ||
if (failing) { | ||
return handlErr(msg, new Error('Passed test called with test.failing')) | ||
return handleErr(msg, new Error('Passed test called with test.failing')) | ||
} | ||
@@ -86,3 +90,3 @@ | ||
} catch (ex) { | ||
return handlErr(msg, ex) | ||
return handleErr(msg, ex) | ||
} | ||
@@ -93,3 +97,3 @@ | ||
if (ms > max) { | ||
return handlErr(msg, new Error(`Bench failed: (${ms}ms > ${max}ms)`)) | ||
return handleErr(msg, new Error(`Bench failed: (${ms}ms > ${max}ms)`)) | ||
} | ||
@@ -262,3 +266,3 @@ | ||
return passed ? assert(msg, failing) : handlErr(msg, err) | ||
return passed ? assert(msg, failing) : handleErr(msg, err) | ||
} | ||
@@ -265,0 +269,0 @@ |
{ | ||
"name": "mvt", | ||
"version": "4.0.0-beta.0", | ||
"version": "4.0.0-beta.1", | ||
"description": "A minimum viable testing framework, aka a few test helpers, 0 dependencies", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,6 +5,6 @@ # mvt [](https://npmjs.org/package/mvt) [](https://github.com/feross/standard) | ||
## you should probably use AVA | ||
## You should probably use AVA | ||
Because [AVA](https://github.com/avajs/ava) is awesome. | ||
## what is this | ||
## What is this | ||
It started as a few test helpers. I made it for small projects with minimal | ||
@@ -15,3 +15,3 @@ test needs. That was a bit too restrictive though. In version `4.0.0+` it became | ||
## if it's inferior in every way to AVA then why does it exist | ||
## If it's inferior in every way to AVA then why does it exist | ||
Because I need to minimize my security alerts so that I don't lose real security | ||
@@ -21,7 +21,7 @@ threats in the deluge. I'm often finding my devDependencies to be the culprit | ||
## what's good about it | ||
## What's good about it | ||
- It has 0 dependencies and devDependencies | ||
- That's really about it | ||
## what it lacks (way more than I can list, but here's the most notable) | ||
## What it lacks (way more than I can list, but here's the most notable) | ||
- A CLI (for now) | ||
@@ -38,8 +38,10 @@ - tests must be run as `node tests/a.js` | ||
- also not a thing here | ||
- A community and product maturity | ||
- one of the most crucial pieces, I think we can all agree on that | ||
## this might be for you if | ||
## This might be for you if | ||
- You're willing to sacrifice all of the above (and more) to reduce dependencies | ||
- Your tests are in a single file and concurrency doesn't impact test times | ||
## install | ||
## Install | ||
@@ -50,3 +52,3 @@ ```sh | ||
## usage | ||
## Usage | ||
@@ -111,3 +113,3 @@ ```js | ||
## api | ||
## API | ||
@@ -118,3 +120,3 @@ Right now I'm feeling lazy. The full API is documented under `usage`. Eventually | ||
## notes | ||
## Notes | ||
@@ -125,4 +127,4 @@ If your test file is called with the `--verbose` flag it will list all passed tests | ||
## license | ||
## License | ||
MIT © [Andrew Carpenter](https://github.com/doesdev) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
15057
292
123
0