Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeAll(name: string, callback: core.CallbackOptionallyAsync, settings?: core.LifecycleSettings): void {
before(applyTimings(callback, settings));
},
beforeEach(name: string, callback: core.CallbackOptionallyAsync, settings?: core.LifecycleSettings): void {
beforeEach(applyTimings(callback, settings));
},
afterEach(name: string, callback: core.CallbackOptionallyAsync, settings?: core.LifecycleSettings): void {
afterEach(applyTimings(callback, settings));
},
afterAll(name: string, callback: core.CallbackOptionallyAsync, settings?: core.LifecycleSettings): void {
after(applyTimings(callback, settings));
}
};
class MochaClassTestUI extends core.ClassTestUI {
// TODO: skipOnError, @context
public constructor(runner: core.TestRunner = mochaRunner) {
super(runner);
}
}
const mochaDecorators = new MochaClassTestUI();
export = mochaDecorators;
},
beforeAll(name: string, callback: core.CallbackOptionallyAsync, settings?: core.LifecycleSettings): void {
beforeAll(callback, settings && settings.timeout);
},
beforeEach(name: string, callback: core.CallbackOptionallyAsync, settings?: core.LifecycleSettings): void {
beforeEach(callback, settings && settings.timeout);
},
afterEach(name: string, callback: core.CallbackOptionallyAsync, settings?: core.LifecycleSettings): void {
afterEach(callback, settings && settings.timeout);
},
afterAll(name: string, callback: core.CallbackOptionallyAsync, settings?: core.LifecycleSettings): void {
afterAll(callback, settings && settings.timeout);
}
};
class JestClassTestUI extends core.ClassTestUI {
public constructor(runner: core.TestRunner = jestRunner) {
super(runner);
}
}
const jestDecorators = new JestClassTestUI();
export = jestDecorators;
},
beforeAll(name: string, callback: core.CallbackOptionallyAsync, settings?: core.LifecycleSettings): void {
beforeAll(callback, settings && settings.timeout);
},
beforeEach(name: string, callback: core.CallbackOptionallyAsync, settings?: core.LifecycleSettings): void {
beforeEach(callback, settings && settings.timeout);
},
afterEach(name: string, callback: core.CallbackOptionallyAsync, settings?: core.LifecycleSettings): void {
afterEach(callback, settings && settings.timeout);
},
afterAll(name: string, callback: core.CallbackOptionallyAsync, settings?: core.LifecycleSettings): void {
afterAll(callback, settings && settings.timeout);
}
};
class JestClassTestUI extends core.ClassTestUI {
public constructor(runner: core.TestRunner = jestRunner) {
super(runner);
}
}
const jestDecorators = new JestClassTestUI();
export = jestDecorators;
function applyTimings(fn: any, settings: any): any {
if (settings) {
if (fn.length === 1) {
return core.wrap(function(done) {
if (settings.retries !== undefined) { this.retries(settings.retries); }
if (settings.slow !== undefined) { this.slow(settings.slow); }
if (settings.timeout !== undefined) { this.timeout(settings.timeout); }
return fn.call(this, done);
}, fn);
} else {
return core.wrap(function() {
if (settings.retries !== undefined) { this.retries(settings.retries); }
if (settings.slow !== undefined) { this.slow(settings.slow); }
if (settings.timeout !== undefined) { this.timeout(settings.timeout); }
return fn.call(this);
}, fn);
}
} else {
return fn;
}
}