[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
All the e2e tests get 404 error when fastify.
The test should work as expected.
Create base project with fasfify adapter, and add it to tests too:
app = module.createNestApplication(new FastifyAdapter());
The tests can run with express and the app with fastify but I think is a good point to test with the same adapter that the app will use.
Nest version: 6.0.2
For Tooling issues:
- Node version: v11.12.0
- Platform: Mac
Others:
yarn 1.15.2
npm 6.4.1
Please, provide a minimal repository which reproduces your issue.
Just run yarn
and then npm test
I have the same problem:
https://github.com/yostools/nest-fastify-example
Fastify mounts routes on listen()
call which means that init()
is not enough. With fastify you basically don't have to use supertest
at all, simply simulate request instead using inject()
method, see example here: https://github.com/nestjs/nest/blob/master/integration/hello-world/e2e/fastify-adapter.spec.ts. I have to clarify this in the documentation
@kamilmysliwiec your recommendation implies change all tests, to use supertest you only need to put await app.getHttpAdapter().getInstance().ready();
after call await app.init()
... Check this file https://gitlab.com/gperdomor/todo-backend-nestjs/blob/master/test/app.e2e-spec.ts
@yostools @xavi-dev FYI
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
@kamilmysliwiec your recommendation implies change all tests, to use supertest you only need to put
await app.getHttpAdapter().getInstance().ready();
after callawait app.init()
... Check this file https://gitlab.com/gperdomor/todo-backend-nestjs/blob/master/test/app.e2e-spec.ts@yostools @xavi-dev FYI