processing / processing/p5.js

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

Open Beginner friendly
#9,139 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area:Color Enhancement
Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

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 7af496704 ("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.

Contributor guide

Open the contributing guide

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.

Research direction

Open test/unit/color/p5.Color.js and inspect the five listed .todo tests at lines 467, 490, 517, 637, and 685. Change only those tests back to enabled tests, then run the file's test suite and confirm it passes 97/97; leave the unwritten invalid-string test and alpha tolerances unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics, testing
Issue type
Refactor
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
94/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.