Provides a reliable test suite setup, based on Mocha test framework
npm i --save-dev mocha@9 chai chai-as-promised @serverless/test
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:
{
"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"
]
}
}
All setup extensions are documented in docs/setup folder
All utils are documented in docs folder
All binaries are documented in docs/bin folder