diff --git a/test/load/__snapshots__/routes.test.js.snap b/test/load/__snapshots__/routes.test.js.snap
index 075ce45f36..d9e6869438 100644
--- a/test/load/__snapshots__/routes.test.js.snap
+++ b/test/load/__snapshots__/routes.test.js.snap
@@ -21,8 +21,37 @@ exports[`genRoutesConfig website with only docs 1`] = `
import Docs from '@theme/Docs';
import NotFound from '@theme/NotFound';
-
-const routes = [,,
+import MDHello from '@docs/hello.md';
+import MDFooBar from '@docs/foo/bar.md';
+import MDFooBaz from '@docs/foo/baz.md';
+const routes = [
+ {
+ path: \\"/hello\\",
+ exact: true,
+ component: (props) => (
+
+
+
+ )
+ },
+ {
+ path: \\"/foo/bar\\",
+ exact: true,
+ component: (props) => (
+
+
+
+ )
+ },
+ {
+ path: \\"/foo/baz\\",
+ exact: true,
+ component: (props) => (
+
+
+
+ )
+ },,
{
path: '*',
component: NotFound
@@ -77,10 +106,39 @@ import Docs from '@theme/Docs';
import NotFound from '@theme/NotFound';
import JSFoo from '@pages/foo.js';
import JSIndex from '@pages/index.js';
-import JSFooIndex from '@pages/foo/index.js';
import JSBarBaz from '@pages/bar/baz.js';
-
-const routes = [,
+import JSFooIndex from '@pages/foo/index.js';
+import MDHello from '@docs/hello.md';
+import MDFooBaz from '@docs/foo/baz.md';
+import MDFooBar from '@docs/foo/bar.md';
+const routes = [
+ {
+ path: \\"/hello\\",
+ exact: true,
+ component: (props) => (
+
+
+
+ )
+ },
+ {
+ path: \\"/foo/baz\\",
+ exact: true,
+ component: (props) => (
+
+
+
+ )
+ },
+ {
+ path: \\"/foo/bar\\",
+ exact: true,
+ component: (props) => (
+
+
+
+ )
+ },
{
path: \\"/foo\\",
exact: true,
@@ -91,16 +149,16 @@ const routes = [,
exact: true,
component: JSIndex
},
- {
- path: \\"/foo/\\",
- exact: true,
- component: JSFooIndex
- },
{
path: \\"/bar/baz\\",
exact: true,
component: JSBarBaz
},
+ {
+ path: \\"/foo/\\",
+ exact: true,
+ component: JSFooIndex
+ },
{
path: '*',
component: NotFound
diff --git a/test/webpack/base.test.js b/test/webpack/base.test.js
index d783c25bb6..1e17156703 100644
--- a/test/webpack/base.test.js
+++ b/test/webpack/base.test.js
@@ -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);
+ });
});
diff --git a/test/webpack/compile.js b/test/webpack/compile.js
deleted file mode 100644
index 8d2f2b9516..0000000000
--- a/test/webpack/compile.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import webpack from 'webpack';
-
-export default 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');
- });
- });
-}
diff --git a/test/webpack/dev.test.js b/test/webpack/dev.test.js
new file mode 100644
index 0000000000..23397124de
--- /dev/null
+++ b/test/webpack/dev.test.js
@@ -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);
+ });
+});
diff --git a/test/webpack/prod.test.js b/test/webpack/prod.test.js
index 04914b9953..019d1a0404 100644
--- a/test/webpack/prod.test.js
+++ b/test/webpack/prod.test.js
@@ -1,28 +1,21 @@
import createProdConfig from '@lib/webpack/prod';
-import compile from './compile';
+import {validate} from 'webpack';
import loadSetup from '../loadSetup';
describe('webpack production config', () => {
- const timeOut = 20000; // 20 seconds
- test(
- 'simple',
- async () => {
- console.log = jest.fn();
- const props = await loadSetup('simple');
- const config = createProdConfig(props).toConfig();
- return expect(compile(config)).resolves.toBe('Compiled successfully');
- },
- timeOut
- );
+ test('simple', async () => {
+ console.log = jest.fn();
+ const props = await loadSetup('simple');
+ const config = createProdConfig(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 = createProdConfig(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 = createProdConfig(props).toConfig();
+ const errors = validate(config);
+ expect(errors.length).toBe(0);
+ });
});