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