INTERNAL DEVELOPER GUIDE
Automated Testing
Introduction
This package exports helper functions for automating tests as well as a template for a github actions layout that will compute coverage and comment this onto a pull requests comments.
Installation
Follow the basic setup instructions for using TKC packages from here, then install the package.
yarn add @thekeyholdingcompany/tkc-automated-testing -D
npm install @thekeyholdingcompany/tkc-automated-testing -D
Example
const { runTests, asyncRunner } = require('@TheKeyholdingCompany/tkc-automated-testing')
runTests({
'Statements': 80,
'Branches': 80,
'Functions': 80,
'Lines': 80
}, [
asyncRunner({
name: 'Step 1', task: async () => {}
}),
asyncRunner({
name: 'Step 2', task: 'yarn test'
}),
asyncRunner({
name: 'Merging Results', task: 'nyc report -t coverage/merged --report-dir coverage/merged-report --reporter=text-summary',
onData: (data) => {
if (data) buildReportFromCLI(data);
}
})
]);