All files / webpack-hot-socketio index.js

81.25% Statements 13/16
57.14% Branches 8/14
100% Functions 2/2
81.25% Lines 13/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 241x 1x 1x   1x 7x 7x 7x 7x   7x 7x   7x 3x           3x      
const HookHandler = require('./hook-handler');
const SocketHandler = require('./socket-handler');
const setFs = require('./lib/fs');
 
module.exports = function webpackHotSocket(compiler, io, opts, builtCallback) {
	opts = opts || {};
	opts.eventName = opts.eventName || '__webpack_hot_socketio__';
	opts.log = opts.log || console.log;
	this.log = opts.log;
 
	const socketHandler = new SocketHandler(io, opts);
	const hookHandler = new HookHandler(compiler, socketHandler, opts);
	// setFs(compiler);
	compiler.watch(opts.watchOpts || {}, (err) => {
		Iif (err) {
			this.log(err.stack || err);
			if (err.details) {
				this.log(err.details);
			}
		}
		builtCallback(err);
	});
}