Skip to content

Conversation

@9aoy
Copy link
Contributor

@9aoy 9aoy commented May 28, 2025

Summary

use test global APIs.

https://vitest.dev/config/#globals

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings May 28, 2025 03:40
@netlify
Copy link

netlify bot commented May 28, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit b8387b5
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/6836859786805200089f19d1
😎 Deploy Preview https://deploy-preview-5323--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 76 (🔴 down 4 from production)
Accessibility: 97 (no change from production)
Best Practices: 92 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

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 enables Vitest’s global APIs by configuring TypeScript to recognize vitest/globals and removing explicit vitest imports from setup and test files.

  • Add "types": ["vitest/globals"] to test-related tsconfig.json files
  • Remove redundant describe, it, expect, beforeAll, and vi imports in setup and tests

Reviewed Changes

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

Show a summary per file
File Description
scripts/test-helper/vitest.setup.ts Removed explicit Vitest imports to use global APIs
scripts/test-helper/tsconfig.json Added "types": ["vitest/globals"] to enable globals
packages/plugin-svgr/tests/tsconfig.json Added "types": ["vitest/globals"]
packages/plugin-svgr/tests/index.test.ts Removed redundant Vitest imports
packages/plugin-react/tests/tsconfig.json Added "types": ["vitest/globals"]
packages/plugin-react/tests/index.test.ts Removed redundant Vitest imports
packages/plugin-react/tests/features.test.ts Removed redundant Vitest imports
packages/plugin-preact/tests/tsconfig.json Added "types": ["vitest/globals"]
packages/plugin-preact/tests/index.test.ts Removed redundant Vitest imports
packages/plugin-babel/tests/tsconfig.json Added "types": ["vitest/globals"]
packages/plugin-babel/tests/index.test.ts Removed redundant Vitest imports

@@ -0,0 +1,8 @@
{
Copy link

Copilot AI May 28, 2025

Choose a reason for hiding this comment

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

[nitpick] Test tsconfig files across multiple packages are nearly identical. Consider extracting a shared base tsconfig (e.g., tsconfig.tests.json) and having each package extend it to reduce duplication.

Copilot uses AI. Check for mistakes.
@chenjiahan chenjiahan merged commit a9768c5 into main May 28, 2025
12 checks passed
@chenjiahan chenjiahan deleted the use-global-test-api branch May 28, 2025 03:49
@chenjiahan chenjiahan mentioned this pull request Jun 2, 2025
@chenjiahan chenjiahan mentioned this pull request Jun 26, 2025
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