Skip to content

Getting images in a jupyter widget without failing tests#39

Merged
jurra merged 3 commits intoqucat:developfrom
sebranchett:develop
Dec 13, 2025
Merged

Getting images in a jupyter widget without failing tests#39
jurra merged 3 commits intoqucat:developfrom
sebranchett:develop

Conversation

@sebranchett
Copy link
Contributor

This is related to issue #36.

The problem it solves is:
Jupyter Notebook widget needs images to be in lined (no references).
esbuild does this if you use the syntax:
import myimg from './assets/myimg.png';
mocha testing however will not accept this syntax .

This is a very hacky fix, that replaces GetImage.js with the
URL(imagePath, import.meta.url).href;
syntax before testing and restoring the ‘import’ syntax after testing.

Works for:

  1. widget
  2. stand-alone
  3. testing

The Copilot generated solution to issue #36 is more elegant, very complicated and I’m not convinced it will solve the problem addressed here.

I suggest we go with this hacky solution until we can come up with a better idea, that works for all 3 cases.

@jurra jurra merged commit be1d761 into qucat:develop Dec 13, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants