chore: switch existing tests to new next-test-helper library#629
chore: switch existing tests to new next-test-helper library#629bcoe wants to merge 1 commit intovercel:masterfrom
Conversation
| beforeAll(async () => { | ||
| app = await setup(dir, next) | ||
| }) | ||
| afterAll(async () => await teardown()) |
There was a problem hiding this comment.
👍 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.
beforeAll(() => setup(dir, next)) ?
| import next from '../dist/server/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.
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-helperthat we've been working on.follows on from: #461