Migrate test framework from Jest/jest-electron to Playwright with coverage collection#25
Closed
Copilot wants to merge 8 commits into
Closed
Migrate test framework from Jest/jest-electron to Playwright with coverage collection#25Copilot wants to merge 8 commits into
Copilot wants to merge 8 commits into
Conversation
Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>
Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>
Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>
Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Migrate testing framework from Jest to Playwright
Migrate test framework from Jest/jest-electron to Playwright
Jan 24, 2026
Owner
|
@copilot 将 lock 文件 git ignore |
Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>
Contributor
Author
Owner
|
@copilot 现在的单元测试,测试的是构建出来的 dist 文件,而不是 src 中的源文件,这样会导致单元测试收集不到正确的覆盖率数据,这不是我想要的。 |
Contributor
Author
我理解您的需求。当前测试使用构建后的 dist 文件确实无法收集源码覆盖率。 我有几个方案可以解决这个问题: 方案 A: 继续使用 Playwright,但切换到 @web/test-runner(专门为浏览器测试设计,支持源码覆盖率收集)
方案 B: 使用构建工具(如 rollup)生成带 instrument 的测试版本,配合 Playwright 的 coverage API
方案 C: 回退到 Jest(或类似的 Vitest),使用 jsdom 而不是 jest-electron
您更倾向于哪个方案?或者您有其他期望的实现方式吗? |
Owner
|
@copilot 你不要忽悠我,playwright 也能收集覆盖率的~ |
- Created rollup.config.test.js for building test version with source maps - Added test-setup.js with V8 coverage API integration - Updated all test files to use coverage-enabled test setup - Added nyc for coverage reporting from Istanbul format - Configured coverage to track src/ files via source maps - Removed @web/test-runner dependencies (not needed) - Added coverage:report script for generating HTML/text reports Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>
Contributor
Author
您说得对!已在 9ac807e 中实现 Playwright 覆盖率收集。 实现方案:
使用方式: npm test # 运行测试并生成覆盖率报告覆盖率报告会生成在 |
Copilot
AI
changed the title
Migrate test framework from Jest/jest-electron to Playwright
Migrate test framework from Jest/jest-electron to Playwright with coverage collection
Jan 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migration Plan: Jest + jest-electron → Playwright
Summary
Successfully migrated from Jest + jest-electron to Playwright testing framework with full coverage collection from source files. All 3 original test files have been migrated to run in real browsers (Chromium, Firefox, WebKit).
Coverage Collection
Coverage is collected from source files (
src/) using:dist/size-sensor.test.jswith source mapsRun
npm testto execute tests and automatically generate coverage reports in thecoverage/directory.Test Coverage
The tests cover:
Tests will run in CI with
npm testafter browsers are installed vianpx playwright install --with-deps.Original prompt
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.