New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mvt

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mvt

A minimum viable testing framework, aka a few test helpers, 0 dependencies

  • 4.0.0-beta.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-64.29%
Maintainers
1
Weekly downloads
 
Created
Source

mvt NPM version js-standard-style

Minimum Viable Testing framework, it's like AVA, if AVA sucked

You should probably use AVA

Because AVA is awesome.

What is this

It started as a few test helpers. I made it for small projects with minimal test needs. That was a bit too restrictive though. In version 4.0.0+ it became a blatant ripoff of AVA. Well, not really. It does about 1% of what AVA does, and it doesn't do that nearly as well.

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 threats in the deluge. I'm often finding my devDependencies to be the culprit of most alerts. This is an effort to minimize recursive devDependencies.

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)

  • A CLI (for now)
    • tests must be run as node tests/a.js
    • the above must be done for each test file node tests/a.js && node tests/b.js
    • thus each test file gets a distinct output, so no central tracking of tests
  • Useful Error output
    • you won't get a clean stack, it will be filled with useless info from mvt
    • that will make it difficult to debug where problems actually occurred
  • Concurrency
    • that's not a thing here
  • Transpilation
    • 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

  • 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

$ npm install --save-dev mvt

Usage

const test = require('mvt')

test.setup({ verbose: true })

test.after(() => console.log('test.after invoked'))

test.before(() => console.log('test.before invoked'))

test('assert.is works', (assert) => assert.is(1, 1))

test('assert.not works', (assert) => assert.not(1, 2))

test('assert.pass works', assert) => assert.pass())

test.failing('test.failing and assert.fail works', (assert) => assert.fail())

test('assert.truthy works', (assert) => assert.truthy(1))

test('assert.falsy works', (assert) => assert.falsy(0))

test('assert.deepEqual works', (assert) => assert.deepEqual([1, 2], [1, 2]))

test('assert.throws works', (assert) => {
  assert.throws(() => { throw new Error('it throws') })
})

test('assert.notThrows works', async (assert) => {
  assert.notThrows(() => {})
})

test('assert.throwsAsync works', async (assert) => {
  await assert.throwsAsync(() => new Promise((resolve, reject) => {
    process.nextTick(() => reject(new Error('rejected Promise')))
  }))
})

test('assert.notThrowsAsync works', async (assert) => {
  await assert.notThrowsAsync(() => new Promise((resolve, reject) => {
    process.nextTick(() => resolve('all good'))
  }))
})

test.todo('test.todo works')

test.skip('test.skip works', (assert) => assert.truthy('skipped'))

test.only('test.only works', (assert) => assert.truthy('only'))

test.bench('test.bench works', { samples: 5, max: 300 }, (assert) => {
  return new Promise((resolve, reject) => {
    setTimeout(() => resolve(), 200)
  })
})

Output

API

Right now I'm feeling lazy. The full API is documented under usage. Eventually I'll add it here. You can also check the test file, though it's about the same as usage.

Notes

If your test file is called with the --verbose flag it will list all passed tests

It fails fast and hard with process.exit(1)

License

MIT © Andrew Carpenter

Keywords

FAQs

Package last updated on 14 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc