Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sheerun/ava-spec
Drop-in BDD helpers for AVA test runner :sparkler: [DEPRECATED, please use Jest!]
https://github.com/sheerun/ava-spec
Last synced: 3 months ago
JSON representation
Drop-in BDD helpers for AVA test runner :sparkler: [DEPRECATED, please use Jest!]
- Host: GitHub
- URL: https://github.com/sheerun/ava-spec
- Owner: sheerun
- License: mit
- Created: 2016-04-18T11:36:04.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-20T15:51:48.000Z (over 6 years ago)
- Last Synced: 2024-03-18T06:03:57.705Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 31.3 KB
- Stars: 144
- Watchers: 4
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Lists
- koa-awesome - ava-spec - Drop-in BDD helpers.
README
> **DEPRECATED** Please use [Jest](https://facebook.github.io/jest/) which is more powerful than Ava and supports `describe` out of the box.
# ![AVA Spec](https://i.imgsafe.org/0314359.png)
[![Build Status](https://travis-ci.org/sheerun/ava-spec.svg?branch=master)](https://travis-ci.org/sheerun/ava-spec)
## Installation
AVA Spec is meant to be installed next to [AVA](https://github.com/sindresorhus/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:
```js
import test from 'ava-spec';test('AVA Spec is 100% compatible with ava', t => {
t.is(true, true);
});
```Jasmine-like DSL is supported:
```js
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:
```js
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:
```js
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:
```js
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.
## Team
[![Adam Stankiewicz](https://avatars3.githubusercontent.com/u/292365?s=130)](https://sheerun.net) | [![Please help me!](http://s28.postimg.org/hcy7aq9nh/42.png)](https://github.com/sheerun/ava-spec/pulls)
---|---
[Adam Stankiewicz](https://sheerun.net) | [Become co-author!](https://github.com/sheerun/ava-spec/pulls)