https://github.com/serverless/test
Test setup and utilities for serverless projects
https://github.com/serverless/test
Last synced: 5 months ago
JSON representation
Test setup and utilities for serverless projects
- Host: GitHub
- URL: https://github.com/serverless/test
- Owner: serverless
- License: mit
- Created: 2019-09-11T11:55:20.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-10-03T07:58:32.000Z (about 1 year ago)
- Last Synced: 2024-11-08T22:40:33.316Z (about 1 year ago)
- Language: JavaScript
- Size: 375 KB
- Stars: 4
- Watchers: 21
- Forks: 10
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @serverless/test
## Internal test utils that aid Serverless organization libraries
Provides a reliable test suite setup, based on [Mocha](https://mochajs.org/) test framework
### Installation
```bash
npm i --save-dev mocha@9 chai chai-as-promised @serverless/test
```
### Mocha Setup
Preconfigure Mocha to rely on a custom reporter, included with this package, which applies workarounds for known Mocha issues, and exposes endpoint through which other utils may observe Mocha runner flow.
In `package.json` add `mocha` section with `reporter` option set, and recommended extensions as follows:
```json
{
"mocha": {
"require": [
"@serverless/test/setup/patch",
"@serverless/test/setup/log",
"@serverless/test/setup/mock-homedir",
"@serverless/test/setup/mock-cwd",
"@serverless/test/setup/restore-env"
]
}
}
```
### Setup extensions
All setup extensions are documented in [docs/setup](docs/setup) folder
### Utils
All utils are documented in [docs](docs) folder
### Binaries
All binaries are documented in [docs/bin](docs/bin) folder