Skip to content

Commit 1cc69ff

Browse files
committed
Merge branch 'develop' into feat-replay-capture-sdk-settings-in-event
2 parents 8d162bc + fe69742 commit 1cc69ff

File tree

67 files changed

+1184
-230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1184
-230
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -783,19 +783,18 @@ jobs:
783783
id: versions
784784
run: |
785785
echo "echo node=$(jq -r '.volta.node' package.json)" >> $GITHUB_OUTPUT
786-
# Temporarily disabling e2e tests
787-
# - name: Run E2E tests
788-
# env:
789-
# E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}
790-
# E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }}
791-
# E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
792-
# E2E_TEST_SENTRY_ORG_SLUG: 'sentry-javascript-sdks'
793-
# E2E_TEST_SENTRY_TEST_PROJECT: 'sentry-javascript-e2e-tests'
794-
# E2E_TEST_SHARD: ${{ matrix.shard }}
795-
# E2E_TEST_SHARD_AMOUNT: 3
796-
# run: |
797-
# cd packages/e2e-tests
798-
# yarn test:e2e
786+
- name: Run E2E tests
787+
env:
788+
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}
789+
E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }}
790+
E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
791+
E2E_TEST_SENTRY_ORG_SLUG: 'sentry-javascript-sdks'
792+
E2E_TEST_SENTRY_TEST_PROJECT: 'sentry-javascript-e2e-tests'
793+
E2E_TEST_SHARD: ${{ matrix.shard }}
794+
E2E_TEST_SHARD_AMOUNT: 3
795+
run: |
796+
cd packages/e2e-tests
797+
yarn test:e2e
799798
800799
job_required_tests:
801800
name: All required tests passed or skipped

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
*.md
22
.nxcache
3-
packages/browser-integration-tests/fixtures

packages/angular-ivy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
## Angular Version Compatibility
1818

19-
This SDK officially supports Angular 12-15 with Angular's new rendering engine, Ivy.
19+
This SDK officially supports Angular 12 to 16 with Angular's new rendering engine, Ivy.
2020

2121
If you're using Angular 10, 11 or a newer Angular version with View Engine instead of Ivy, please use [`@sentry/angular`](https://github.com/getsentry/sentry-javascript/blob/develop/packages/angular/README.md).
2222

