Skip to content

Commit f0231b1

Browse files
AI Agentclaude
andcommitted
SDK-613: upgrade Next.js examples to 15.5.25 and add test coverage
The two Next.js examples were pinned to next@14.2.15, which is what the Dependabot alert on this repo flags. Move both to next@15.5.25 (latest fully-patched 15.x); `npm audit` no longer reports any advisory against Next.js itself in either example. 15.x rather than 16.x: Next 16 requires node ^20.9 || >=22, which would break the node 18 and node 21 legs of the CI matrix, and it removes `next lint`, which both examples still use. Alongside the bump: - react/react-dom and their types move to 19, matching what Next 15's App Router expects; @rollbar/react already declares 19.x support. - Add `outputFileTracingRoot` to both next configs so Next 15 stops inferring the repo root as the workspace root (multiple lockfiles). - Add `target: ES2017` to the app-router tsconfig, as Next 15 requires for top-level await. Test coverage for the upgrade — both examples now run jest via `next/jest`, so the suites exercise the real SWC/Next transform: - pages router: `_app` renders the page with a Rollbar instance in context, and a throwing page renders the ErrorBoundary fallback and reports through `rollbar.critical` with the configured message, extra and callback; the home page renders (covers next/font/local and next/image under Next 15). - app router: the async `RootLayout` server component wraps the document in the Rollbar Provider, `next_error_handler/error.tsx` reports the error via `useRollbar` and resets, and the `ErrorBoundary` page renders. Wired up as `npm run test:examples` (skips examples without a `test:ci` script) and run as a new CI step. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent ad60d11 commit f0231b1

20 files changed

Lines changed: 13840 additions & 4540 deletions

.github/workflows/ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ jobs:
6767
- name: Test
6868
run: npm run test
6969

70+
- name: Test examples
71+
run: npm run test:examples
72+
7073
install:
7174
runs-on: ubuntu-latest
7275

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const nextJest = require('next/jest');
2+
3+
const createJestConfig = nextJest({ dir: './' });
4+
5+
/** @type {import('jest').Config} */
6+
const jestConfig = {
7+
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
8+
testEnvironment: 'jest-environment-jsdom',
9+
testMatch: ['<rootDir>/src/__tests__/**/*.test.tsx'],
10+
};
11+
12+
module.exports = createJestConfig(jestConfig);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '@testing-library/jest-dom';
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1+
import { fileURLToPath } from 'url';
2+
import path from 'path';
3+
4+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
5+
16
/** @type {import('next').NextConfig} */
2-
const nextConfig = {};
7+
const nextConfig = {
8+
// This example lives inside the @rollbar/react repo, so Next.js would
9+
// otherwise infer the repo root as the workspace root.
10+
outputFileTracingRoot: __dirname,
11+
};
312

413
export default nextConfig;

0 commit comments

Comments
 (0)