[RFC]: Migrate from tape to in-house @stdlib/test/harness
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 20/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript, node.js
调研方向
首先阅读提议的 @stdlib/test/harness,并结合现有的 @stdlib/bench/harness 模式,然后检查 lib 测试文件、package.json、stdlib Makefile 和 tools/harness.js。将当前基于 tape 的测试执行和 TAP 输出与提议的 harness 进行比较;当所有受影响的测试都已就迁移范围、支持的断言和 CI 验证达成一致并正常工作时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Description
This RFC proposes
Proposal: Migrate stdlib Tests to In-House @stdlib/test/harness
This proposal delivers a tape-equivalent in-house test runner as @stdlib/test/harness, directly porting its minimal TAP API while matching @stdlib/bench/harness patterns. It eliminates the tape dep, supports only stdlib's used assertions (equal, strictEqual, ok, deepEqual, pass, fail, plan, end, test), and adds @stdlib/string/format interpolation—no parallelism, grouping, or extras like mocha/jest.
Before/After Test File
Before (tape):
'use strict';
var tape = require( 'tape' );
var foo = require( './../lib' );
tape( 'main export is a function', function test( t ) {
t.ok( true, 'should be true' );
t.strictEqual( typeof foo, 'function', 'main export is a function' );
t.end();
});
tape( 'computes correctly', function test( t ) {
t.plan( 2 );
t.equal( foo( 3 ), 9, 'returns 9' );
t.deepEqual( foo( ),, 'deep equal' );[1][2][3]
t.end();
After (@stdlib/test/harness):
After (@stdlib/test/harness):
```javascript
'use strict';
var test = require( '@stdlib/test/harness' );
var foo = require( './../lib' );
test( 'main export is a function', function test( t ) {
t.ok( true, 'should be true' );
t.strictEqual( typeof foo, 'function', 'main export is %s', 'function' );
t.end();
});
test( 'computes correctly', function test( t ) {
t.plan( 2 );
t.equal( foo( 3 ), 9, 'returns %d', 9 );
t.deepEqual( foo( ),, 'deep equal' );[1][2][3]
t.end();
});
Changes: Swap require('tape') → require('@stdlib/test/harness'). Assertions identical—no renames/refactors. Interpolation optional (%s/%d/%j via @stdlib/string/format).
Study of References
Reviewed tape source (tape-testing/tape): TAP stream via events, nested tests, async end(), assertion tracking. Compared to @stdlib/bench/harness: Similar b.bench()/test(), exports harness/stream factory, stdout TAP—no deps. Stdlib tests (e.g., Makefile/package.json scans): Use ~6 assertions max, plain TAP, no advanced tape features. Impl ports tape's core (test context, assert/incr count, TAP lines) to ~400 LOC Node streams.
Automation Strategy
- Publish
@stdlib/test/harness(bench mirror: libtests, Makefile). - Global replace:
grep -rl "require('tape')" lib/ | xargs sed -i "s|require('tape')|require('@stdlib/test\/harness')|g"(handles escapes). - Glob run: Update stdlib Makefile:
$(QUIET) $(NODE) $(TOOLS_DIR)/harness.js $(shell find lib -name 'test.*.js'). - Validate: CI diff old/new TAP (tape | harness); fix interpolation mismatches via optional post-sed (regex scan t.equal/ok args).
- Coverage: Stick with istanbul (nyc/c8 drops Node 10-12 compat).
Related Issues
[Idea]: develop a project test runner
Questions
No.
Other
No.
Checklist
- I have read and understood the Code of Conduct.
- Searched for existing issues and pull requests.
- The issue name begins with
RFC:.
- 主要语言
- JavaScript
- 星标
- 6k
- 派生
- 1.3k
- 平均合并
- 1 天 21 小时
- 30 天内合并 PR
- 224
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
stdlib-js/stdlib 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
stdlib-js/stdlib#16655 · 1 条评论 ·
维护者通常 1 天内回复
-
Fix JavaScript lint errors可能已有人在做 @protestershankar 于 5 天前认领。 未关闭Good First Issue
难度 2/5 1-3 小时 新手友好度 82/100
stdlib-js/stdlib#16563 · 3 条评论 ·
维护者通常 1 天内回复
-
Fix C lint errors可能已有人在做 @raus7n 于 14 天前认领。 未关闭Good First Issue
难度 1/5 1 小时以内 新手友好度 82/100
stdlib-js/stdlib#16454 · 1 条评论 ·
维护者通常 1 天内回复
-
Fix JavaScript lint errors可能已有人在做 @Devansh-18155 于 39 天前认领。 未关闭Good First Issue
难度 1/5 1 小时以内 新手友好度 82/100
stdlib-js/stdlib#15970 · 1 条评论 ·
维护者通常 1 天内回复
-
Fix JavaScript lint errors可能已有人在做 @lb1192176991-lab 于 44 天前认领。 未关闭Good First Issue
难度 1/5 1 小时以内 新手友好度 90/100
stdlib-js/stdlib#15831 · 2 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 69/100
维护者通常 1 天内回复
-
automation chore ci-cd consistency developer-experience difficulty: easy discoverability documentation enhancement github-actions good first issue help wanted hygiene priority: P3 seo shell yaml
难度 1/5 1 小时以内 新手友好度 76/100
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
swc-project/swc-next-issues#394 ·
-
难度 1/5 1-3 小时 新手友好度 88/100
githubnext/gh-aw-workshop#5790 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
adobe/helix-tools-website#480 ·
维护者通常 1 天内回复