Skip to content

Commit ec7441d

Browse files
author
Luca Forstner
committed
Add integration tests
1 parent be1e9f3 commit ec7441d

File tree

22 files changed

+207
-44
lines changed

22 files changed

+207
-44
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function ({ children }: { children: React.ReactNode }) {
2+
return <>{children}</>;
3+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use client';
2+
3+
export default function () {
4+
return <p>I am a client component!</p>;
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function ({ children }: { children: React.ReactNode }) {
2+
return <>{children}</>;
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default async function () {
2+
return <p>I am a server component!</p>;
3+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const { withSentryConfig } = require('@sentry/nextjs');
2+
3+
// NOTE: This will be used by integration tests to distinguish between Webpack 4 and Webpack 5
4+
const moduleExports = {
5+
webpack5: %RUN_WEBPACK_5%,
6+
eslint: {
7+
ignoreDuringBuilds: true,
8+
},
9+
pageExtensions: ['jsx', 'js', 'tsx', 'ts', 'page.tsx'],
10+
sentry: {
11+
// Suppress the warning message from `handleSourcemapHidingOptionWarning` in `src/config/webpack.ts`
12+
// TODO (v8): This can come out in v8, because this option will get a default value
13+
hideSourceMaps: false,
14+
excludeServerRoutes: [
15+
'/api/excludedEndpoints/excludedWithString',
16+
/\/api\/excludedEndpoints\/excludedWithRegExp/,
17+
],
18+
},
19+
};
20+
21+
const SentryWebpackPluginOptions = {
22+
dryRun: true,
23+
silent: true,
24+
};
25+
26+
module.exports = withSentryConfig(moduleExports, SentryWebpackPluginOptions);
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const { withSentryConfig } = require('@sentry/nextjs');
2+
3+
// NOTE: This will be used by integration tests to distinguish between Webpack 4 and Webpack 5
4+
const moduleExports = {
5+
webpack5: %RUN_WEBPACK_5%,
6+
eslint: {
7+
ignoreDuringBuilds: true,
8+
},
9+
experimental: {
10+
appDir: Number(process.env.NODE_MAJOR) >= 16, // experimental.appDir requires Node v16.8.0 or later.
11+
},
12+
pageExtensions: ['jsx', 'js', 'tsx', 'ts', 'page.tsx'],
13+
sentry: {
14+
// Suppress the warning message from `handleSourcemapHidingOptionWarning` in `src/config/webpack.ts`
15+
// TODO (v8): This can come out in v8, because this option will get a default value
16+
hideSourceMaps: false,
17+
excludeServerRoutes: [
18+
'/api/excludedEndpoints/excludedWithString',
19+
/\/api\/excludedEndpoints\/excludedWithRegExp/,
20+
],
21+
},
22+
};
23+
24+
const SentryWebpackPluginOptions = {
25+
dryRun: true,
26+
silent: true,
27+
};
28+
29+
module.exports = withSentryConfig(moduleExports, SentryWebpackPluginOptions);

packages/nextjs/test/integration/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"dependencies": {
1111
"@sentry/nextjs": "file:../../",
12-
"next": "latest",
12+
"next": "10.x",
1313
"react": "^17.0.1",
1414
"react-dom": "^17.0.1"
1515
},
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "with-typescript",
3+
"license": "MIT",
4+
"scripts": {
5+
"dev": "next",
6+
"build": "next build",
7+
"predebug": "source ../integration_test_utils.sh && link_monorepo_packages '../../..' && yarn build",
8+
"start": "next start"
9+
},
10+
"dependencies": {
11+
"@sentry/nextjs": "file:../../",
12+
"next": "latest",
13+
"react": "^17.0.1",
14+
"react-dom": "^17.0.1"
15+
},
16+
"devDependencies": {
17+
"@types/node": "^15.3.1",
18+
"@types/puppeteer": "^5.4.3",
19+
"@types/react": "17.0.47",
20+
"@types/react-dom": "17.0.17",
21+
"nock": "^13.1.0",
22+
"puppeteer": "^9.1.1",
23+
"typescript": "^4.2.4",
24+
"yargs": "^16.2.0"
25+
},
26+
"resolutions": {
27+
"@sentry/browser": "file:../../../browser",
28+
"@sentry/core": "file:../../../core",
29+
"@sentry/integrations": "file:../../../integrations",
30+
"@sentry/node": "file:../../../node",
31+
"@sentry/react": "file:../../../react",
32+
"@sentry/replay": "file:../../../replay",
33+
"@sentry/tracing": "file:../../../tracing",
34+
"@sentry/types": "file:../../../types",
35+
"@sentry/utils": "file:../../../utils"
36+
}
37+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { withSentry } from '@sentry/nextjs';
1+
import { wrapApiHandlerWithSentry } from '@sentry/nextjs';
22
import { NextApiRequest, NextApiResponse } from 'next';
33

44
const handler = async (_req: NextApiRequest, res: NextApiResponse): Promise<void> => {
55
res.status(500).json({ statusCode: 500, message: 'Something went wrong' });
66
};
77

8-
export default withSentry(handler);
8+
export default wrapApiHandlerWithSentry(handler, '/api/broken');

0 commit comments

Comments
 (0)