Skip to content
Prev Previous commit
Next Next commit
test conditions for development-webpack
  • Loading branch information
chargome committed Oct 9, 2025
commit d05629f8a07e8c385639be308b4e5b55ff3e2e5c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const packageJson = require('../package.json');
test('Sends a client-side exception to Sentry', async ({ page }) => {
const nextjsVersion = packageJson.dependencies.next;
const nextjsMajor = Number(nextjsVersion.split('.')[0]);
const isDevMode = process.env.TEST_ENV.includes('development');
const isDevMode = !!process.env.TEST_ENV && process.env.TEST_ENV.includes('development');

await page.goto('/');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';

test('should have symbolicated dev errors', async ({ page }) => {
test.skip(!process.env.TEST_ENV.includes('development'), 'should be skipped for non-dev mode');
const isDevMode = !!process.env.TEST_ENV && process.env.TEST_ENV.includes('development');
test.skip(!isDevMode, 'should be skipped for non-dev mode');

await page.goto('/');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const packageJson = require('../package.json');
test('Sends a pageload transaction', async ({ page }) => {
const nextjsVersion = packageJson.dependencies.next;
const nextjsMajor = Number(nextjsVersion.split('.')[0]);
const isDevMode = process.env.TEST_ENV.includes('development');
const isDevMode = !!process.env.TEST_ENV && process.env.TEST_ENV.includes('development');

const pageloadTransactionEventPromise = waitForTransaction('nextjs-app-dir', transactionEvent => {
return transactionEvent?.contexts?.trace?.op === 'pageload' && transactionEvent?.transaction === '/';
Expand Down Expand Up @@ -78,8 +78,9 @@ test('Should send a transaction for instrumented server actions', async ({ page
test('Should send a wrapped server action as a child of a nextjs transaction', async ({ page }) => {
const nextjsVersion = packageJson.dependencies.next;
const nextjsMajor = Number(nextjsVersion.split('.')[0]);
const isDevMode = !!process.env.TEST_ENV && process.env.TEST_ENV.includes('development');
test.skip(!isNaN(nextjsMajor) && nextjsMajor < 14, 'only applies to nextjs apps >= version 14');
test.skip(process.env.TEST_ENV.includes('development'), 'this magically only works in production');
test.skip(isDevMode, 'this magically only works in production');

const nextjsPostTransactionPromise = waitForTransaction('nextjs-app-dir', async transactionEvent => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';

test('should have symbolicated dev errors', async ({ page }) => {
test.skip(process.env.TEST_ENV !== 'development', 'should be skipped for non-dev mode');
test.skip(!process.env.TEST_ENV?.includes('development'), 'should be skipped for non-dev mode');

await page.goto('/');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { expect, test } from '@playwright/test';
import { waitForError, waitForTransaction } from '@sentry-internal/test-utils';
import { waitForTransaction } from '@sentry-internal/test-utils';

const packageJson = require('../package.json');

test('Sends a pageload transaction', async ({ page }) => {
const nextjsVersion = packageJson.dependencies.next;
const nextjsMajor = Number(nextjsVersion.split('.')[0]);
const isDevMode = process.env.TEST_ENV === 'development';
const isDevMode = process.env.TEST_ENV?.includes('development');

const pageloadTransactionEventPromise = waitForTransaction('nextjs-pages-dir', transactionEvent => {
return transactionEvent?.contexts?.trace?.op === 'pageload' && transactionEvent?.transaction === '/';
Expand Down