An open API service indexing awesome lists of open source software.

https://github.com/sodiray/inforce

A simple function based test runner
https://github.com/sodiray/inforce

cli javascript nodejs test-runner testing

Last synced: 6 months ago
JSON representation

A simple function based test runner

Awesome Lists containing this project

README

          

# :cop: Inforce
A simple function based test runner. Its not BDD. Does not include an assertion library - only a test collector and test runner.

## :package: Install
`npm install --dev inforce`
or
`yarn add --dev inforce`

## :wrench: Usage
Add as an npm script in `package.json`.
```
"scripts": {
"test": "inforce",
"test-example": "inforce --targetPath ./example.test.js",
"test-verbose": inforce --level verbose
}
```

### :abacus: Options
Check out the main function's params/defaults [here](https://github.com/rayepps/inforce/blob/6d400c01f1cddcf122b069ba6e0b29c1fa337af5/index.js#L10).

#### --targetPath
The relative path to search for tests. Can be directory or file. Deafults to `./src`.

#### --testFileRegex
The pattern to use when filtering test files. Defaults to `.*\.test\.js`.

#### -- testFnRegex
The pattern to use when filtering exported functions from test modules. Defaults to `^test.*`. If you want to execute all functions exported from a test module -- so you don't have to name test functions with `test` -- set this to something like `.+`.

#### --level
The log level to use.
- slient: log nothing
- default: log enough for normal dev use (default)
- verbose: log lots. helpful for debugging test collection/running not working as you expect
- debug: log everything. helpful for debugging issues with the inforce project

## Example Output
Test output example

## Example Test File
See [example.test.js](https://github.com/rayepps/inforce/blob/master/example.test.js)