2019-03-02 15:19:08 +00:00
|
|
|
import sleep from '../utils/sleep';
|
|
|
|
|
|
|
|
export default function WithAutheliaRunning(suitePath: string, waitTimeout: number = 5000) {
|
|
|
|
const suite = suitePath.split('/').slice(-1)[0];
|
|
|
|
var { setup, teardown } = require(`../../suites/${suite}/environment`);
|
|
|
|
|
|
|
|
before(async function() {
|
2019-03-02 16:33:30 +00:00
|
|
|
this.timeout(30000);
|
2019-03-02 15:19:08 +00:00
|
|
|
|
|
|
|
console.log('Preparing environment...');
|
|
|
|
await setup();
|
|
|
|
await sleep(waitTimeout);
|
|
|
|
});
|
|
|
|
|
|
|
|
after(async function() {
|
2019-03-02 16:15:28 +00:00
|
|
|
this.timeout(30000);
|
2019-03-02 15:19:08 +00:00
|
|
|
|
|
|
|
console.log('Stopping environment...');
|
|
|
|
await teardown();
|
|
|
|
|
|
|
|
await sleep(waitTimeout);
|
|
|
|
});
|
|
|
|
}
|