Socket
Book a DemoInstallSign in
Socket

assertion-counter

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assertion-counter

Assertion counter with some unique features

0.3.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

assertion-counter

Assertion counter with some unique features.

Install

npm i assertion-counter

Usage

const counter = require('assertion-counter')

it('should count assertions', (done) => {
  const ok = counter(5, done);
  // or without done
  const ok = counter(5); // then return ok.promise

  ok()

  // can take an error
  ok(new Error('not ok'))     // calls done(error)

  // can take a [async] function
  ok(async () => {
    throw new Error('not ok') // calls done(error)
  })

  const callMe = () => {
    // the function passes results from previous calls
    ok(...previousArgs => {
      assert.equal(previousArgs[0], 'ok')
    })                     │
  }                        │
                           │
  ok(() => {               │
    setTimeout(callMe);    │
    return 'ok' ───────────┘
  })

})

FAQs

Package last updated on 24 Nov 2018

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.