mailtrain/test/e2e/index.js

31 lines
807 B
JavaScript

'use strict';
require('./helpers/exit-unless-test');
const { mocha, driver } = require('./helpers/mocha-e2e');
const path = require('path');
global.USE_SHARED_DRIVER = true;
const only = 'only';
const skip = 'skip';
let tests = [
'login',
'subscription',
['subscription-uc', only]
];
tests = tests.map(testSpec => (testSpec.constructor === Array ? testSpec : [testSpec]));
tests = tests.filter(testSpec => testSpec[1] !== skip);
if (tests.some(testSpec => testSpec[1] === only)) {
tests = tests.filter(testSpec => testSpec[1] === only);
}
for (const testSpec of tests) {
const testPath = path.join(__dirname, 'tests', testSpec[0] + '.js');
mocha.addFile(testPath);
}
mocha.run(failures => {
process.exit(failures); // exit with non-zero status if there were failures
});