test: class-diagnostics fails when FORCE_COLOR is set
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 88/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- testing
调研方向
从 tests/class-diagnostics.test.ts 开始:第 88 行会过滤以 error: 开头的 stderr 行,构建在第 26 行通过 Bun.spawnSync 使用继承的环境启动。用 FORCE_COLOR=1 bun test tests/class-diagnostics.test.ts 复现,然后在做前缀检查前去除 ANSI 转义序列,或者在没有 FORCE_COLOR 的情况下启动子进程。当该文件在设置和不设置 FORCE_COLOR 时都报告 4 pass, 0 fail 时即完成。
由索引模型根据 Issue 内容生成。
描述
Version
PocketJS main (2c9fcf30). macOS 27.2 arm64, Bun 1.4.2.
Repro
FORCE_COLOR=1 bun test tests/class-diagnostics.test.ts
Actual
3 pass
1 fail
The failing test is --strict-classes fails on the ones in a class attribute and writes no bundle. It expects three lines and receives none:
- [
- "error: main.tsx:6:15: class "flex-col items-centre gap-2" does not compile: unknown utility items-centre",
- "error: main.tsx:7:49: class "text-smal font-bold" does not compile: unknown utility text-smal",
- "error: main.tsx:9:17: class "hiden" does not compile: unknown utility hiden",
- ]
+ []
With FORCE_COLOR unset the file reports 4 pass, 0 fail.
Expected
The test passes with or without FORCE_COLOR in the environment.
Cause
tests/class-diagnostics.test.ts:88 keeps the stderr lines of the build that start with error: . The build runs as a child process (Bun.spawnSync, line 26) and inherits the environment. With FORCE_COLOR set, Bun writes colour codes before and inside the error: prefix, so no line matches.
CI does not set the variable. A terminal or an agent harness that exports FORCE_COLOR=1 sees one failure in the unit stage of bun tools/test.ts.
Workaround
env -u FORCE_COLOR bun test tests/class-diagnostics.test.ts
- 主要语言
- TypeScript
- 星标
- 1.6k
- 派生
- 88
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pocket-stack/pocketjs 的其他 Issue
-
microts: a model local that every branch assigns raises unused_assignments in the generated Rust未关闭bug
难度 2/5 1-3 小时 新手友好度 80/100
pocket-stack/pocketjs#756 ·
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
pocket-stack/pocketjs#746 ·
-
bug
难度 2/5 1-3 小时 新手友好度 74/100
pocket-stack/pocketjs#743 ·
-
bug
难度 5/5 一周以上 新手友好度 12/100
pocket-stack/pocketjs#757 ·
-
bug
难度 4/5 3-5 天 新手友好度 35/100
pocket-stack/pocketjs#744 ·
查看 pocket-stack/pocketjs 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复
-
security: set top-level least-privilege permissions in five workflows可能已有人在做 @JonathanTSilva 今天认领。 未关闭priority: p2 size: xs type: security
难度 2/5 1-3 小时 新手友好度 64/100
JonathanTSilva/jts-website#150 ·
维护者通常 1 天内回复
-
bug Needs Triage
难度 2/5 1-3 小时 新手友好度 82/100
scottbenton/Iron-Link#437 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 80/100
speakeasy-api/speakeasy#2159 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
vercel-labs/ui#1066 ·
维护者通常 1 天内回复