Skip to content

Add e2e tests for cloudflare service (basic) #304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

dcramer
Copy link
Member

@dcramer dcramer commented Jun 23, 2025

No description provided.

Copy link

codecov bot commented Jun 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.31%. Comparing base (6097301) to head (5a9320f).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #304   +/-   ##
=======================================
  Coverage   59.31%   59.31%           
=======================================
  Files          44       44           
  Lines        5110     5110           
  Branches      383      383           
=======================================
  Hits         3031     3031           
  Misses       2079     2079           
Flag Coverage Δ
unittests 59.31% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…in permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Coverage Initialization and Data Aggregation Issues

This test suite exhibits two coverage-related bugs:

  1. Duplicate Coverage Initialization: Coverage collection is started redundantly in the beforeEach hook of simple.spec.ts, as it's already initiated globally in coverage.setup.ts. This causes Playwright to throw an error because coverage cannot be started twice on the same page instance.
  2. Race Condition in Coverage Data Aggregation: The jsCoverage and cssCoverage arrays are shared and accessed concurrently by multiple tests when fullyParallel: true is enabled. This race condition can lead to data corruption or loss in the aggregated coverage reports.

packages/mcp-cloudflare-e2e/tests/simple.spec.ts#L4-L21

test.describe("Simple Application Tests", () => {
const jsCoverage: any[] = [];
const cssCoverage: any[] = [];
test.beforeEach(async ({ page }) => {
// Start coverage collection for each test
await page.coverage.startJSCoverage();
await page.coverage.startCSSCoverage();
});
test.afterEach(async ({ page }) => {
// Collect coverage after each test
const jsResults = await page.coverage.stopJSCoverage();
const cssResults = await page.coverage.stopCSSCoverage();
jsCoverage.push(...jsResults);
cssCoverage.push(...cssResults);
});

Fix in Cursor


Bug: Incompatible Coverage Tools Conflict

The test:coverage script in packages/mcp-cloudflare-e2e/package.json attempts to use nyc for coverage reporting. This is incompatible as nyc processes Node.js coverage, while Playwright collects browser-based coverage, leading to script failure or incorrect reports.

packages/mcp-cloudflare-e2e/package.json#L1-L22

{
"name": "@sentry/mcp-cloudflare-e2e",
"version": "0.12.0",
"private": true,
"description": "End-to-end tests for Sentry MCP",
"scripts": {
"test": "playwright test",
"test:coverage": "mkdir -p coverage && playwright test && nyc report --reporter=lcov --reporter=json --reporter=text",
"test:ci": "mkdir -p coverage && playwright test --reporter=junit",
"test:headed": "playwright test --headed",
"test:ui": "playwright test --ui",
"test:debug": "playwright test --debug",
"show-report": "playwright show-report",
"install:browsers": "playwright install --with-deps"
},
"devDependencies": {
"@playwright/test": "^1.43.0",
"typescript": "^5.4.5",
"nyc": "^17.1.0",
"@types/node": "^22.10.6"
}
}

Fix in Cursor


Was this report helpful? Give feedback by reacting with 👍 or 👎

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.

1 participant