Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/guillaumearm/async-describe
:rainbow: - A simple way for making async tests procedures
https://github.com/guillaumearm/async-describe
async async-await async-describe describe test
Last synced: 1 day ago
JSON representation
:rainbow: - A simple way for making async tests procedures
- Host: GitHub
- URL: https://github.com/guillaumearm/async-describe
- Owner: guillaumearm
- License: mit
- Created: 2017-12-17T13:42:09.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-21T19:28:41.000Z (over 6 years ago)
- Last Synced: 2024-10-03T20:18:35.835Z (about 1 month ago)
- Topics: async, async-await, async-describe, describe, test
- Language: JavaScript
- Homepage:
- Size: 79.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
async-describe
==============A simple way for making async tests procedures
#### Installation
```
npm install --save-dev async-describe
```#### API
`async-describe` is designed for running async end to end tests
##### describe(text, async fn)
- describes block can be nested.##### test(text, async fn)
- cannot be nested in another test block.
- should be used inside a describe block.#### Example
```js
const { describe, test } = require('async-describe');const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
describe('tests', async () => {
await describe('build client', async () => {
await test('test');
});
await describe('start server', async () => {
await test('test 1', async () => {
})
await test('test 2', async () => {
console.warn('console.warn');
})
await test('test 3', sleep(1)) // test() can take a promise instead of an async function
await sleep(100);
});
await describe('additional test I')
await describe('additional test II', async () => {
await test('test3', async () => {
console.log('console.log');
})
})
await describe('run functional tests', async () => {
await sleep(100);
await test('test4', async () => {
throw new Error('1')
})
await test('test4', async () => {
throw new Error('2')
})
});
await describe('more test', async () => {
throw new Error('Fatal')
})
await describe('more test')
await describe('more test')
});
```