Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eldoy/spekky
Nano size test runner
https://github.com/eldoy/spekky
Last synced: 6 days ago
JSON representation
Nano size test runner
- Host: GitHub
- URL: https://github.com/eldoy/spekky
- Owner: eldoy
- Created: 2022-04-17T23:41:54.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-06-22T12:03:09.000Z (over 2 years ago)
- Last Synced: 2024-10-06T23:35:45.981Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Spekky
Nano size test runner. Zero dependencies.
The tests use `assert` and stops when a test fails. There is no output if all tests pass.
### Install
```
npm i spekky
```### Usage
Create a directory called `spec` in your project's root folder.
Add your tests in `spec/tests`, for example call it `spec/tests/http.test.js`. Then add this in `spec/index.js`:
```js
const test = require('spekky')async function run() {
// ... start a server or do some setup// Start timer
console.time('Test run')// Test the file 'spec/tests/http.test.js
await test('http')// End timer
console.timeEnd('Test run')
}
run()
```The test in `spec/tests/http.test.js` looks like this:
```js
const assert = require('assert')
const request = require('spett')const it = {}
it['should do some stuff'] = async function() {
const { data, code } = await request({ path: '/hello'})
assert.deepEqual(code, 200)
assert.deepEqual(data.hello, 'world')
}module.exports = it
```ISC Licensed. Enjoy!