Files
Frank Schmid c7d9cd584a Added tests for cleanup and updated test tools (#160)
* Cleanup compile unit tests. Update test framework.

* Updated test tools. Added unit test for cleanup. Refactored unit tests.

* Added lodash to dependencies

* Updated package-lock.json
2017-07-24 19:42:44 +02:00

30 lines
702 B
JavaScript

'use strict';
const sinon = require('sinon');
const StatsMock = sandbox => ({
compilation: {
errors: [],
compiler: {
outputPath: 'statsMock-outputPath',
},
},
toString: sandbox.stub().returns('testStats'),
});
const CompilerMock = (sandbox, statsMock) => ({
run: sandbox.stub().yields(null, statsMock),
watch: sandbox.stub().yields(null, statsMock)
});
const webpackMock = sandbox => {
const statsMock = StatsMock(sandbox);
const compilerMock = CompilerMock(sandbox, statsMock);
const mock = sandbox.stub().returns(compilerMock);
mock.compilerMock = compilerMock;
mock.statsMock = statsMock;
return mock;
}
module.exports = sandbox => webpackMock(sandbox);