Skip to content

Commit c68c653

Browse files
author
Luca Forstner
committed
Merge remote-tracking branch 'origin/develop'
2 parents 49b0ce0 + 250b6d3 commit c68c653

File tree

59 files changed

+317
-119
lines changed

Some content is hidden

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

59 files changed

+317
-119
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
window.sentryOnLoad = function () {
2+
Sentry.init({});
3+
4+
window.__sentryLoaded = true;
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Sentry.forceLoad();
2+
3+
Sentry.captureException('Test exception');
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<script>
6+
window.Sentry = {_customThingOnSentry: 'customThingOnSentry' };
7+
</script>
8+
</head>
9+
<body></body>
10+
</html>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { expect } from '@playwright/test';
2+
3+
import { sentryTest } from '../../../../utils/fixtures';
4+
import { envelopeRequestParser, waitForErrorRequestOnUrl } from '../../../../utils/helpers';
5+
6+
sentryTest('keeps data on window.Sentry intact', async ({ getLocalTestUrl, page }) => {
7+
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
8+
return route.fulfill({
9+
status: 200,
10+
contentType: 'application/json',
11+
body: JSON.stringify({ id: 'test-id' }),
12+
});
13+
});
14+
15+
const url = await getLocalTestUrl({ testDir: __dirname });
16+
const req = await waitForErrorRequestOnUrl(page, url);
17+
18+
const eventData = envelopeRequestParser(req);
19+
20+
expect(eventData.message).toBe('Test exception');
21+
22+
const customThingy = await page.evaluate('window.Sentry._customThingOnSentry');
23+
expect(customThingy).toBe('customThingOnSentry');
24+
});

dev-packages/e2e-tests/test-applications/nextjs-app-dir/assert-build.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as fs from 'fs';
2+
import * as path from 'path';
23
import * as assert from 'assert/strict';
34

45
const packageJson = require('./package.json');
@@ -20,4 +21,11 @@ assert.match(buildStdout, /(λ|ƒ) \/server-component/);
2021
assert.match(buildStdout, /(λ|ƒ) \/server-component\/parameter\/\[\.\.\.parameters\]/);
2122
assert.match(buildStdout, /(λ|ƒ) \/server-component\/parameter\/\[parameter\]/);
2223

24+
// Read the contents of the directory
25+
const files = fs.readdirSync(path.join(process.cwd(), '.next', 'server'));
26+
const mapFiles = files.filter(file => path.extname(file) === '.map');
27+
if (mapFiles.length > 0) {
28+
throw new Error('.map files found even though `sourcemaps.deleteSourcemapsAfterUpload` option is set!');
29+
}
30+
2331
export {};

dev-packages/e2e-tests/test-applications/nextjs-app-dir/next.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ const nextConfig = {
99
};
1010

1111
module.exports = withSentryConfig(nextConfig, {
12-
silent: true,
12+
debug: true,
13+
sourcemaps: {
14+
deleteSourcemapsAfterUpload: true,
15+
},
1316
});

dev-packages/rollup-utils/bundleHelpers.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ export function makeBaseBundleConfig(options) {
4848
output: {
4949
format: 'iife',
5050
name: 'Sentry',
51+
intro: () => {
52+
return 'exports = window.Sentry || {};';
53+
},
5154
},
5255
context: 'window',
5356
plugins: [rrwebBuildPlugin, markAsBrowserBuildPlugin],

docs/commit-issue-pr-guidelines.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ and committed as such onto `develop`.
2929
- Make sure to rebase the branch on `develop` before squashing it
3030
- Make sure to update the commit message of the squashed branch to follow the commit guidelines - including the PR
3131
number
32+
- If you are a Sentry employee, assign yourself to the PR
3233

3334
Please note that we cannot _enforce_ Squash Merge due to the usage of Gitflow (see below). Github remembers the last
3435
used merge method, so you'll need to make sure to double check that you are using "Squash and Merge" correctly.

packages/angular/src/sdk.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
functionToStringIntegration,
1414
inboundFiltersIntegration,
1515
} from '@sentry/core';
16-
import type { Integration } from '@sentry/types';
16+
import type { Client, Integration } from '@sentry/types';
1717
import { logger } from '@sentry/utils';
1818

1919
import { IS_DEBUG_BUILD } from './flags';
@@ -44,7 +44,7 @@ export function getDefaultIntegrations(): Integration[] {
4444
/**
4545
* Inits the Angular SDK
4646
*/
47-
export function init(options: BrowserOptions): void {
47+
export function init(options: BrowserOptions): Client | undefined {
4848
const opts = {
4949
defaultIntegrations: getDefaultIntegrations(),
5050
...options,
@@ -53,7 +53,7 @@ export function init(options: BrowserOptions): void {
5353
applySdkMetadata(opts, 'angular');
5454

5555
checkAndSetAngularVersion();
56-
browserInit(opts);
56+
return browserInit(opts);
5757
}
5858

5959
function checkAndSetAngularVersion(): void {

packages/angular/test/sdk.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ describe('init', () => {
2626

2727
expect(angularDefaultIntegrations).toEqual(browserDefaultIntegrationsWithoutBrowserApiErrors);
2828
});
29+
30+
it('returns client from init', () => {
31+
expect(init({})).not.toBeUndefined();
32+
});
2933
});

0 commit comments

Comments
 (0)