-
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
chore: switch existing tests to new next-test-helper library #629
Conversation
beforeAll(async () => { | ||
app = await setup(dir, next) | ||
}) | ||
afterAll(async () => await teardown()) |
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.
afterAll(teardown)
?
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.
👍 wasn't sure if Jest was smart enough to detect that the teardown
was async
/await
I'll give this a try.
beforeAll(() => app.prepare()) | ||
|
||
afterAll(() => app.close()) | ||
beforeAll(async () => { |
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.
beforeAll(() => setup(dir, next))
?
import pkg from '../package.json' | ||
import next from '../dist/server/next' | ||
import {expectElement, setup, render, teardown} from 'next-test-helper' |
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 hope we need to expose some low level helpers rather these generic helpers.
For an example, here are few cases:
- Get the programmatic API
- Run an app by giving the path
- Get a random available port
There are many ways, we could write tests. It's depend on test case to case.
Specially with Next.js integration tests, it gets so crazy. Sometimes, we may need to do npm install
.
Why do we create another repo for this? Just like that, I think we could expose this test helper. |
@arunoda is this superseded by the other PR ? |
This introduce a set of helpers. They seems like testing meta helpers like So, we could use them easily with any testing service and no information is hidden. I have introduced a set of helpers like that in the other PR. |
So, for next.js core, the higher level the tests (HTTP), the better. I'll close this for now. |
switches next.js itself to using the new test helping library
next-test-helper
that we've been working on.follows on from: #461