You've already forked serverless-webpack
mirror of
https://github.com/encounter/serverless-webpack.git
synced 2026-03-30 11:37:58 -07:00
c7d9cd584a
* 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
30 lines
702 B
JavaScript
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);
|