question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Testing documentation tutorial results in errors

See original GitHub issue

Hey all!

First of all, I’d like to say that I am very enthusiastic about the future of nexus and prisma. It’s been great fun learning these tools the past few weeks! I’ve started an attempt to write a test suite for an API I’m working on, following the tutorial on the nexus documentation site. https://nexusjs.org/docs/getting-started/tutorial/chapter-testing-your-api

However, two things arose as I was following this step:

  • The pm add command in the article npm add --save-dev jest @types/jest ts-jest graphql-request does not mention the get-port npm package which is later used in tests/__helpers.ts
  • After running my tests, jest gives the error message Jest did not exit one second after the test run has completed. This usually means that there are asynchronous operations that weren't stopped in your tests. and doesn’t terminate. Running with the --detectOpenHandles flag hides the warning message but jest still doesn’t terminate and shows no extra output.

Maybe a pointer towards the solution of the second issue: when I run a development server of the api on port 4000 and I have a test suite with only one test which I also run on port 4000, the warning is not displayed and jest exits as normal.

The project I’m working on is based on the code in this project from the prisma-examples repo: https://github.com/prisma/prisma-examples/tree/latest/typescript/subscriptions-pubsub.

I am not experienced with jest (or rather, software testing as a whole) and I would love some help. Is anyone else experiencing the same issue?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jasonkuhrtcommented, Dec 3, 2020

Pass the --forceExit flag to jest. I fixed a bunch of things in the tutorial tonight and updated https://github.com/graphql-nexus/tutorial. Hope it helps!

0reactions
shreyas44commented, Dec 4, 2020

@jasonkuhrt After further debugging I found the issue to be that the Prisma Client connection was never disconnected and hence prevented Jest from exiting. Although using --forceExit worked, it wasn’t a fix and it was just a workaround. I submitted a proper fix in graphql-nexus/tutorial#13. Let me know if you’re okay with it and I could probably update the docs in this repo accordingly 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test Documentation in Software Testing (Example) - Guru99
It is a complete suite of documents that allows you to describe and document test planning, test design, test execution, test results that...
Read more >
8. Analyze Test Results | TestComplete Documentation
The images help you understand what happened in the application during the run, and find errors faster.
Read more >
Software Testing Errors to look out for (with examples)
In this article, we discuss some common software testing errors that a tester should be aware of. These errors are explained with examples ......
Read more >
How to Write Test Cases: The Ultimate Guide with Examples
This in-depth hands-on tutorial on How to Write Test Cases covers the details of what a Test Case is along with its standard...
Read more >
Testing Documentation - Javatpoint
The bug report is a document where we maintain a summary of all the bugs which occurred during the testing process. This is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found