All files / wdio-reporter/src/stats test.js

100% Statements 16/16
100% Branches 4/4
100% Functions 4/4
100% Lines 16/16

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43                24x 24x 24x 24x 24x 24x 24x           24x       7x 7x       7x       10x 10x 10x   10x 3x        
import RunnableStats from './runnable'
 
/**
 * TestStats class
 * captures data on a test.
 */
export default class TestStats extends RunnableStats {
    constructor (test) {
        super('test')
        this.uid = RunnableStats.getIdentifier(test)
        this.cid = test.cid
        this.title = test.title
        this.fullTitle = test.fullTitle
        this.output = []
        this.argument = test.argument
 
        /**
         * initial test state is pending
         * the state can change to the following: passed, skipped, failed
         */
        this.state = 'pending'
    }
 
    pass () {
        this.complete()
        this.state = 'passed'
    }
 
    skip () {
        this.state = 'skipped'
    }
 
    fail (errors) {
        this.complete()
        this.state = 'failed'
        this.errors = errors
 
        if (errors && errors.length) {
            this.error = errors[0]
        }
    }
}