Skip to content

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Feb 26, 2025

We should not use Vitest globals except where they are required.

This PR:

  • Disables globals in our root vite.config.ts
  • Fixes missing imports
  • Sets globals: true for React since there are load of test failures without it and I couldn't immedialy work out why

@@ -1,4 +1,6 @@
import sentryAstro from '../../src/index.server';
import { describe, expect, it } from 'vitest';
Copy link
Member

Choose a reason for hiding this comment

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

let's make the vitest import the first import on the file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, I thought linting would sort this all out!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, this is because since Biome was added, import order has not been enforced. I looked to get this working again and it impacts hundreds of files

@codecov
Copy link

codecov bot commented Feb 26, 2025

❌ 196 Tests Failed:

Tests completed Failed Passed Skipped
4650 196 4454 323
View the top 3 failed test(s) by shortest run time
suites/breadcrumbs/process-thread/test.ts > suites/breadcrumbs/process-thread/test.ts
Stack Traces | 0s run time
ReferenceError: describe is not definedModule.conditionalTest utils/index.ts:43:7
 ❯ .../breadcrumbs/process-thread/test.ts:38:1
suites/child-process/test.ts > suites/child-process/test.ts
Stack Traces | 0s run time
ReferenceError: describe is not definedModule.conditionalTest utils/index.ts:43:7suites/child-process/test.ts:47:3
suites/contextLines/memory-leak/test.ts > suites/contextLines/memory-leak/test.ts
Stack Traces | 0s run time
ReferenceError: describe is not defined
 ❯ .../contextLines/memory-leak/test.ts:3:1

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@timfish timfish force-pushed the timfish/test/no-globals branch from 577e6f3 to b21ecb6 Compare February 26, 2025 16:45
@timfish timfish marked this pull request as ready for review February 26, 2025 16:59
@timfish timfish requested review from a team as code owners February 26, 2025 16:59
@timfish timfish requested a review from AbhiPrasad February 26, 2025 16:59
@AbhiPrasad AbhiPrasad merged commit 3ad018d into develop Feb 26, 2025
154 checks passed
@AbhiPrasad AbhiPrasad deleted the timfish/test/no-globals branch February 26, 2025 17:58
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