Skip to content

Replace jasmine-ajax with MSW and modernize test infrastructure - 1st pass#7767

Open
zoran995 wants to merge 6 commits intotest-async-functionfrom
msw-poc
Open

Replace jasmine-ajax with MSW and modernize test infrastructure - 1st pass#7767
zoran995 wants to merge 6 commits intotest-async-functionfrom
msw-poc

Conversation

@zoran995
Copy link
Collaborator

@zoran995 zoran995 commented Feb 17, 2026

What this PR does

Part of #7768

Introduces Mock Service Worker (MSW) as the HTTP mocking layer and migrates a first batch of specs from jasmine-ajax to MSW handlers.

  • Add MSW infrastructure (test/mocks/browser.ts, captureRequests.ts, terrain.ts) with global Cesium terrain handlers
  • Wire up MSW worker lifecycle in test/SpecMain.ts (start/resetHandlers/stop)
  • Migrate first batch of specs from jasmine.Ajax.stubRequest to worker.use(http.get(...))
  • Convert fetchMock usage to MSW for consistency

See #7766 - Add ADR for replacing jasmine-ajax with MSW for more details

Test me

Run the Karma test suite — all migrated specs should pass with MSW intercepting requests instead of jasmine-ajax.

Checklist

  • There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)
  • I've updated relevant documentation in doc/.
  • I've updated CHANGES.md with what I changed.
  • I've provided instructions in the PR description on how to test this PR.

@zoran995 zoran995 requested review from ljowen and na9da February 17, 2026 22:08
@zoran995
Copy link
Collaborator Author

zoran995 commented Feb 17, 2026

Deployment is failing as terriamap needs MSW as a dependency to build terriajs

Set up Mock Service Worker (msw) to intercept network requests at
the Service Worker level, enabling gradual migration away from
jasmine-ajax. Includes global Cesium Ion terrain handlers to prevent
unhandled rejections from terrain loading.
…x to MSW

Replace jasmine.Ajax.install/uninstall/stubRequest with MSW
worker.use(http.get(...)) handlers. Removes afterEach cleanup since
worker.resetHandlers() in SpecMain handles it globally.
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.

1 participant