Skip to content

Commit

Permalink
🐛 Allow the use of lazy variables as soon as the lazylet is executed
Browse files Browse the repository at this point in the history
when we were recommending the use of `beforeEach` we couldn't use the lazy variables inside a `beforeAll` for example, now that's not the case
  • Loading branch information
vhoyer committed Apr 20, 2023
1 parent 329bfe3 commit 606dedf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe('an example of a test', () => {
var2: jest.fn(() => $0.var1 + 'def'),
};

const $0 = lazylet(beforeEach, store);
const $0 = lazylet(afterEach, store);

it('values exist', () => {
expect(store.var1).toHaveBeenCalledTimes(0);
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ export function lazylet<T extends object>(
}
};

// on beforeEach
// on afterEach
onReset(primeStore);
primeStore();

return createStore;
};

0 comments on commit 606dedf

Please sign in to comment.