Closed Bug 1860668 Opened 7 months ago Closed 5 months ago

Convert ActivityStreamPrefs.jsm to an ESM

Categories

(Firefox :: New Tab Page, task, P3)

task

Tracking

()

RESOLVED FIXED
122 Branch
Tracking Status
firefox122 --- fixed

People

(Reporter: mconley, Assigned: mconley)

References

Details

(Whiteboard: [esmification-timeline] [hnt])

Attachments

(5 files)

What's blocking this work is that there are several mocha/chai tests under browser/components/newtab/test/unit/lib that fake out importing ActivityStreamPrefs.jsm using an injection tool that just won't work with ESMs.

This is blocking ESMification. This bug will update those tests to not use injection (which may require me to convert them to xpcshell tests), and then convert ActivityStreamPrefs.jsm to an ESM.

Whiteboard: [esmification-timeline]
Severity: -- → S3
Priority: -- → P3

Hey Scott, so just keeping you in the loop on what I'm slogging through here - the mocha/chai environment that several newtab tests run in use a special injector to mock out / override some JSM loads in the mocha test runner environment. That injector is not compatible with ES6 modules.

I've tried a few approaches here, and unfortunately, I think the best way forward here is probably to convert those tests using the injection to xpcshell tests. This means giving up mocha/chai for those.

I'm in the midst of converting the following tests to xpcshell tests to avoid the injector for ActivityStreamPrefs.jsm:

  • browser/components/newtab/test/unit/lib/Store.test.js
  • browser/components/newtab/test/unit/lib/TopSitesFeed.test.js
  • browser/components/newtab/test/unit/lib/TopStoriesFeed.test.js

Apologies in advance - these patches are not really going to be fun to review.

This is a handwritten conversion of the TopSitesFeed.test.js tests to
xpcshell. Along the way, some of the tests have been dropped - specifically,
tests for pseudoprivate methods on TopSitesFeed that start with _.

The only exception is the Contile integration tests that call
._contile._fetchSites, as those seem fairly important to retain coverage for.

Depends on D192630

This feed is no longer in use by the main distribution of Firefox, and we're
not doing manual QA on it nor changing it. It's blocking our ability to migrate
to ESMs, so we're removing the test altogether. Someday soon, we can hopefully
remove TopStoriesFeed.jsm itself.

Depends on D193473

Attachment #9363382 - Attachment description: Bug 1860668 - Adjust Istanbul coverage thresholds for Store.jsm, TopSitesFeed.jsm and TopStoriesFeed.jsm. r?thecount! → Bug 1860668 - Adjust Istanbul coverage thresholds for Store.jsm and TopSitesFeed.jsm. r?thecount!
Whiteboard: [esmification-timeline] → [esmification-timeline] [hnt]
Pushed by mconley@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fa50fe1f58d4
Convert Store.test.js to an xpcshell test. r=thecount
https://hg.mozilla.org/integration/autoland/rev/6de5000684a8
Convert TopSitesFeed.test.js into an xpcshell test. r=thecount
https://hg.mozilla.org/integration/autoland/rev/c388d81bf3be
Remove TopStoriesFeed.test.js. r=thecount
https://hg.mozilla.org/integration/autoland/rev/3a63a5894552
Adjust Istanbul coverage thresholds for Store.jsm and TopSitesFeed.jsm. r=thecount
https://hg.mozilla.org/integration/autoland/rev/ae0d0f96b661
Convert ActivityStreamPrefs from a JSM to an ESM. r=thecount
https://hg.mozilla.org/integration/autoland/rev/7044de24075f
apply code formatting via Lando
Regressions: 1869955
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: