Skip to content

Browser tests migrated to TS#1446

Merged
matux merged 10 commits intomasterfrom
matux/migrate-test-js-to-ts-3
Nov 25, 2025
Merged

Browser tests migrated to TS#1446
matux merged 10 commits intomasterfrom
matux/migrate-test-js-to-ts-3

Conversation

@matux
Copy link
Contributor

@matux matux commented Nov 24, 2025

Description of the change

This PR migrates all the browser tests to TS.

@matux matux requested a review from Copilot November 24, 2025 22:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates several browser test files from JavaScript to TypeScript by removing @ts-nocheck directives and adding proper type definitions. The migration ensures type safety across browser tests while maintaining existing test functionality.

Key changes:

  • Consolidated global Window interface type definitions into a shared test utilities file
  • Added proper TypeScript type annotations to test helper functions
  • Fixed setTimeout calls to match TypeScript's expected signature

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/browser.rollbar.test-utils.ts Added global Window interface extensions including rollbar, server, chrome, and _rollbarURH properties
test/browser.rollbar.autoInstrument.test.ts Updated setTimeout calls to include the required second parameter for TypeScript compatibility
test/browser.rollbar.autoInstrument.fetch.test.ts Updated setTimeout calls to include the required second parameter for TypeScript compatibility
test/browser.rollbar.autoInstrument.csp.test.ts Removed @ts-nocheck directive and updated setTimeout call signature
test/browser.replay.recorder.test.ts Removed @ts-nocheck directive and refactored Recorder instantiation to use options object pattern
test/browser.predicates.test.ts Removed @ts-nocheck directive to enable TypeScript checking
test/browser.domUtility.test.ts Removed @ts-nocheck, added local Node interface, and refactored genElement function with proper TypeScript typing
test/browser.core.test.ts Removed duplicate Window interface declarations now centralized in test-utils

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@matux matux force-pushed the matux/migrate-test-js-to-ts-3 branch from 07c29b4 to 46344ae Compare November 24, 2025 22:19
@matux matux changed the title More browser tests migrated to TS Browser tests migrated to TS Nov 24, 2025
@matux matux requested review from Copilot and waltjones November 24, 2025 23:47
@matux matux self-assigned this Nov 24, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 15 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const causeErr = new Error('cause error');
const err = new Error('test error', { cause: causeErr });
const err = new Error('test error') as Error & { cause?: Error };
err.cause = causeErr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The options argument with cause isn't working?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: 7b3ef9b

Tell me what do you think of this.


it('should handle select type input events', async function () {
const elem = document.getElementById('fruit-select');
const elem = getElementById('fruit-select');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did these not work with document.?

Copy link
Contributor Author

@matux matux Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed! 176afb8

rollbar.log('test'); // generate a payload to inspect

await setTimeout(1);
await setTimeout(1, null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be valid to call setTimeout with one argument. Was this now working?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked offline, will fix in #1447.

Base automatically changed from matux/migrate-test-js-to-ts-2 to master November 25, 2025 19:06
@matux matux force-pushed the matux/migrate-test-js-to-ts-3 branch from e080121 to 7b3ef9b Compare November 25, 2025 19:07
@matux matux force-pushed the matux/migrate-test-js-to-ts-3 branch from ed506bc to 1f5d190 Compare November 25, 2025 19:58
@matux matux requested a review from waltjones November 25, 2025 20:02
@matux matux merged commit 459c418 into master Nov 25, 2025
7 checks passed
@matux matux deleted the matux/migrate-test-js-to-ts-3 branch November 25, 2025 20:14
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