All files / wdio-local-runner/src transformStream.js

100% Statements 11/11
100% Branches 2/2
100% Functions 4/4
100% Lines 10/10

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          4x 4x 4x       4x   9x 3x     1x 1x       1x 1x      
import { Transform } from 'stream'
import { DEBUGGER_MESSAGES } from './constants'
 
export default class RunnerTransformStream extends Transform {
    constructor (cid, emitter) {
        super()
        this.cid = cid
        this.emitter = emitter
    }
 
    _transform(chunk, encoding, callback) {
        const logMsg = chunk.toString()
 
        if (DEBUGGER_MESSAGES.some(m => logMsg.startsWith(m))) {
            return callback()
        }
 
        this.push(`[${this.cid}] ${logMsg}`)
        callback()
    }
 
    _final (callback) {
        this.unpipe()
        callback()
    }
}