0.0.52 • Published 3 years ago

@tkc-fe/tkc-automated-testing v0.0.52

Weekly downloads
-
License
-
Repository
github
Last release
3 years ago

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


// test-script.js
const { runTests, asyncRunner } = require('@TheKeyholdingCompany/tkc-automated-testing')

runTests({
    'Statements': 80,
    'Branches': 80,
    'Functions': 80,
    'Lines': 80
}, [
    // This is a promise based step.
    asyncRunner({
        name: 'Step 1', task: async () => {}
    }),
    // This is a command based step.
    asyncRunner({
        name: 'Step 2', task: 'yarn test'
    }),
    asyncRunner({
        // Final step needs to have a text-summary output from either a package like nyc, or jest - this is how to builds the report and knows the coverage.
        name: 'Merging Results', task: 'nyc report -t coverage/merged --report-dir coverage/merged-report --reporter=text-summary',
        onData: (data) => {
            if (data) buildReportFromCLI(data);

        }
    })
]);
0.0.52

3 years ago

0.0.51

3 years ago