Open RedYetiDev opened 3 days ago
@RedYetiDev I'd love to work on this! Is there a guide or info page on how to create benchmarks? The issue also feels a bit vague — could we get an explicit list of functions to test?
IMHO we should start off simple.
How long does it take for a basic test to execute? What about a skipped test? A failing test? Etc.
For this to be as accurate as possible, we would probably need the benchmark to contain a custom reporter.
We could probably replace the current (limited) benchmark with this better idea I described above
From there, we could move on how long it takes specific parts, such as mocks, etc.
I was planning to start something related to coverage to enhance performance, and to do so, benchmarking is definitely needed. It would be great to use this issue to discuss and select a way forward(possibly with a division of the features to cover).
Do you have any ideas on how you would structure this? I think it's non-trivial to benchmark the test runner and coverage with precision, and I'm not sure if we already have anything similar in place.
My idea for coverage is to use the --expose-internals
flag. We can calculate different forms of coverage, and just test the coverage function.
(I'll update the PR with an explicit list of functions/components later today–it's not a quick process)
I've added the list. If you think something else should be added, feel free to edit the issue
The
benchmark/test_runner
folder currently contains benchmarks forit
anddescribe
functions. I suggest we expand these benchmarks to cover additional test runner features, including mocks, coverage, and various test modes.Here are the functions that (IMO) should be benchmarked:
Basic Testing
These tests should run with a custom reporter without any special logic to make the tests as accurate as possible.
test
test
test
when it's not running due toonly
skip: true
t.skip()
t.skip(...)
todo: true
t.todo()
t.todo(...)
Hooks
beforeEach
afterEach
before
after
Reporters (#55757)
dot
junit
spec
tap
lcov
Mocking
mock.fn
(#55771)mock.timers
for each API, and each sub-functionmock.module
Snapshots
snapshot.setDefaultSnapshotSerializers(serializers)
snapshot.setResolveSnapshotPath(fn)
t.assert.snapshot
Coverage
Use
--expose-internals
to exclusively test the coverage part