2019-01-30 22:47:03 +07:00
|
|
|
interface AutheliaSuiteType {
|
2019-03-03 05:31:22 +07:00
|
|
|
(suitePath: string, cb: (this: Mocha.ISuiteCallbackContext) => void): Mocha.ISuite;
|
|
|
|
only: (suitePath: string, cb: (this: Mocha.ISuiteCallbackContext) => void) => Mocha.ISuite;
|
2019-01-30 22:47:03 +07:00
|
|
|
}
|
|
|
|
|
2019-03-03 05:31:22 +07:00
|
|
|
function AutheliaSuiteBase(suitePath: string,
|
2019-01-31 04:44:03 +07:00
|
|
|
cb: (this: Mocha.ISuiteCallbackContext) => void,
|
|
|
|
context: (description: string, ctx: (this: Mocha.ISuiteCallbackContext) => void) => Mocha.ISuite) {
|
2019-03-03 05:31:22 +07:00
|
|
|
const suite = suitePath.split('/').slice(-1)[0];
|
|
|
|
return context('Suite: ' + suite, function(this: Mocha.ISuiteCallbackContext) {
|
2019-01-30 22:47:03 +07:00
|
|
|
cb.call(this);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-03-03 05:31:22 +07:00
|
|
|
const AutheliaSuite = <AutheliaSuiteType>function(suitePath: string,
|
2019-01-31 04:44:03 +07:00
|
|
|
cb: (this: Mocha.ISuiteCallbackContext) => void) {
|
2019-03-03 05:31:22 +07:00
|
|
|
return AutheliaSuiteBase(suitePath, cb, describe);
|
2019-01-30 22:47:03 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-03-03 05:31:22 +07:00
|
|
|
AutheliaSuite.only = function(suitePath: string,
|
2019-01-31 04:44:03 +07:00
|
|
|
cb: (this: Mocha.ISuiteCallbackContext) => void) {
|
2019-03-03 05:31:22 +07:00
|
|
|
return AutheliaSuiteBase(suitePath, cb, describe.only);
|
2019-01-30 22:47:03 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
export default AutheliaSuite as AutheliaSuiteType;
|