Skip to content

Commit 38f879b

Browse files
authored
Merge pull request #6 from warizz/bump-dependencies-main
2 parents f02c503 + cdbb045 commit 38f879b

File tree

14 files changed

+2519
-4828
lines changed

14 files changed

+2519
-4828
lines changed

.nycrc.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"extension": [".js", ".jsx", ".ts", ".tsx"],
3-
"extends": "@istanbuljs/nyc-config-typescript",
43
"include": ["pages/**/*"],
54
"exclude": ["pages/api/__coverage__.js"],
65
"all": true,

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
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) for the express purpose of demonstrating Next.js, TypeScript, and Cypress working together with working coverage reports.
22

3+
## Older Versions
4+
5+
You can see an example that should work with any combination of Next.js 9 thru 12 and Cypress 5 thru 9
6+
[here](https://github.com/kylemh/next-ts-with-cypress-coverage/tree/next9thru12-and-cypress5thru9).
7+
8+
## Contributing
9+
10+
Instructions on how to get started with this repo are below. Contributions we would love to receive:
11+
12+
- An example without Babel. This would use the
13+
[SWC Coverage Plugin](https://github.com/kwonoj/swc-plugin-coverage-instrument). The current examples all have a
14+
slower build, slower dev server, and slower hot reload than Next.js applications that DONT use Babel.
15+
- An example using [Next.js's App Directory](https://beta.nextjs.org/docs/getting-started) and providing coverage for
16+
server components.
17+
- Use GitHub Actions to prove that coverage is outputting so that people can freely contribute without manual review on
18+
their branch.
19+
320
## Getting Started
421

522
First, run the development server:
@@ -20,6 +37,9 @@ npm run cypress open
2037
yarn cypress open
2138
```
2239

23-
## The Proof!
40+
## The Proof
41+
42+
To see coverage, `yarn build && yarn start` followed with a separate `yarn cypress run`.
43+
Once finished, `yarn see-cy-coverage`.
2444

25-
![Screenshot of coverage report](./coverage_screenshot.png)
45+
![Screenshot of coverage report](./coverage_screenshot_next13.png)

coverage_screenshot_next13.png

147 KB
Loading

cypress.config.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { defineConfig } from 'cypress';
2+
3+
export default defineConfig({
4+
env: {
5+
codeCoverage: {
6+
url: '/api/__coverage__',
7+
},
8+
},
9+
10+
e2e: {
11+
baseUrl: 'http://localhost:3000/',
12+
supportFile: 'cypress/support/e2e.ts',
13+
setupNodeEvents(on, config) {
14+
require('@cypress/code-coverage/task')(on, config);
15+
return config;
16+
},
17+
},
18+
});

cypress.json

Lines changed: 0 additions & 9 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

cypress/plugins/index.ts

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

cypress/support/e2e.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// ***********************************************************
2+
// This example support/e2e.ts is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands';
18+
import '@cypress/code-coverage/support';
19+
20+
// Alternatively you can use CommonJS syntax:
21+
// require('./commands')

next-env.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
/// <reference types="next" />
2-
/// <reference types="next/types/global" />
2+
/// <reference types="next/image-types/global" />
3+
4+
// NOTE: This file should not be edited
5+
// see https://nextjs.org/docs/basic-features/typescript for more information.

0 commit comments

Comments
 (0)