-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add per-task untimed lifecycle hooks #33
feat: add per-task untimed lifecycle hooks #33
Conversation
Adds four lifecycle hooks that can be configured to run on a per-task basis without impacting the test timings: - `before`: run once before iterations of the task start - `beforeEach`: run before each iteration of the task - `afterEach`: run after each iteration of the task - `after`: run after all iterations finish A contrived example: ```js suite.add('my task', async () => { // the timed function }, { before: () => { // start a server }, beforeEach: () => { // set up some data that the timed function will mutate }, afterEach: () => { // tear down any mutated data }, after: () => { // stop the server } }) ``` This is useful if, for example, you are testing several implementations of the same functionality and need to perform different operations on each implementation to bring them into the same state that the timing data from the task function is useful data.
@@ -38,7 +38,7 @@ | |||
"eslint-config-airbnb-base": "^15.0.0", | |||
"eslint-plugin-import": "^2.26.0", | |||
"nano-staged": "^0.5.0", | |||
"size-limit": "^8.0.1", | |||
"size-limit": "^7.0.8", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this change, npm i
fails with:
% npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/size-limit
npm ERR! dev size-limit@"^8.2.4" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer size-limit@"7.0.8" from @size-limit/[email protected]
npm ERR! node_modules/@size-limit/preset-small-lib
npm ERR! dev @size-limit/preset-small-lib@"^7.0.4" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! /Users/alex/.npm/_logs/2023-02-21T11_08_37_616Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/alex/.npm/_logs/2023-02-21T11_08_37_616Z-debug-0.log
If you update size-limit
, @size-limit/preset-small-li
and @size-limit/time
all to the latest versions, conflicting versions of esbuild
are pulled in which tsup
tries to pass the watch
flag to - this was recently removed and errors out, so the simplest thing to do here seems to be to downgrade size-limit
.
I've changed the names |
@Aslemammad are there any changes you'd like to be made or is there anything else I can do here? |
It's good for now, soon on the weekend i'll review it and let you know
…On Mon, 27 Feb 2023, 21:18 Alex Potsides, ***@***.***> wrote:
@Aslemammad <https://github.com/Aslemammad> are there any changes you'd
like to be made or is there anything else I can do here?
—
Reply to this email directly, view it on GitHub
<#33 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJBMICBP5Z3U3ITRBPXV4UTWZTSG5ANCNFSM6AAAAAAVC44QSI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
tinylibs/tinybench#33 has been merged so update the minimum used version
Thank you so much, I forgot to write this one :) |
tinylibs/tinybench#33 has been merged so update the minimum used version
Adds four lifecycle hooks that can be configured to run on a per-task basis without impacting the test timings:
beforeAll
: run once before iterations of the task startbeforeEach
: run before each iteration of the taskafterEach
: run after each iteration of the taskafterAll
: run after all iterations finishA contrived example:
This is useful if, for example, you are testing several implementations of the same functionality and need to perform different operations on each implementation to bring them into the same state so that the timing data from the task function is useful data.
Fixes #32