Skip to content

Re-enable 5 passing .todo tests in test/unit/color/p5.Color.js #9139

Description

@Shruti2110-coder

Increasing access

These tests cover colour conversion behaviour that beginners rely on when using
color() in HSL and HSB modes. While they sit disabled, a regression in those
code paths would reach learners before it reaches CI. Re-enabling them restores
that safety net at no cost.

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

Feature enhancement details

Commit 7af4967 ("Mark most failing tests as todos", Sep 2024) disabled a
number of tests across the repo during the 2.0 work, mechanically changing
test( and suite( to .todo. The test bodies were left intact.

Five of these in test/unit/color/p5.Color.js now pass on current main. The
underlying issue appears to have been fixed at some point without the tests
being re-enabled:

  • line 467 — "should correctly get HSLA property" (HSL mode, RGB string)
  • line 490 — "should correctly get HSLA property" (HSL mode, HSL string)
  • line 517 — "should correctly get HSLA property" (HSL mode, HSB string)
  • line 637 — "should correctly get HSBA property" (HSB mode, RGB string)
  • line 685 — "should correctly get HSBA property" (HSB mode, HSL string)

They aren't redundant with the existing passing tests in the "with Alpha"
suites: each sits in a different suite and reaches the same expected colour via
a different string-parsing path (rgba(), hsla(), hsba()).

Verification

  • With the five enabled, the file passes 97/97.
  • npm run lint is unchanged at 148 warnings / 0 errors.
  • The five fail as expected when _getHue() is deliberately broken
    (AssertionError: expected 999 to be close to 336 +/- 0.5), so they are
    exercising the code rather than passing vacuously.

Environment: macOS, Node v22.22.2, Vitest 4.1.10, chromium.

Out of scope

  • Line 252's suite.todo('invalid string') has no body — a genuinely unwritten
    test. Left as-is.
  • Lines 410 and 616 use an alpha delta of 0.5 where the rest of the file uses
    0.05. Since alpha runs 0–1, a tolerance of ±0.5 makes the assertion close to
    meaningless. Both are in already-passing tests, so I've left them alone —
    happy to open a separate issue if that's worth fixing.

The change is five one-word edits (test.todotest). I'd like to work on
this if approved.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions