Skip to content

Commit ee851a4

Browse files
committed
test optimizations
1 parent 5388d82 commit ee851a4

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

dev-packages/browser-integration-tests/suites/public-api/logger/integration/test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { expect } from '@playwright/test';
22
import type { LogEnvelope } from '@sentry/core';
33
import { sentryTest } from '../../../../utils/fixtures';
4-
import { getFirstSentryEnvelopeRequest, properFullEnvelopeRequestParser } from '../../../../utils/helpers';
4+
import {
5+
getFirstSentryEnvelopeRequest,
6+
properFullEnvelopeRequestParser,
7+
testingCdnBundle,
8+
} from '../../../../utils/helpers';
59

610
sentryTest('should capture console object calls', async ({ getLocalTestUrl, page }) => {
7-
const bundle = process.env.PW_BUNDLE || '';
811
// Only run this for npm package exports
9-
if (bundle.startsWith('bundle') || bundle.startsWith('loader')) {
10-
sentryTest.skip();
11-
}
12+
sentryTest.skip(testingCdnBundle());
1213

1314
const url = await getLocalTestUrl({ testDir: __dirname });
1415

dev-packages/browser-integration-tests/suites/public-api/logger/scopeAttributes/test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { expect } from '@playwright/test';
22
import type { LogEnvelope } from '@sentry/core';
33
import { sentryTest } from '../../../../utils/fixtures';
4-
import { getFirstSentryEnvelopeRequest, properFullEnvelopeRequestParser } from '../../../../utils/helpers';
4+
import {
5+
getFirstSentryEnvelopeRequest,
6+
properFullEnvelopeRequestParser,
7+
testingCdnBundle,
8+
} from '../../../../utils/helpers';
59

610
sentryTest('captures logs with scope attributes', async ({ getLocalTestUrl, page }) => {
7-
const bundle = process.env.PW_BUNDLE || '';
8-
// Only run this for npm package exports
9-
if (bundle.startsWith('bundle') || bundle.startsWith('loader')) {
10-
sentryTest.skip();
11-
}
11+
sentryTest.skip(testingCdnBundle());
1212

1313
const url = await getLocalTestUrl({ testDir: __dirname });
1414

dev-packages/browser-integration-tests/suites/public-api/logger/simple/test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { expect } from '@playwright/test';
22
import type { LogEnvelope } from '@sentry/core';
33
import { sentryTest } from '../../../../utils/fixtures';
4-
import { getFirstSentryEnvelopeRequest, properFullEnvelopeRequestParser } from '../../../../utils/helpers';
4+
import {
5+
getFirstSentryEnvelopeRequest,
6+
properFullEnvelopeRequestParser,
7+
testingCdnBundle,
8+
} from '../../../../utils/helpers';
59

610
sentryTest('should capture all logging methods', async ({ getLocalTestUrl, page }) => {
7-
const bundle = process.env.PW_BUNDLE || '';
811
// Only run this for npm package exports
9-
if (bundle.startsWith('bundle') || bundle.startsWith('loader')) {
10-
sentryTest.skip();
11-
}
12+
sentryTest.skip(testingCdnBundle());
1213

1314
const url = await getLocalTestUrl({ testDir: __dirname });
1415

dev-packages/browser-integration-tests/utils/helpers.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,14 @@ export function shouldSkipTracingTest(): boolean {
314314
return bundle != null && !bundle.includes('tracing') && !bundle.includes('esm') && !bundle.includes('cjs');
315315
}
316316

317+
/**
318+
* @returns `true` if we are testing a CDN bundle
319+
*/
320+
export function testingCdnBundle(): boolean {
321+
const bundle = process.env.PW_BUNDLE;
322+
return bundle != null && (bundle.startsWith('bundle') || bundle.startsWith('loader'));
323+
}
324+
317325
/**
318326
* Today we always run feedback tests, but this can be used to guard this if we ever need to.
319327
*/

0 commit comments

Comments
 (0)