All files / src/serverless/deploy-multiple status-stream.js

100% Statements 8/8
100% Branches 2/2
100% Functions 2/2
100% Lines 8/8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19    2x 2x   2x 12x   2x   2x 1x         12x    
'use strict';
 
const chalk = require('chalk');
const { Writable } = require('stream');
 
module.exports = (path, color, task) => {
    const stream = new Writable({
        write: chunk => {
            const log = chunk.toString();
 
            if (log.indexOf('Serverless') > -1) {
                task.output = `${chalk[color](`[${path}]`)} ${log}`;
            }
        }
    });
 
    return stream;
};