bubbles-ui / bubbles-ui-util: 移行で初めて動いたテストと型チェックの赤を、どう直すか決めたい

Open
#210 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 12 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript

Research direction

Start with bublys-libs/bubbles-ui-util/src/lib/SmartRect.test.ts and SmartRect.ts to determine which scale≠1 coordinate behavior is intended; the issue notes that changing the implementation needs visual confirmation. Then inspect the listed bubbles-ui test files and tsconfig.spec.json, separating mechanical typecheck errors from the two tests whose intent needs review. Done means the disputed tests are unskipped, typechecks pass, and nx run-many -t typecheck is green.

Written by the indexing model from the issue text.

Description

OS question refactor

背景

テストランナーを Jest から Vitest に統一した(#<PR番号>)。
bubbles-ui と bubbles-ui-util のテストは、Jest の設定ファイルが読めず長いあいだ一度も実行されていなかった。
移行して初めて動いたところ、OS の振る舞いに関わる食い違いが見つかった。
どちらが正しいかを判断してほしい。

1. SmartRect の座標変換(テストを it.skip で止めている)

bublys-libs/bubbles-ui-util/src/lib/SmartRect.test.ts の 2 件が、期待値と実装の計算で食い違う。

テスト 期待値 実装の計算
toGlobal > scale=0.9のレイヤーから変換する x = 147 x = 144
toLocal > scale=0.9のレイヤーに変換する 50 53.75

テストのコメントは、消失点を基準に縮める式を前提にしている。

globalX = vanishingPoint.x + (localX - vanishingPoint.x) * scale + offset.x
        = 20 + (50 - 20) * 0.9 + 100 = 147

同じファイルの scale=1.0 のケースと往復変換のケースは通る。縮める(scale≠1)ときの式だけがずれている。

決めたいこと

  • 正しいのは実装か、テストの期待値か
    • 実装が正しい → テストの期待値と式のコメントを今の実装に合わせ、it.skip を外す
    • テストが正しい → SmartRect を直す(奥のレイヤーの泡の位置が変わるので、画面での確認が要る)
  • 履歴: テストは 9a942cac(2026-01-26、bubbles-ui-util へ移したとき)から。
    SmartRect.ts の最後の変更は 9acba1d7(2026-06-30)

2. bubbles-ui の型チェックの赤(このままでは nx typecheck が通らない)

テストは実行時には全部通る(151 件)が、型チェックで次が出る。

種類 場所 中身
tsconfig tsconfig.spec.json lib 側が composite: false なのに project reference で参照している(state-management で直したのと同じ)
DOM の型が無い hooks/shortcut.test.ts、bubbles-ui-util の SmartRect.ts テスト用 tsconfig に lib: ["dom"] が無く、document / DOMRect が見つからない
拡張子 Bubble.resize.test.ts ./Bubble.domain に .js が無い(moduleResolution: nodenext では要る)
型が古い state/bubbles-dropped-place.test.ts、state/bubbles-focus.test.ts UniverseState / CoordinateSystemData の形が変わったのに追従していない(origin はもう無い、など)

上の 3 つは機械的に直せる。最後の「型が古い」2 本は、今の state の形で何を確かめたいテストなのかを
OS の担当者に見てほしい
(型だけ合わせると、テストの意図が変わる恐れがある)。

進め方の案

  1. SmartRect の正しい式を決める
  2. bubbles-ui の型チェックを、機械的なもの(tsconfig・DOM・拡張子)と、テストの意図に関わるもの(2 本)に分けて直す
  3. 型チェックが通ったら、nx run-many -t typecheck が赤にならないことを確認する
Dominant language
TypeScript
Stars
1
Forks
0
Avg merge
9d 13h
Merged PRs (30d)
10

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from fumicode/bublys-org

All issues in fumicode/bublys-org

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.