test: class-diagnostics fails when FORCE_COLOR is set

オープン 初心者向け
#745 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
testing

調査の方向性

tests/class-diagnostics.test.ts から始めます。88 行目は error: で始まる stderr 行をフィルタし、ビルドは 26 行目で継承された環境を使って Bun.spawnSync 経由で spawn されます。FORCE_COLOR=1 bun test tests/class-diagnostics.test.ts で再現し、その後、プレフィックス検査の前に ANSI エスケープシーケンスを除去するか、FORCE_COLOR を削除した状態で子プロセスを spawn してください。ファイルが FORCE_COLOR の設定ありとなしの両方で 4 pass, 0 fail を報告したら完了です。

索引モデルが issue の本文から書いたものです。

説明

bug

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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pocket-stack/pocketjs のほかの issue

pocket-stack/pocketjs の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。