Skip to content

Migrate browser transform and core tests for Web Test Runner #1299

Merged
matux merged 4 commits into
matux/wtrfrom
matux/browser-core-tests
Sep 8, 2025
Merged

Migrate browser transform and core tests for Web Test Runner #1299
matux merged 4 commits into
matux/wtrfrom
matux/browser-core-tests

Conversation

@matux

@matux matux commented Sep 8, 2025

Copy link
Copy Markdown
Contributor

Caution

This PR is being merged into a feature branch: matux/wtr.

Note

Multiple comments in the diff with details/reasoning about specific changes.

Description of the change

This pull request makes minor updates to the test configuration and imports. The main changes involve cleaning up unused imports and adjusting which test files are excluded from the test runner configuration.

Test configuration updates:

  • Removed test/browser.transforms.test.js and test/browser.core.test.js from the list of excluded test files in web-test-runner.config.mjs, allowing these tests to run again.

Code cleanup:

  • Removed the unused sinon import from test/browser.transforms.test.js.

Related issues

SDK-493/replace-karma-with-webtest-runner-for-modern-performant-browser

@matux matux self-assigned this Sep 8, 2025
Comment thread test/browser.core.test.js
Comment on lines +73 to +78
// karma doesn't unload the browser between tests, so the onerror handler
// will remain installed. Unset captureUncaught so the onerror handler
// won't affect other tests.
rollbar.configure({
captureUncaught: false,
});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This may not be needed anymore, but will remove in a separate PR.

Comment thread test/browser.core.test.js
captureUncaught: false,
});
expect(body.data.body.trace.exception.message).to.eql('anon error');
expect(body.data.notifier.diagnostic.is_anonymous).to.eql(true);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These should be modernized to use Chai 5 syntax, instead of to.eql(true) -> to.be.true but isn't priority. Some other syntax changes are necessary, tho since they change behavior between 4 and 5, and also add extra checks.

Comment thread test/browser.core.test.js

var element = document.getElementById('throw-error');
const element = document.getElementById('throw-error');
expect(element).to.exist;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

New sanity checks, these weren't working before due to html not being loaded correctly.

Comment thread test/browser.core.test.js

server.requests.length = 0;
expect(body.data.body.trace.exception.message).to.eql('test error');
expect(body.data.notifier.diagnostic.is_anonymous).to.be.undefined;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

to.not.be.okto.be.undefined. Chai 5 adds more precise checks for these situations.

@@ -1,5 +1,5 @@
import { expect } from 'chai';
import sinon from 'sinon';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This test file worked after upgrading the error-stack-parser library some time ago without extra changes.

Comment thread test/browser.core.test.js

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I highly recommend hiding whitespaces to improve readability due to transitioning to async/await syntax:

Image

@matux matux merged commit 0402c8b into matux/wtr Sep 8, 2025
4 checks passed
@matux matux deleted the matux/browser-core-tests branch September 8, 2025 13:25
matux added a commit that referenced this pull request Sep 8, 2025
* Initial Karma to Web Test Runner migration (#1289)
* Fix hanging tests and expand WTR migration (#1295)
* Migrate example tests for Web Test Runner (#1298)
* Migrate browser transform and core tests for Web Test Runner  (#1299)
* Migrate browser tests from Karma to Web Test Runner (#1300)
* Initial migration of react native tests (#1301)
* Remove Grunt and Karma (#1302)
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