packages/angular-ivy/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
"access": "public"
1616
},
1717
"peerDependencies": {
18-
"@angular/common": ">= 12.x <= 15.x",
19-
"@angular/core": ">= 12.x <= 15.x",
20-
"@angular/router": ">= 12.x <= 15.x",
18+
"@angular/common": ">= 12.x <= 16.x",
19+
"@angular/core": ">= 12.x <= 16.x",
20+
"@angular/router": ">= 12.x <= 16.x",
2121
"rxjs": "^6.5.5 || ^7.x"
2222
},
2323
"dependencies": {

packages/angular/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717

1818
## Angular Version Compatibility
1919

20-
The latest version of this SDK officially supports Angular 10-13. If you are using an older version of Angular and experience problems with the Angular SDK, we recommend downgrading the SDK to version 6.x.
20+
**Important**: This package is not compatible with Angular 16 or newer. Please use [`@sentry/angular-ivy`](https://github.com/getsentry/sentry-javascript/tree/master/packages/angular-ivy) instead.
21+
22+
If you're using Angular 12 or newer, we recommend using `@sentry/angular-ivy` for native support with Angular's rendering engine Ivy.
23+
24+
This SDK stilll officially supports Angular 10-15. If you are using an older version of Angular and experience problems with the Angular SDK, we recommend downgrading the SDK to version 6.x.
2125

2226
## General
2327

packages/browser-integration-tests/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module.exports = {
1111
'loader-suites/**/subject.js',
1212
'scripts/**',
1313
'fixtures/**',
14+
'tmp/**',
1415
],
1516
parserOptions: {
1617
sourceType: 'module',
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
test-results
2+
tmp
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tmp
2+
fixtures
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
setTimeout(() => {
2+
const cdnScript = document.createElement('script');
3+
cdnScript.src = '/cdn.bundle.js';
4+
5+
cdnScript.addEventListener('load', () => {
6+
window.Sentry.init({
7+
dsn: 'https://[email protected]/1337',
8+
replaysSessionSampleRate: 0.42,
9+
});
10+
11+
setTimeout(() => {
12+
window.doSomethingWrong();
13+
}, 500);
14+
});
15+
16+
document.head.appendChild(cdnScript);
17+
}, 100);
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { expect } from '@playwright/test';
2+
import fs from 'fs';
3+
import path from 'path';
4+
5+
import { sentryTest, TEST_HOST } from '../../../../utils/fixtures';
6+
import { LOADER_CONFIGS } from '../../../../utils/generatePlugin';
7+
import { envelopeRequestParser, waitForErrorRequest } from '../../../../utils/helpers';
8+
9+
const bundle = process.env.PW_BUNDLE || '';
10+
const isLazy = LOADER_CONFIGS[bundle]?.lazy;
11+
12+
sentryTest('it does not download the SDK if the SDK was loaded in the meanwhile', async ({ getLocalTestUrl, page }) => {
13+
// When the loader is eager, this does not work and makes no sense
14+
if (isLazy !== true) {
15+
sentryTest.skip();
16+
}
17+
18+
let cdnLoadedCount = 0;
19+
let sentryEventCount = 0;
20+
21+
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
22+
sentryEventCount++;
23+
24+
return route.fulfill({
25+
status: 200,
26+
contentType: 'application/json',
27+
body: JSON.stringify({ id: 'test-id' }),
28+
});
29+
});
30+
31+
await page.route(`${TEST_HOST}/*.*`, route => {
32+
const file = route.request().url().split('/').pop();
33+
34+
if (file === 'cdn.bundle.js') {
35+
cdnLoadedCount++;
36+
}
37+
38+
const filePath = path.resolve(__dirname, `./dist/${file}`);
39+
40+
return fs.existsSync(filePath) ? route.fulfill({ path: filePath }) : route.continue();
41+
});
42+
43+
const req = waitForErrorRequest(page);
44+
45+
const url = await getLocalTestUrl({ testDir: __dirname, skipRouteHandler: true });
46+
47+
await page.goto(url);
48+
49+
const eventData = envelopeRequestParser(await req);
50+
51+
await waitForFunction(() => cdnLoadedCount === 2);
52+
53+
// Still loaded the CDN bundle twice
54+
expect(cdnLoadedCount).toBe(2);
55+
56+
// But only sent to Sentry once
57+
expect(sentryEventCount).toBe(1);
58+
59+
// Ensure loader does not overwrite init/config
60+
const options = await page.evaluate(() => (window as any).Sentry.getCurrentHub().getClient()?.getOptions());
61+
expect(options?.replaysSessionSampleRate).toBe(0.42);
62+
63+
expect(eventData.exception?.values?.length).toBe(1);
64+
expect(eventData.exception?.values?.[0]?.value).toBe('window.doSomethingWrong is not a function');
65+
});
66+
67+
async function waitForFunction(cb: () => boolean, timeout = 2000, increment = 100) {
68+
while (timeout > 0 && !cb()) {
69+
await new Promise(resolve => setTimeout(resolve, increment));
70+
await waitForFunction(cb, timeout - increment, increment);
71+
}
72+
}

packages/browser-integration-tests/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"private": true,
1010
"scripts": {
11-
"clean": "rimraf -g suites/**/dist loader-suites/**/dist",
11+
"clean": "rimraf -g suites/**/dist loader-suites/**/dist tmp",
1212
"install-browsers": "playwright install --with-deps",
1313
"lint": "run-s lint:prettier lint:eslint",
1414
"lint:eslint": "eslint . --format stylish",
@@ -58,6 +58,7 @@
5858
},
5959
"devDependencies": {
6060
"@types/glob": "8.0.0",
61+
"@types/node": "^14.6.4",
6162
"glob": "8.0.3"
6263
},
6364
"volta": {

packages/browser-integration-tests/playwright.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@ const config: PlaywrightTestConfig = {
77
// Use 3 workers on CI, else use defaults (based on available CPU cores)
88
// Note that 3 is a random number selected to work well with our CI setup
99
workers: process.env.CI ? 3 : undefined,
10+
11+
globalSetup: require.resolve('./playwright.setup.ts'),
1012
};
13+
1114
export default config;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import setupStaticAssets from './utils/staticAssets';
2+
3+
export default function globalSetup(): Promise<void> {
4+
return setupStaticAssets();
5+
}

packages/browser-integration-tests/suites/public-api/setContext/multiple_contexts/test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ sentryTest('should record multiple contexts', async ({ getLocalTestPath, page })
1616
baz: { qux: 'quux' },
1717
},
1818
context_2: { 1: 'foo', bar: false },
19-
context_4: '[undefined]',
2019
context_5: '[NaN]',
2120
context_6: 3.141592653589793,
2221
});

packages/browser-integration-tests/suites/replay/bufferMode/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ sentryTest(
9494

9595
// 2 errors, 1 flush
9696
await reqErrorPromise;
97-
expect(callsToSentry).toEqual(3);
97+
expect(callsToSentry).toBeGreaterThanOrEqual(3);
9898

9999
await page.click('#log');
100100
await page.click('#go-background');
101101

102102
// Switches to session mode and then goes to background
103103
const req1 = await reqPromise1;
104104
const req2 = await reqPromise2;
105-
expect(callsToSentry).toEqual(5);
105+
expect(callsToSentry).toBeGreaterThanOrEqual(5);
106106

107107
const event0 = getReplayEvent(req0);
108108
const content0 = getReplayRecordingContent(req0);

packages/browser-integration-tests/suites/replay/dsc/init.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Sentry.init({
1313
integrations: [new Integrations.BrowserTracing({ tracingOrigins: [/.*/] }), window.Replay],
1414
environment: 'production',
1515
tracesSampleRate: 1,
16+
// Needs manual start!
1617
replaysSessionSampleRate: 0.0,
17-
replaysOnErrorSampleRate: 1.0,
18+
replaysOnErrorSampleRate: 0.0,
1819
});

0 commit comments

Comments
 (0)