spartez test utils
(Beta)
Various test helpers - jest based
prerequisites
- ability to run tests using jest
installation
npm install @spartez-software/jira-test --save-dev
Usage
Logging
For logging inside tests it is better to use TestLogger
from @spartez-software/test-utils
.
It's a wrapper around console.log(...), but with added test context and colors.
Especially useful when running tests in parallel.
Steps
Use steps from @spartez-software/test-utils
to divide your integration and e2e tests into sections
that can/should be retried(in case of network.* issues, external services hiccups etc) to make the test stable.
It uses https://www.npmjs.com/package/p-retry underneth, you can pass retry options by providing optional StepOpts param.
interface StepOpts {
retries?: number,
minTimeout?: number,
maxTimeout?: number
}
look https://github.com/tim-kos/node-retry#retryoperationoptions for default values.
If no StepOpts are given - it defaults to
{ retries: 3 }