sdxmessaging / ui-widgets

Build powerful form inputs/outputs with mithril and streams.
MIT License
4 stars 1 forks source link

Migrate to happy-dom #154

Open MichaelPastuch opened 9 months ago

MichaelPastuch commented 9 months ago

As part of migrating to bun for build/test/bundle, we should move to from jsdom to happy-dom. Bun uses happy-dom for testing, and it is a fair bit faster than jsdom. It comes with a few issues:

The following tests in ui-widgets currently fail:

✗ File > resize [9998.06ms] ✗ Image from text > createStamp [0.41ms] ✗ OmniFileInput > set image files [9956.31ms] ✗ CheckboxInput > minimal [1.33ms] ✗ ImageSelect > set 1 [9984.53ms] ✗ ImageMulti > add [9985.46ms] ✗ DateInput > configured + value change [4.63ms] ✗ DateInput > auto advance - locale GB [7.23ms] ✗ DateInput > auto advance - locale US [3.19ms] ✗ DateInput > auto retreat [6.53ms] ✗ DateInput > focusLastInput -- en-GB [3.72ms] ✗ DateInput > focusLastInput -- ja-JP [3.26ms] ✗ DateInput > appendZeroToDayMonth [6.32ms] ✗ DateInput > literal advance - en-GB [3.99ms] ✗ DateInput > literal advance - ko-KR [5.25ms] ✗ DateInput > Validate Date - Set Custom Validity Message for required date input [3.22ms] ✗ DateInput > Validate Date - Set Custom Validity Message for non-required date input [2.72ms] ✗ SignDraw > create/remove [1.11ms] ✗ SignBuilder > options + heightPct [0.72ms] ✗ SignBuilder > set [0.19ms] ✗ PasswordInput > toggle [3.95ms] ✗ CardDateInput > configured + value change [1.01ms] ✗ CardDateInput > autoRetreat [0.74ms] ✗ CardDateInput > focusLastInput [0.56ms] ✗ CardDateInput > auto advance [0.50ms] ✗ CardDateInput > appendZeroToDayMonth [3.73ms] ✗ CardDateInput > literal advance [2.00ms] ✗ CardDateInput > Validate Date - Set Custom Validity Message for required card date input [0.72ms] ✗ CardDateInput > Validate Date - Set Custom Validity Message for non-required card date input [0.73ms]

Some tests timeout, while the majority of the other tests are likely related to a lack of keyboard event handling.

MichaelPastuch commented 9 months ago

The patchy keyboard event support, and no easy way to add canvas is a real pain point for this repo. I've also looked at the alternative of registering jsdom globally as part of the bun test, but I'm having no luck. Testing isn't too critical for performance, I think we should revisit this challenge when bun is more mature.