nodejs / nodejs/node

More benchmarks for the `node:test` module.

未关闭
#55,723 16 条评论 5 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

benchmark test_runner
主要语言
JavaScript
星标
122k
派生
37.4k
平均合并
4 天 3 小时
30 天内合并 PR
272

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 benchmark/test_runner 开始,检查 it、describe 以及已完成的 test-runner 功能对应的现有基准测试。为尚未勾选的 mock.timers、mock.module、snapshot 和 coverage 用例添加基准测试,并为 coverage 使用自定义 reporter 和 --expose-internals。剩余的检查清单项目都在不使用特殊基准测试逻辑的情况下得到覆盖,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, node.js
领域
devtools, testing-qa
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
52/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。