Skip to content

Commit 0cab21d

Browse files
dsmmckenclaudeCopilotmofojed
authored
chore: Migrate golden-layout tests from Karma to Jest (deephaven#2611)
Migrate golden-layout tests from Karma/Jasmine to Jest/TypeScript using AI and a planning doc. Migration worked, I manually spot checked a bunch of them for sanity and they seemed like it made wise choices, and even uncovered a bug. - Migrate all 21 test files from /test/.js to /src/tests/.test.ts - Tests kept with same name, and same coverage - Remove Karma configuration and legacy test files - Enable previously skipped drag tests with jQuery mocks - Fix bug in replaceChild that caused destruction errors Changes Test Migration - Convert Jasmine syntax to Jest (spyOn → jest.spyOn, waitsFor/runs → async/await) - Add shared test utilities in src/test-utils/testUtils.ts - Remove Karma devDependencies (babelify, browserify, karma-browserify, watchify) - Enabled Drag Tests - Test count decreased, as cleanup is afterEach rather than deticated in each test The drag tests were skipped because jsdom doesn't support jQuery dimension methods. Added mocks for $.fn.offset, $.fn.width, $.fn.height, $.fn.outerWidth, $.fn.outerHeight, and $.fn.is(':visible'). Bug Fix: replaceChild Event Listener Leak When replaceChild() swapped a tab's content item, it directly assigned the new reference without transferring event listeners. This caused "No subscriptions to unsubscribe for event destroy" errors when destroying the layout after drag-drop split operations. Fix: Added Tab.setContentItem() method that properly transfers destroy and titleChanged listeners from the old content item to the new one. Test Results 21 tests migrated, all passing. Test Plan - Manually spot check tests to compare coverage - All golden-layout tests pass - TypeScript compiles without errors --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: mofojed <4505624+mofojed@users.noreply.github.com>
1 parent be78f72 commit 0cab21d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3853
-4394
lines changed

.github/workflows/unit.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,12 @@ jobs:
7878
run: |
7979
npm run test:unit -- --cacheDirectory $PWD/.jest-cache
8080
npm run test:lint -- --changedSince origin/${{ github.event.pull_request.base.ref }} --cacheDirectory $PWD/.jest-cache
81-
npm run test:golden-layout
8281
8382
- name: Unit Test (Push)
8483
if: ${{ github.event_name == 'push' }}
8584
run: |
8685
npm run test:unit -- --cacheDirectory $PWD/.jest-cache
8786
npm run test:lint -- --lastCommit --cacheDirectory $PWD/.jest-cache
88-
npm run test:golden-layout
8987
9088
- name: Codecov report
9189
uses: codecov/codecov-action@v4

0 commit comments

Comments
 (0)