Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions examples/web-nextjs/.eslintrc.json

This file was deleted.

17 changes: 11 additions & 6 deletions examples/web-nextjs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage
Expand All @@ -24,9 +28,10 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local
# env files (can opt-in for committing if needed)
.env*

# vercel
.vercel
Expand All @@ -35,5 +40,5 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts

# Reassure
.reassure
# Reassure output directory
.reassure
8 changes: 4 additions & 4 deletions examples/web-nextjs/README-orig.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
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).
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).

## Getting Started

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

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

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
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.

## Learn More

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

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

## Deploy on Vercel

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.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
13 changes: 8 additions & 5 deletions examples/web-nextjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ This example showcases Reassure setup for Next.js web app.
1. Install following deps as `devDependencies` to setup basic Jest + React Testing Library setup:
* `jest`
* `jest-environment-jsdom`
* `@types/jest`
* `@testing-library/react`
* `@testing-library/dom`
* `@testing-library/jest-dom`
* `ts-node`
* `@types/jest`
* `@babel/preset-env`
* `@babel/preset-react`
* `@babel/preset-typescript`
2. Copy `jest.config.js` & `babel.config.js` from this repo for RTL tests to run
* `@babel/preset-typescript`
2. Copy `jest.config.ts` from this repo for RTL tests to run
3. Install `reassure` and `danger` as `devDependencies`
4. Run `yarn reassure init` to:
* generate `reassure-tests.sh` CI script
* generate `dangerfile.js` config for `danger`
* add `.reasure` entry to `.gitignore`
5. (optional) Add `configure({ testingLibrary: 'react' });` to your `jest-setup.js` file
* add `.reassure` entry to `.gitignore`
5. (optional) Add `configure({ testingLibrary: 'react' });` to your `jest.setup.ts` file
7 changes: 0 additions & 7 deletions examples/web-nextjs/babel.config.js

This file was deleted.

4 changes: 4 additions & 0 deletions examples/web-nextjs/dangerfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
/* eslint-disable import/no-extraneous-dependencies */
import path from 'path';
import { fileURLToPath } from "url";
import { dangerReassure } from 'reassure';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

dangerReassure({
inputFilePath: path.join(__dirname, './.reassure/output.md'),
});
16 changes: 16 additions & 0 deletions examples/web-nextjs/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname,
});

const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
];

export default eslintConfig;
4 changes: 0 additions & 4 deletions examples/web-nextjs/jest.config.js

This file was deleted.

18 changes: 18 additions & 0 deletions examples/web-nextjs/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { Config } from 'jest'
import nextJest from 'next/jest.js'

const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './',
})

// Add any custom config to be passed to Jest
const config: Config = {
coverageProvider: 'v8',
testEnvironment: 'jsdom',
// Add more setup options before each test is run
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
}

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
export default createJestConfig(config)
File renamed without changes.
4 changes: 0 additions & 4 deletions examples/web-nextjs/next.config.mjs

This file was deleted.

7 changes: 7 additions & 0 deletions examples/web-nextjs/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
/* config options here */
};

export default nextConfig;
39 changes: 19 additions & 20 deletions examples/web-nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
{
"name": "web-nextjs",
"description": "NextJS example setup with Reassure",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "jest"
},
"dependencies": {
"next": "14.2.3",
"react": "^18",
"react-dom": "^18"
"next": "15.3.2",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@babel/preset-env": "^7.24.5",
"@babel/preset-react": "^7.24.1",
"@babel/preset-typescript": "^7.24.1",
"@eslint/eslintrc": "^3",
"@tailwindcss/postcss": "^4",
"@testing-library/dom": "^10.4.0",
"@testing-library/react": "^16.0.0",
"@types/babel__preset-env": "^7",
"@types/jest": "^29.5.12",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0",
"@types/jest": "^29.5.14",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"danger": "^12.2.0",
"eslint": "^8",
"eslint-config-next": "14.2.3",
"@types/react": "^19",
"@types/react-dom": "^19",
"danger": "^13.0.4",
"eslint": "^9",
"eslint-config-next": "15.3.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"postcss": "^8",
"reassure": "^1.3.2",
"tailwindcss": "^3.4.1",
"reassure": "^1.4.0",
"tailwindcss": "^4",
"ts-node": "^10.9.2",
"typescript": "^5"
}
},
"packageManager": "[email protected]"
}
5 changes: 1 addition & 4 deletions examples/web-nextjs/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
tailwindcss: {},
},
plugins: ["@tailwindcss/postcss"],
};

export default config;
1 change: 1 addition & 0 deletions examples/web-nextjs/public/file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/web-nextjs/public/globe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/web-nextjs/public/vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/web-nextjs/public/window.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 15 additions & 22 deletions examples/web-nextjs/src/app/globals.css
Original file line number Diff line number Diff line change
@@ -1,33 +1,26 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@import "tailwindcss";

:root {
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
--background: #ffffff;
--foreground: #171717;
}

@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--font-sans: var(--font-geist-sans);
--font-mono: var(--font-geist-mono);
}

@media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;
--background: #0a0a0a;
--foreground: #ededed;
}
}

body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
}

@layer utilities {
.text-balance {
text-wrap: balance;
}
background: var(--background);
color: var(--foreground);
font-family: Arial, Helvetica, sans-serif;
}
18 changes: 15 additions & 3 deletions examples/web-nextjs/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";

const inter = Inter({ subsets: ["latin"] });
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});

const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});

export const metadata: Metadata = {
title: "Create Next App",
Expand All @@ -16,7 +24,11 @@ export default function RootLayout({
}>) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
</body>
</html>
);
}
Loading