-
Notifications
You must be signed in to change notification settings - Fork 160
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
Supertest: getTestServer Not Found #594
Comments
Hey, Can you share your tsconfig.json? |
Sure thing: tsconfig.json
I tried adding: |
Thanks, can you try setting moduleResolution to |
When I did that the terminal threw an error saying: "error TS5110: Option 'module' must be set to 'NodeNext' when option 'moduleResolution' is set to 'NodeNext'." I did that and got it to compile correctly, but then my test threw a jest configuration error" FAIL tests/endpoints.spec.ts
I tried adjusting jest.config.js and that didn't work either. Can you help me understand why I need to adjust the tsconfig, when I'm importing other @google-cloud/functions-framework functions like: import { cloudEvent } from '@google-cloud/functions-framework'. That works fine without adjusting my tsconfig from what it was. Thanks |
@kenneth-rosario I was able to access the getTestServer function via this assignment: I then did a little inspection of what was being returned via these three statements: console.log(typeof getTestServer, 'getTestServer typeof') And the output: console.log
console.log
FAIL src/api/eventHandler/event.controller.spec.ts
Not what I was expecting from the instructions in the documentation. Our API application is a microservice with a small express app wrapped in a cloud function. Our approach is working great, I am just having trouble calling GCP services when trying to run integration tests using supertest test runner. Any insight would be helpful. Thank you. |
Hey @adamkpurdy can you provide a very minimal reproduction repo I can use to poke around? Not sure if https://github.com/GoogleCloudPlatform/functions-framework-nodejs/blob/main/docs/typescript.md might be of help as well. |
@kenneth-rosario Thanks for your help on this. Looks like its a TypeScript issue. When I goto test this in a basic javascript file, it works as expected, but when I changed it into a ts file I get the issue. I know we tried adjusting the tscofig, but that doesn't seem to work. Here is my basic file. |
Hello and to whom it may concern.
I am trying to work with the implementation of getTestServer in Supertest documentation, and when I try to instantiate my test server I get this error:
@google-cloud/functions-framework is installed as a dependency of this project so my assumption would have been that this should be available in the import.
I've Googled a few things and I've tried updating my tsconfig, but nothing seems to work.
Thanks ahead.
The text was updated successfully, but these errors were encountered: