refactor(e2e-test): wrap the test registration

This commit is contained in:
Ken Sodemann
2017-10-28 06:05:00 -05:00
parent c66a29726e
commit 9be3085f91
5 changed files with 69 additions and 43 deletions

View File

@ -1,9 +1,9 @@
'use strict';
const glob = require('glob');
const Mocha = require('mocha');
const path = require('path');
const mocha = new Mocha();
function startDevServer() {
const server = require('@stencil/dev-server/dist'); // TODO: fix after stencil-dev-server PR #16 is merged
const cmdArgs = ['--config', path.join(__dirname, '../stencil.config.js'), '--no-open'];
@ -25,11 +25,16 @@ function getTestFiles() {
}
(async () => {
const mocha = new Mocha({
timeout: 5000,
slow: 2000
});
const devServer = await startDevServer();
// process.env.takeScreenshots = true;
const files = await getTestFiles();
files.forEach(f => mocha.addFile(f));
mocha.run(function(failures) {
process.on('exit', function() {
process.exit(failures); // exit with non-zero status if there were failures