You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
745 B
34 lines
745 B
'use strict';
|
|
|
|
const sinon = require('sinon');
|
|
|
|
const statsMockBase = () => ({
|
|
compilation: {
|
|
errors: [],
|
|
compiler: {
|
|
outputPath: 'statsMock-outputPath',
|
|
},
|
|
},
|
|
toString: () => 'testStats',
|
|
});
|
|
|
|
const statsMock = {};
|
|
|
|
Object.assign(statsMock, statsMockBase());
|
|
|
|
const compilerMock = {
|
|
run: sinon.spy((cb) => cb(null, statsMock)),
|
|
watch: sinon.spy((opt, cb) => cb(null, statsMock)),
|
|
};
|
|
|
|
const webpackMock = sinon.stub().returns(compilerMock);
|
|
webpackMock.statsMock = statsMock;
|
|
webpackMock.compilerMock = compilerMock;
|
|
webpackMock._resetSpies = () => {
|
|
webpackMock.reset();
|
|
compilerMock.run.reset();
|
|
compilerMock.watch.reset();
|
|
Object.assign(statsMock, statsMockBase());
|
|
};
|
|
|
|
module.exports = () => webpackMock;
|
|
|