Skip to content

Commit 83eb248

Browse files
cursoragentclaude
andcommitted
test(nuxt-5): remove conditional env assertions
Co-Authored-By: gpt-5.3-codex-high <noreply@anthropic.com>
1 parent 5fa214b commit 83eb248

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

dev-packages/e2e-tests/test-applications/nuxt-5/tests/environment.test.ts

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { waitForError, waitForTransaction } from '@sentry-internal/test-utils';
33
import { isDevMode } from './isDevMode';
44

55
test.describe('environment detection', async () => {
6+
const expectedEnvironment = isDevMode ? 'development' : 'production';
7+
68
test('sets correct environment for client-side errors', async ({ page }) => {
79
const errorPromise = waitForError('nuxt-5', async errorEvent => {
810
return errorEvent?.exception?.values?.[0]?.value === 'Error thrown from nuxt-5 E2E test app';
@@ -14,11 +16,7 @@ test.describe('environment detection', async () => {
1416

1517
const error = await errorPromise;
1618

17-
if (isDevMode) {
18-
expect(error.environment).toBe('development');
19-
} else {
20-
expect(error.environment).toBe('production');
21-
}
19+
expect(error.environment).toBe(expectedEnvironment);
2220
});
2321

2422
test('sets correct environment for client-side transactions', async ({ page }) => {
@@ -30,11 +28,7 @@ test.describe('environment detection', async () => {
3028

3129
const transaction = await transactionPromise;
3230

33-
if (isDevMode) {
34-
expect(transaction.environment).toBe('development');
35-
} else {
36-
expect(transaction.environment).toBe('production');
37-
}
31+
expect(transaction.environment).toBe(expectedEnvironment);
3832
});
3933

4034
test('sets correct environment for server-side errors', async ({ page }) => {
@@ -49,11 +43,7 @@ test.describe('environment detection', async () => {
4943

5044
expect(error.transaction).toBe('GET /api/server-error');
5145

52-
if (isDevMode) {
53-
expect(error.environment).toBe('development');
54-
} else {
55-
expect(error.environment).toBe('production');
56-
}
46+
expect(error.environment).toBe(expectedEnvironment);
5747
});
5848

5949
test('sets correct environment for server-side transactions', async ({ page }) => {
@@ -68,10 +58,6 @@ test.describe('environment detection', async () => {
6858

6959
expect(transaction.contexts.trace.op).toBe('http.server');
7060

71-
if (isDevMode) {
72-
expect(transaction.environment).toBe('development');
73-
} else {
74-
expect(transaction.environment).toBe('production');
75-
}
61+
expect(transaction.environment).toBe(expectedEnvironment);
7662
});
7763
});

0 commit comments

Comments
 (0)