test: validate generated webpack config instead of compiling

This commit is contained in:
endiliey 2018-08-12 23:17:39 +08:00
parent 1564edae4c
commit 3eb9823105
5 changed files with 121 additions and 69 deletions

21
test/webpack/dev.test.js Normal file
View file

@ -0,0 +1,21 @@
import createDevConfig from '@lib/webpack/dev';
import {validate} from 'webpack';
import loadSetup from '../loadSetup';
describe('webpack dev config', () => {
test('simple', async () => {
console.log = jest.fn();
const props = await loadSetup('simple');
const config = createDevConfig(props).toConfig();
const errors = validate(config);
expect(errors.length).toBe(0);
});
test('custom', async () => {
console.log = jest.fn();
const props = await loadSetup('custom');
const config = createDevConfig(props).toConfig();
const errors = validate(config);
expect(errors.length).toBe(0);
});
});