diff --git a/test/helpers/context/AutheliaSuite.ts b/test/helpers/context/AutheliaSuite.ts index f4d92bc8..e883ff02 100644 --- a/test/helpers/context/AutheliaSuite.ts +++ b/test/helpers/context/AutheliaSuite.ts @@ -2,14 +2,15 @@ import WithEnvironment from "./WithEnvironment"; import fs from 'fs'; interface AutheliaSuiteType { - (description: string, configPath: string, cb: (this: Mocha.ISuiteCallbackContext) => void): Mocha.ISuite; - only: (description: string, configPath: string, cb: (this: Mocha.ISuiteCallbackContext) => void) => Mocha.ISuite; + (suitePath: string, cb: (this: Mocha.ISuiteCallbackContext) => void): Mocha.ISuite; + only: (suitePath: string, cb: (this: Mocha.ISuiteCallbackContext) => void) => Mocha.ISuite; } -function AutheliaSuiteBase(description: string, suite: string, +function AutheliaSuiteBase(suitePath: string, cb: (this: Mocha.ISuiteCallbackContext) => void, context: (description: string, ctx: (this: Mocha.ISuiteCallbackContext) => void) => Mocha.ISuite) { - return context('Suite: ' + description, function(this: Mocha.ISuiteCallbackContext) { + const suite = suitePath.split('/').slice(-1)[0]; + return context('Suite: ' + suite, function(this: Mocha.ISuiteCallbackContext) { if (!fs.existsSync('.suite')) { WithEnvironment(suite); } @@ -18,16 +19,15 @@ function AutheliaSuiteBase(description: string, suite: string, }); } -const AutheliaSuite = function( - description: string, configPath: string, +const AutheliaSuite = function(suitePath: string, cb: (this: Mocha.ISuiteCallbackContext) => void) { - return AutheliaSuiteBase(description, configPath, cb, describe); + return AutheliaSuiteBase(suitePath, cb, describe); } -AutheliaSuite.only = function(description: string, configPath: string, +AutheliaSuite.only = function(suitePath: string, cb: (this: Mocha.ISuiteCallbackContext) => void) { - return AutheliaSuiteBase(description, configPath, cb, describe.only); + return AutheliaSuiteBase(suitePath, cb, describe.only); } export default AutheliaSuite as AutheliaSuiteType; \ No newline at end of file diff --git a/test/helpers/context/WithEnvironment.ts b/test/helpers/context/WithEnvironment.ts index 06f72cd4..93787115 100644 --- a/test/helpers/context/WithEnvironment.ts +++ b/test/helpers/context/WithEnvironment.ts @@ -1,7 +1,6 @@ import sleep from '../utils/sleep'; -export default function WithAutheliaRunning(suitePath: string, waitTimeout: number = 5000) { - const suite = suitePath.split('/').slice(-1)[0]; +export default function WithEnvironment(suite: string, waitTimeout: number = 5000) { var { setup, teardown } = require(`../../suites/${suite}/environment`); before(async function() { diff --git a/test/suites/basic/test.ts b/test/suites/basic/test.ts index 0a1e6a36..fa432390 100644 --- a/test/suites/basic/test.ts +++ b/test/suites/basic/test.ts @@ -10,7 +10,7 @@ import LogoutRedirectToAlreadyLoggedIn from './scenarii/LogoutRedirectToAlreadyL import SimpleAuthentication from './scenarii/SimpleAuthentication'; import { exec } from '../../helpers/utils/exec'; -AutheliaSuite('Simple configuration', __dirname, function() { +AutheliaSuite(__dirname, function() { this.timeout(10000); beforeEach(async function() { diff --git a/test/suites/dockerhub/test.ts b/test/suites/dockerhub/test.ts index 5d173c5d..5faed631 100644 --- a/test/suites/dockerhub/test.ts +++ b/test/suites/dockerhub/test.ts @@ -4,7 +4,7 @@ import { composeFiles } from './environment'; import Assert from 'assert'; import SimpleAuthentication from './scenarii/SimpleAuthentication'; -AutheliaSuite('Dockerhub', __dirname, function() { +AutheliaSuite(__dirname, function() { this.timeout(15000); const dockerCompose = new DockerCompose(composeFiles); diff --git a/test/suites/high-availability/test.ts b/test/suites/high-availability/test.ts index 49d4447c..25d5c951 100644 --- a/test/suites/high-availability/test.ts +++ b/test/suites/high-availability/test.ts @@ -8,7 +8,7 @@ import BasicAuthentication from "./scenarii/BasicAuthentication"; import AutheliaRestart from "./scenarii/AutheliaRestart"; import AuthenticationRegulation from "./scenarii/AuthenticationRegulation"; -AutheliaSuite('Complete configuration', __dirname, function() { +AutheliaSuite(__dirname, function() { this.timeout(10000); describe('Custom headers forwarded to backend', CustomHeadersForwarded); diff --git a/test/suites/short-timeouts/test.ts b/test/suites/short-timeouts/test.ts index e47eadc5..a12d72a1 100644 --- a/test/suites/short-timeouts/test.ts +++ b/test/suites/short-timeouts/test.ts @@ -1,7 +1,7 @@ import AutheliaSuite from "../../helpers/context/AutheliaSuite"; import Inactivity from './scenarii/Inactivity'; -AutheliaSuite('Short timeouts', __dirname, function() { +AutheliaSuite(__dirname, function() { this.timeout(10000); describe('Inactivity period', Inactivity); }); \ No newline at end of file