Skip to content

Commit 1d005be

Browse files
authored
chore: upgrade web-nextjs example (#94)
1 parent b2d330f commit 1d005be

24 files changed

+2251
-2552
lines changed

examples/web-nextjs/.eslintrc.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/web-nextjs/.gitignore

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
# dependencies
44
/node_modules
55
/.pnp
6-
.pnp.js
7-
.yarn/install-state.gz
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
812

913
# testing
1014
/coverage
@@ -24,9 +28,10 @@
2428
npm-debug.log*
2529
yarn-debug.log*
2630
yarn-error.log*
31+
.pnpm-debug.log*
2732

28-
# local env files
29-
.env*.local
33+
# env files (can opt-in for committing if needed)
34+
.env*
3035

3136
# vercel
3237
.vercel
@@ -35,5 +40,5 @@ yarn-error.log*
3540
*.tsbuildinfo
3641
next-env.d.ts
3742

38-
# Reassure
39-
.reassure
43+
# Reassure output directory
44+
.reassure

examples/web-nextjs/README-orig.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
1+
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
22

33
## Getting Started
44

@@ -18,7 +18,7 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the
1818

1919
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
2020

21-
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
21+
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
2222

2323
## Learn More
2424

@@ -27,10 +27,10 @@ To learn more about Next.js, take a look at the following resources:
2727
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
2828
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
2929

30-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
30+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
3131

3232
## Deploy on Vercel
3333

3434
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
3535

36-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
36+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.

examples/web-nextjs/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ This example showcases Reassure setup for Next.js web app.
77
1. Install following deps as `devDependencies` to setup basic Jest + React Testing Library setup:
88
* `jest`
99
* `jest-environment-jsdom`
10-
* `@types/jest`
1110
* `@testing-library/react`
11+
* `@testing-library/dom`
12+
* `@testing-library/jest-dom`
13+
* `ts-node`
14+
* `@types/jest`
1215
* `@babel/preset-env`
1316
* `@babel/preset-react`
14-
* `@babel/preset-typescript`
15-
2. Copy `jest.config.js` & `babel.config.js` from this repo for RTL tests to run
17+
* `@babel/preset-typescript`
18+
2. Copy `jest.config.ts` from this repo for RTL tests to run
1619
3. Install `reassure` and `danger` as `devDependencies`
1720
4. Run `yarn reassure init` to:
1821
* generate `reassure-tests.sh` CI script
1922
* generate `dangerfile.js` config for `danger`
20-
* add `.reasure` entry to `.gitignore`
21-
5. (optional) Add `configure({ testingLibrary: 'react' });` to your `jest-setup.js` file
23+
* add `.reassure` entry to `.gitignore`
24+
5. (optional) Add `configure({ testingLibrary: 'react' });` to your `jest.setup.ts` file

examples/web-nextjs/babel.config.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

examples/web-nextjs/dangerfile.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
/* eslint-disable import/no-extraneous-dependencies */
22
import path from 'path';
3+
import { fileURLToPath } from "url";
34
import { dangerReassure } from 'reassure';
45

6+
const __filename = fileURLToPath(import.meta.url);
7+
const __dirname = path.dirname(__filename);
8+
59
dangerReassure({
610
inputFilePath: path.join(__dirname, './.reassure/output.md'),
711
});
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { dirname } from "path";
2+
import { fileURLToPath } from "url";
3+
import { FlatCompat } from "@eslint/eslintrc";
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = dirname(__filename);
7+
8+
const compat = new FlatCompat({
9+
baseDirectory: __dirname,
10+
});
11+
12+
const eslintConfig = [
13+
...compat.extends("next/core-web-vitals", "next/typescript"),
14+
];
15+
16+
export default eslintConfig;

examples/web-nextjs/jest.config.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/web-nextjs/jest.config.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type { Config } from 'jest'
2+
import nextJest from 'next/jest.js'
3+
4+
const createJestConfig = nextJest({
5+
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
6+
dir: './',
7+
})
8+
9+
// Add any custom config to be passed to Jest
10+
const config: Config = {
11+
coverageProvider: 'v8',
12+
testEnvironment: 'jsdom',
13+
// Add more setup options before each test is run
14+
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
15+
}
16+
17+
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
18+
export default createJestConfig(config)
File renamed without changes.

0 commit comments

Comments
 (0)