Skip to content

Commit

Permalink
fix: correct syntax in placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
noomorph committed Feb 23, 2024
1 parent d1b3ff8 commit 8951c57
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/HookPatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class HookPatcher {
this._beforeHooks.has(fn) ? undefined : (this._beforeHooks.add(fn), fn(...args));

wrapper.toString = () =>
this._beforeHooks.has(fn) ? '() => /* patched beforeAll */' : fn.toString();
this._beforeHooks.has(fn) ? '() => { /* patched beforeAll */ }' : fn.toString();

beforeEach(wrapper, timeout);
};
Expand All @@ -28,15 +28,15 @@ export class HookPatcher {
this._testFailed ? (this._afterHooks.add(fn), fn(...args)) : undefined;

wrapperEach.toString = () =>
this._testFailed ? fn.toString() : '() => /* patched afterAll */';
this._testFailed ? fn.toString() : '() => { /* patched afterAll */ }';

const wrapperAll =
fn.length === 1
? (done: Function) => (this._afterHooks.has(fn) ? done() : fn(done))
: (...args: unknown[]) => (this._afterHooks.has(fn) ? undefined : fn(...args));

wrapperAll.toString = () =>
this._afterHooks.has(fn) ? '() => /* patched afterAll */' : fn.toString();
this._afterHooks.has(fn) ? '() => { /* patched afterAll */ }' : fn.toString();

afterEach(wrapperEach, timeout);
afterAll(wrapperAll, timeout);
Expand Down

0 comments on commit 8951c57

Please sign in to comment.