nodejs / nodejs/node

More benchmarks for the `node:test` module.

Open
#55,723 16 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

benchmark test_runner
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

The benchmark/test_runner folder currently contains benchmarks for it and describe 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
    • Create a test (#56479)
    • Create a test when it's not running due to only
    • Add a subtest
    • Skip a test
      • Via skip: true
      • Via t.skip()
      • Via t.skip(...)
    • TODO tests
      • Via todo: true
      • Via t.todo()
      • Via 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-function
  • mock.module

Snapshots

  • snapshot.setDefaultSnapshotSerializers(serializers)
  • snapshot.setResolveSnapshotPath(fn)
  • t.assert.snapshot

Coverage

Use --expose-internals to exclusively test the coverage part

  • Basic
  • Excluding files
  • Including files
  • With source maps

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in benchmark/test_runner and review the existing benchmarks for it, describe, and the completed test-runner features. Add benchmarks for the unchecked mock.timers, mock.module, snapshot, and coverage cases, using a custom reporter and --expose-internals for coverage. Done means the remaining checklist items are covered without special benchmark logic.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
devtools, testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.