mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-09 23:27:28 +02:00
test: validate generated webpack config instead of compiling
This commit is contained in:
parent
1564edae4c
commit
3eb9823105
5 changed files with 121 additions and 69 deletions
|
@ -1,29 +1,21 @@
|
|||
import createDevConfig from '@lib/webpack/dev';
|
||||
import compile from './compile';
|
||||
import createBaseConfig from '@lib/webpack/base';
|
||||
import {validate} from 'webpack';
|
||||
import loadSetup from '../loadSetup';
|
||||
|
||||
describe('webpack dev config', () => {
|
||||
const timeOut = 20000; // 20 seconds
|
||||
describe('webpack base config', () => {
|
||||
test('simple', async () => {
|
||||
console.log = jest.fn();
|
||||
const props = await loadSetup('simple');
|
||||
const config = createBaseConfig(props).toConfig();
|
||||
const errors = validate(config);
|
||||
expect(errors.length).toBe(0);
|
||||
});
|
||||
|
||||
test(
|
||||
'simple',
|
||||
async () => {
|
||||
console.log = jest.fn();
|
||||
const props = await loadSetup('simple');
|
||||
const config = createDevConfig(props).toConfig();
|
||||
return expect(compile(config)).resolves.toBe('Compiled successfully');
|
||||
},
|
||||
timeOut
|
||||
);
|
||||
|
||||
test(
|
||||
'custom',
|
||||
async () => {
|
||||
console.log = jest.fn();
|
||||
const props = await loadSetup('custom');
|
||||
const config = createDevConfig(props).toConfig();
|
||||
return expect(compile(config)).resolves.toBe('Compiled successfully');
|
||||
},
|
||||
timeOut
|
||||
);
|
||||
test('custom', async () => {
|
||||
console.log = jest.fn();
|
||||
const props = await loadSetup('custom');
|
||||
const config = createBaseConfig(props).toConfig();
|
||||
const errors = validate(config);
|
||||
expect(errors.length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue