My stack:
- Fastify
- Apollo
- Vitest
I am trying to add e2e tests for my GraphQL resolvers. This means using the testing module and importing AppModule, which essentially starts the whole app.
I have custom scalars which causes an error when running tests with the testing module.
I created a new Nest project, installed Fastify, GraphQL using Apollo, and Vitest. I have a single GraphQL query called test which returns the custom scalar.
Running the app works as expected. The test (which just checks if app is defined) fails with the log below. If I remove the custom scalar and just use a String instead, it works as expected.
What can I do to make this work?
As a side note, using vitest 3.2.0 or newer errors with ERR_REQUIRE_ESM, so I have to use 3.1.4 unless there is something I don't know I can do to fix that.