chore(v2): Implement a simple E2E testing mechanism for `docusausus start` (#2950)

* chore(v2): Implement a simple E2E testing mechanism for `docusausus start`

* Detect compiler errors
This commit is contained in:
Sam Zhou 2020-06-22 05:32:22 -04:00 committed by GitHub
parent fa99aeb6d4
commit 592dca9196
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -26,6 +26,10 @@ jobs:
run: yarn
- name: Setup test-website project against master release
run: yarn test:build:v2
- name: Start test-website project
run: cd test-website && yarn start --no-open
env:
E2E_TEST: true
- name: Build test-website project
run: cd test-website && yarn build
env:

View File

@ -165,6 +165,16 @@ export default async function start(
...config.devServer,
};
const compiler = webpack(config);
if (process.env.E2E_TEST) {
compiler.hooks.done.tap('done', (stats) => {
if (stats.hasErrors()) {
console.log('E2E_TEST: Project has compiler errors.');
process.exit(1);
}
console.log('E2E_TEST: Project can compile.');
process.exit(0);
});
}
const devServer = new WebpackDevServer(compiler, devServerConfig);
devServer.listen(port, host, (err) => {
if (err) {