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.

Specs got stuck in the end

See original GitHub issue

I’m using superagent-mock to mock my requests and, even returning the correct result and the tests are passing, after all specs are done, the suite got stuck and release after 60s (probably a timeout).

Disabling superagent-mock makes all the specs to pass (hitting the real server), and the suite finishes instantly.

Below is my spec:

  describe('search triggers', () => {
    const mockObj = superagentMock(request, rules)

    describe('city search', () => {
      beforeEach(() => triggerSearchByCity())

      it('should update the state', () => {

And my mock setup rules:

 rules= [{
    pattern: '*)',

    fixtures: function (match, params, headers, context) {
      // City search mock
      if (match[1] === '?q=Berlin%2CDE&units=metric&APPID=[MY APP ID]') {
        return cityResponse

    get: function (match, data) {
      return {
        body: data

And my superagent call:

  return new Promise((resolve, reject) => {
        q: `Berlin,DE`,
        units: 'metric',
        APPID: '[My APP ID]'
      .end((err, res) => {
        if (err) { reject (err)      }
        else     { resolve(res.body) }

The promise above is resolved in the triggerSearchByCity() method.

UPDATE: Here’s another simpler setup that causes the same problem:


Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

daldridge-cscommented, Aug 8, 2018

I had the same issue, and switched to superagent-mocker, which handles superagent’s RequestBase::then() correctly. Tests that hung Mocha with superagent-mock, no longer hung when using superagent-mocker (tests stayed exactly the same, only the before/after hooks were modified to use the other mocking library).

y-nkcommented, Jun 21, 2021

@fdubost not sure why issue is closed. it’s still happening.

i’ve pinpointed to this particular moment where the setTimeout is never called ; but not sure why. It’d be great to fix it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Specs got stuck in the end · Issue #69 - GitHub
I'm using superagent-mock to mock my requests and, even returning the correct result and the tests are passing, after all specs are done, ......
Read more >
How to Remove A Speck From Your Eye: 7 Simple Tips
1. Make your eye water. When there is a speck in your eye, the best and most natural way to get a speck...
Read more >
What Should I Do If Something Is Stuck In My Eye
The first thing to remember when something gets into your eye is to not rub your eye. That's because rubbing may lead to...
Read more >
Why does my hair get stuck on my glasses end piece ... - Quora
Heat the temples under hot water or a hair dryer and bend them yourself - If you don't know what type of plastic...
Read more >
Cocoapods setup stuck on pod setup command on terminal
So I checked the size of ~/.cocoapods directory to ensure it was still cloning. The size has increased to ~100Mb in the end....
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 Post

No results found

github_iconTop Related Hashnode Post

No results found