-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Jest examples and docs #31633
Merged
Merged
Changes from 30 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
39e4144
Rename with-jest-babel example
delbaoliveira 04c45b5
Update README.md
delbaoliveira c1c0988
Update jest.config.js for new example
delbaoliveira 67f2630
Fix line break
delbaoliveira 026ba23
Delete mocks for SWC example
delbaoliveira bc38c13
Add Jest docs link
delbaoliveira b604725
Remove unused package and update Jest
delbaoliveira 9bcddd4
Update docs
delbaoliveira cecfd40
Update comments
delbaoliveira b713491
Merge branch 'canary' into update-jest-example
delbaoliveira 7b362b1
Update testing.md
delbaoliveira b8a4c3b
Clarify opt out sentence
delbaoliveira 6ff455d
Update docs/testing.md
timneutkens fba9e83
Update docs/testing.md
delbaoliveira bb6ee1d
Update docs/testing.md
delbaoliveira deec8d0
Update docs/testing.md
delbaoliveira 5723fe8
Update docs/testing.md
delbaoliveira 2368ef5
Update docs/testing.md
delbaoliveira 2a21d19
Update docs/testing.md
delbaoliveira 39de36e
Update docs/testing.md
delbaoliveira 9fec0a6
Change SWC to Rust Compiler and link to docs
delbaoliveira 782a49d
Update docs/testing.md
delbaoliveira 619ddce
Merge branch 'canary' into update-jest-example
delbaoliveira 79f33c5
Add footer to with-jest example
delbaoliveira 93bec37
Update snapshot
delbaoliveira 5358520
Add footer to with-jest-babel example
delbaoliveira cbafca0
Update snapshot
delbaoliveira 53bdb3f
Merge branch 'update-jest-example' of https://github.com/delbaoliveir…
delbaoliveira 3968e9a
Add summary at the start of Jest section
delbaoliveira b581186
Merge branch 'canary' into update-jest-example
delbaoliveira e6de54f
Apply suggestions from code review
leerob b207f22
Merge branch 'canary' into update-jest-example
leerob File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"root": true, | ||
"extends": ["next/core-web-vitals"], | ||
"plugins": ["testing-library"], | ||
"overrides": [ | ||
// Only uses Testing Library lint rules in test files | ||
{ | ||
"files": [ | ||
"**/__tests__/**/*.[jt]s?(x)", | ||
"**/?(*.)+(spec|test).[jt]s?(x)" | ||
], | ||
"extends": ["plugin:testing-library/react"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# vercel | ||
.vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Next.js + Jest | ||
|
||
This example shows how to configure Jest to work with Next.js and Babel. Since the release of Next.js 12, Next.js has in-built configuration for Jest with SWC. See the [with-jest](https://github.com/vercel/next.js/tree/canary/examples/with-jest) example for the latest implementation. | ||
|
||
This includes Next.js' built-in support for Global CSS, CSS Modules, and TypeScript! | ||
|
||
## How to Use | ||
|
||
Quickly get started using [Create Next App](https://github.com/vercel/next.js/tree/canary/packages/create-next-app#readme)! | ||
|
||
In your terminal, run the following command: | ||
|
||
```bash | ||
npx create-next-app --example with-jest with-jest-app | ||
# or | ||
yarn create next-app --example with-jest with-jest-app | ||
``` | ||
|
||
## Run Jest Tests | ||
|
||
```bash | ||
npm test | ||
``` |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if I'm being pedantic here, what are your thoughts on converting this into steps, using the same heading titles?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you expand on what you mean here? 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry. I just mean, would It be clearer for us to explain the QuickStart as a set of steps:
This may not be the case here. I don't have a hard and fast rule on this, I just think it makes skimming content easier, you can drop in a a step if need etc.. I don't think this fits in all cases, was wondering what your thoughts are with this section.
I quite like how you have done it tbh, just raising the question.☺️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thank you! I agree with you, it's good to give people context at the start. As you said, I'm not sure how the steps would fit this case, but I've added a quick summary here. wdyt?