Closed Bug 2013973 Opened 7 months ago Closed 4 months ago

Add a MLTestUtils.sys.mjs to TESTING_JS_MODULES

Categories

(Core :: Machine Learning: On Device, enhancement, P3)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 2018054

People

(Reporter: gregtatum, Unassigned)

Details

I built some server tools for the PageExtractor that are useful for easily serving arbitrary HTML content. This is really nice for exercising page extraction tests. The code has a little bit of complexity as it's invoking a server. I found it made for nice tests, and when I repeated the pattern I ended up making a new copy of the code. On top of that the translations code is looking at adding the same thing. Rather than duplicate this code, let's create one utility module that contains it.

Here is an example of the serveOnce function in use.
https://searchfox.org/firefox-main/search?q=symbol:%23serveOnce&redirect=false

Plus here is one being added to translations, which also includes a fix, as my initial implementation only supported Latin-1 text.
https://phabricator.services.mozilla.com/D271447#change-jrStmd0l1KBu

Depending on when Bug 1996967 lands we may need to clean up usages.

Here are a bunch of usages of the TESTING_JS_MODULES for examples.
https://searchfox.org/firefox-main/search?q=TESTING_JS_MODULES

Also, using a tagged template literal called html:

e.g.

html`<div>Content</div>`

Has another benefit of editors being able to use that as a hint that the content should be syntax highlighted as html, and the contents will be linted. It also co-locates the HTML content with the assertions, which makes for easier test debugging.

This is happening in Bug 2018054

Status: NEW → RESOLVED
Closed: 4 months ago
Duplicate of bug: 2018054
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.