mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-16 02:27:21 +02:00
chore: eslint & prettier nits
This commit is contained in:
parent
a4cc782858
commit
15ce4a95e2
4 changed files with 68 additions and 69 deletions
|
@ -1 +1,3 @@
|
|||
generated
|
||||
generated
|
||||
__fixtures__
|
||||
dist
|
|
@ -68,7 +68,6 @@
|
|||
"semver": "^5.5.0",
|
||||
"static-site-generator-webpack-plugin": "^3.4.1",
|
||||
"webpack": "^4.16.3",
|
||||
"webpack-bundle-analyzer": "^2.13.1",
|
||||
"webpack-chain": "^4.8.0",
|
||||
"webpack-nicelog": "^2.2.1",
|
||||
"webpack-serve": "^2.0.2"
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
import path from 'path';
|
||||
import load from '@lib/load';
|
||||
|
||||
// Helper methods to setup dummy/ fake projects
|
||||
const loadSetup = async name => {
|
||||
const simpleWebsite = path.join(__dirname, '__fixtures__', 'simple-website');
|
||||
const customWebsite = path.join(__dirname, '__fixtures__', 'custom-website');
|
||||
|
||||
switch (name) {
|
||||
case 'simple':
|
||||
return await load(simpleWebsite);
|
||||
case 'custom':
|
||||
return await load(customWebsite);
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
export default loadSetup;
|
||||
import path from 'path';
|
||||
import load from '@lib/load';
|
||||
|
||||
// Helper methods to setup dummy/ fake projects
|
||||
const loadSetup = async name => {
|
||||
const simpleWebsite = path.join(__dirname, '__fixtures__', 'simple-website');
|
||||
const customWebsite = path.join(__dirname, '__fixtures__', 'custom-website');
|
||||
|
||||
switch (name) {
|
||||
case 'simple':
|
||||
return load(simpleWebsite);
|
||||
case 'custom':
|
||||
return load(customWebsite);
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
export default loadSetup;
|
||||
|
|
|
@ -1,48 +1,46 @@
|
|||
import webpack from 'webpack';
|
||||
import path from 'path';
|
||||
import createBaseConfig from '@lib/webpack/base';
|
||||
import createDevConfig from '@lib/webpack/dev';
|
||||
import createProdConfig from '@lib/webpack/prod';
|
||||
import loadSetup from '../loadSetup';
|
||||
|
||||
// webpack compiler helper function
|
||||
function compile(config) {
|
||||
return new Promise((resolve, reject) => {
|
||||
webpack(config, (err, stats) => {
|
||||
if (err || stats.hasErrors()) {
|
||||
reject(new Error(`Failed to compile with errors`));
|
||||
}
|
||||
resolve('Compiled successfully');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
describe('webpack', () => {
|
||||
test('dev simple', async () => {
|
||||
console.log = jest.fn();
|
||||
const props = await loadSetup('simple');
|
||||
const config = createDevConfig(props).toConfig();
|
||||
return expect(compile(config)).resolves.toBe('Compiled successfully');
|
||||
});
|
||||
|
||||
test('dev custom', async () => {
|
||||
console.log = jest.fn();
|
||||
const props = await loadSetup('custom');
|
||||
const config = createDevConfig(props).toConfig();
|
||||
return expect(compile(config)).resolves.toBe('Compiled successfully');
|
||||
});
|
||||
|
||||
test('prod simple', async () => {
|
||||
console.log = jest.fn();
|
||||
const props = await loadSetup('simple');
|
||||
const config = createProdConfig(props).toConfig();
|
||||
return expect(compile(config)).resolves.toBe('Compiled successfully');
|
||||
});
|
||||
|
||||
test('prod custom', async () => {
|
||||
console.log = jest.fn();
|
||||
const props = await loadSetup('custom');
|
||||
const config = createProdConfig(props).toConfig();
|
||||
return expect(compile(config)).resolves.toBe('Compiled successfully');
|
||||
});
|
||||
});
|
||||
import webpack from 'webpack';
|
||||
import createDevConfig from '@lib/webpack/dev';
|
||||
import createProdConfig from '@lib/webpack/prod';
|
||||
import loadSetup from '../loadSetup';
|
||||
|
||||
// webpack compiler helper function
|
||||
function compile(config) {
|
||||
return new Promise((resolve, reject) => {
|
||||
webpack(config, (err, stats) => {
|
||||
if (err || stats.hasErrors()) {
|
||||
reject(new Error(`Failed to compile with errors`));
|
||||
}
|
||||
resolve('Compiled successfully');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
describe('webpack', () => {
|
||||
test('dev simple', async () => {
|
||||
console.log = jest.fn();
|
||||
const props = await loadSetup('simple');
|
||||
const config = createDevConfig(props).toConfig();
|
||||
return expect(compile(config)).resolves.toBe('Compiled successfully');
|
||||
});
|
||||
|
||||
test('dev custom', async () => {
|
||||
console.log = jest.fn();
|
||||
const props = await loadSetup('custom');
|
||||
const config = createDevConfig(props).toConfig();
|
||||
return expect(compile(config)).resolves.toBe('Compiled successfully');
|
||||
});
|
||||
|
||||
test('prod simple', async () => {
|
||||
console.log = jest.fn();
|
||||
const props = await loadSetup('simple');
|
||||
const config = createProdConfig(props).toConfig();
|
||||
return expect(compile(config)).resolves.toBe('Compiled successfully');
|
||||
});
|
||||
|
||||
test('prod custom', async () => {
|
||||
console.log = jest.fn();
|
||||
const props = await loadSetup('custom');
|
||||
const config = createProdConfig(props).toConfig();
|
||||
return expect(compile(config)).resolves.toBe('Compiled successfully');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue