npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ava-spec

v1.1.1

Published

Drop-in BDD helpers for AVA test runner 🌠

Downloads

2,224

Readme

AVA Spec

Build Status

Installation

AVA Spec is meant to be installed next to AVA, so please follow its installation instructions first.

Then, install ava-spec as a development dependency:

$ npm install --save-dev ava-spec

You still run tests with ava command. The only thing that changes are tests themselves.

Usage

First of all, you can use ava-spec as a drop-in for ava:

import test from 'ava-spec';

test('AVA Spec is 100% compatible with ava', t => {
  t.is(true, true);
});

Jasmine-like DSL is supported:

import {describe} from 'ava-spec';

describe('AVA Spec', it => {
  it('can look almost like jasmine', t => {
    t.deepEqual([1, 2], [1, 2]);
  });

  it.todo('supports all chaining modifiers!');
});

Or write cucumber-like scenarios:

import {feature} from 'ava-spec';

feature('Cash withdrawal.', scenario => {
  scenario('Not enough money in ATM', t => {
    // Cucumber-like keywords are available
  });
});

Or just group tests together:

test.serial.skip.group(test => {
  test('AVA Spec can be used to just group some tests', t => {
    t.not(true, false);
  });
});

Last but not least you can pass groups around in fun ways:

const subject = test.describe('You');

subject('do not need to use callbacks!', t => {
  t.is(2 + 2, 4);
});

Result:

  - AVA Spec can be used to just group some tests
  ✔ AVA Spec is 100% compatible with ava
  ✔ AVA Spec can look almost like jasmine
  - AVA Spec supports all chaining modifiers!
  ✔ Cash withdrawal. Not enough money in ATM
  ✔ You do not need to use callbacks!

  4 tests passed
  1 test skipped
  1 test todo

API

AVA spec allows you to define test groups using 3 equivalent methods:

test.describe([title], implementation)

test.feature([title], implementation)

test.group([title], implementation)

title

Type: string

A group title.

implementation(ava)

Type: function

It is called by AVA Spec with modified AVA instance as so:

  1. Group modifiers are applied to all tests inside it
  2. Group title is prefixed to all test titles inside it

Caveats

Currently AVA Spec doesn't support per-group hooks. It's a feature planned for 1.1.0.

Team

Adam Stankiewicz | Please help me! ---|--- Adam Stankiewicz | Become co-author!