Skip to content

test: browser test runner#48

Open
JoTurk wants to merge 2 commits intodevfrom
test-runner
Open

test: browser test runner#48
JoTurk wants to merge 2 commits intodevfrom
test-runner

Conversation

@JoTurk
Copy link
Contributor

@JoTurk JoTurk commented Oct 23, 2025

  • Run the test on real browsers in the CI.
  • Added helpers to run tests.
  • Added a lambdatest helper.
  • code coverage.
  • added an example for running tests in the browser.

@JoTurk JoTurk changed the base branch from main to dev October 23, 2025 19:41
@JoTurk JoTurk force-pushed the test-runner branch 2 times, most recently from 9d5f81c to 9a32dd8 Compare October 23, 2025 19:46
@codecov
Copy link

codecov bot commented Oct 23, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

- Run the test on real browsers in the CI.
- Added helpers to run tests.
- Added a lambdatest helper.
Copy link

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 modernizes the testing infrastructure by migrating from Vitest v3 to v4, implementing browser-based testing with WebDriverIO, and adding LambdaTest integration for cross-browser testing in CI/CD.

Key changes include:

  • Migration to Vitest v4 with separate Node.js and browser test projects
  • Addition of WebDriverIO-based browser testing with support for Chrome, Firefox, Edge, and Safari
  • Integration with LambdaTest for cloud-based cross-browser testing
  • Replacement of self.fetch with globalThis.fetch for better cross-environment compatibility

Reviewed Changes

Copilot reviewed 12 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
vitest.config.ts Adds comprehensive browser testing configuration with WebDriverIO provider and LambdaTest support
src/ui/UIMetrics.browser.spec.ts New browser-specific test for UIMetrics component
src/Util.ts Updates fetch implementation to use globalThis instead of self
src/Util.spec.ts Updates tests for globalThis.fetch and adds browser environment compatibility
src/EventEmitter.spec.ts Adds mockClear to prevent test interference
src/Connect.spec.ts Updates invalid URL test case
scripts/run-lambdatest.ts New script for managing LambdaTest browser matrix selection and test execution
package.json Updates dependencies to Vitest v4 and adds browser testing packages
.husky/pre-push Updates to use new test script
.gitignore Adds test-related ignore patterns
.github/workflows/test.yaml New GitHub Actions workflow for matrix testing across browsers and platforms
.github/workflows/test-node.yml Removed in favor of new test.yaml workflow
.codecov.yml Removes comment configuration
Comments suppressed due to low confidence (1)

src/Util.spec.ts:310

  • The describe blocks 'path functions' and 'string trim functions' are incorrectly nested inside the it('should throw on error response') test at line 260. This will cause these test suites to never execute. These describe blocks should be moved outside and at the same level as the 'fetch' describe block.
            describe('path functions', () => {
                it('should get extension from path', () => {
                    expect(Util.getExtension('file.txt')).toBe('.txt');
                    expect(Util.getExtension('path/to/file.txt')).toBe('.txt');
                    expect(Util.getExtension('file')).toBe('');
                    expect(Util.getExtension('path/to/file.txt')).toBe('.txt');
                    expect(Util.getExtension('path/to/.txt')).toBe('.txt');
                    expect(Util.getExtension('.txt')).toBe('.txt');
                    expect(Util.getExtension('path/to/file.txt.')).toBe('.');
                });

                it('should get file from path', () => {
                    expect(Util.getFile('file.txt')).toBe('file.txt');
                    expect(Util.getFile('path/to/file.txt')).toBe('file.txt');
                });

                it('should get base file without extension', () => {
                    expect(Util.getBaseFile('file.txt')).toBe('file');
                    expect(Util.getBaseFile('path/to/file.txt')).toBe('file');
                    expect(Util.getBaseFile('file')).toBe('file');
                });
            });

            describe('string trim functions', () => {
                it('should trim spaces', () => {
                    expect(Util.trim('  hello  ')).toBe('hello');
                });

                it('should trim custom characters', () => {
                    expect(Util.trim('xxhelloxx', 'x')).toBe('hello');
                    expect(Util.trim('xxhello😭xx', 'x😭')).toBe('hello');
                });

                it('should trim start only', () => {
                    expect(Util.trimStart('  hello  ')).toBe('hello  ');
                    expect(Util.trimStart('😭hello😭', '😭')).toBe('hello😭');
                });

                it('should trim end only', () => {
                    expect(Util.trimEnd('  hello  ')).toBe('  hello');
                    expect(Util.trimEnd('😭hello😭', '😭')).toBe('😭hello');
                });
            });

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

@JoTurk JoTurk marked this pull request as draft November 4, 2025 14:46
@JoTurk JoTurk marked this pull request as ready for review December 15, 2025 12:10
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