Testing loopback 3 with jest and supertest does not exit gracefullysupertest nodejs test get callMake Jest ignore the .less import when testingJest: Error: Your test suite must contain at least one testMissing module when running Jest tests with ArangodbUnable to send authenticated request in tests using Jest, Supertest, Passport, Koa2Jest + supertest in NodeJS, async/awaitNode Supertest with Mocha: Uncaught Error: read ECONNRESETJest has detected the following 1 open handle potentially keeping Jest from exitingTesting a file upload with jestHow to print the request and response when a test fails in Jest?

What happens if you do emergency landing on a US base in middle of the ocean?

How to supress loops in a digraph?

Initialize an std::array algorithmically at compile time

Avoiding cliches when writing gods

Working in the USA for living expenses only; allowed on VWP?

Opposite of "Squeaky wheel gets the grease"

How to skip replacing first occurrence of a character in each line?

Responsibility for visa checking

How can Iron Man's suit withstand this?

Convert camelCase and PascalCase to Title Case

Aligning system of equations with zero coefficients

What do we gain with higher order logics?

How to make a setting relevant?

Pros and cons of writing a book review?

What can plausibly explain many of my very long and low-tech bridges?

When writing an error prompt, should we end the sentence with a exclamation mark or a dot?

What are they doing to this rocket following it's test fire?

What makes linear regression with polynomial features curvy?

How do I write "Show, Don't Tell" as an Asperger

Can a magnetic field of an object be stronger than its gravity?

Movie where a boy is transported into the future by an alien spaceship

What's the correct term for a waitress in the Middle Ages?

How could a possessed body begin to rot and decay while it is still alive?

Short story written from alien perspective with this line: "It's too bright to look at, so they don't"



Testing loopback 3 with jest and supertest does not exit gracefully


supertest nodejs test get callMake Jest ignore the .less import when testingJest: Error: Your test suite must contain at least one testMissing module when running Jest tests with ArangodbUnable to send authenticated request in tests using Jest, Supertest, Passport, Koa2Jest + supertest in NodeJS, async/awaitNode Supertest with Mocha: Uncaught Error: read ECONNRESETJest has detected the following 1 open handle potentially keeping Jest from exitingTesting a file upload with jestHow to print the request and response when a test fails in Jest?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am trying to build a test using Jest and Supertest for my loopback 3 rest API server. The test is running, but Jest did not exit gracefully.



This is my test script branch.test.js:



const app = require('../server/server');
const request = require('supertest');

describe('Test the root path', () =>
afterAll(done =>
app.close(done);
);

test('It should response the GET method', async () =>
const response = await request(app).get('/api/branches');
expect(response.statusCode).toBe(200);
);
)


And package.json for test setting




"scripts":
"lint": "eslint .",
"start": "node .",
"posttest": "npm run lint",
"test": "jest --detectOpenHandles"
,
"jest":
"testEnvironment": "node"




Every time I run npm run test, the log always return:




Jest has detected the following 1 open handle potentially keeping Jest
from exiting:

● TCPWRAP

11 |

12 | test('It should response the GET method', async () => );

16 | })

at Test.Object..Test.serverAddress
(node_modules/supertest/lib/test.js:59:33)

at new Test (node_modules/supertest/lib/test.js:36:12)

at Object.obj.(anonymous function) [as get]
(node_modules/supertest/index.js:25:14)

at Object.get (test/unit/branch.test.js:13:45)




the log is pointing at get function. People in forum use jest --forceExit, but it is not the way I want. Are there any solutions for this problem? Thanks for the response










share|improve this question




























    0















    I am trying to build a test using Jest and Supertest for my loopback 3 rest API server. The test is running, but Jest did not exit gracefully.



    This is my test script branch.test.js:



    const app = require('../server/server');
    const request = require('supertest');

    describe('Test the root path', () =>
    afterAll(done =>
    app.close(done);
    );

    test('It should response the GET method', async () =>
    const response = await request(app).get('/api/branches');
    expect(response.statusCode).toBe(200);
    );
    )


    And package.json for test setting




    "scripts":
    "lint": "eslint .",
    "start": "node .",
    "posttest": "npm run lint",
    "test": "jest --detectOpenHandles"
    ,
    "jest":
    "testEnvironment": "node"




    Every time I run npm run test, the log always return:




    Jest has detected the following 1 open handle potentially keeping Jest
    from exiting:

    ● TCPWRAP

    11 |

    12 | test('It should response the GET method', async () => );

    16 | })

    at Test.Object..Test.serverAddress
    (node_modules/supertest/lib/test.js:59:33)

    at new Test (node_modules/supertest/lib/test.js:36:12)

    at Object.obj.(anonymous function) [as get]
    (node_modules/supertest/index.js:25:14)

    at Object.get (test/unit/branch.test.js:13:45)




    the log is pointing at get function. People in forum use jest --forceExit, but it is not the way I want. Are there any solutions for this problem? Thanks for the response










    share|improve this question
























      0












      0








      0








      I am trying to build a test using Jest and Supertest for my loopback 3 rest API server. The test is running, but Jest did not exit gracefully.



      This is my test script branch.test.js:



      const app = require('../server/server');
      const request = require('supertest');

      describe('Test the root path', () =>
      afterAll(done =>
      app.close(done);
      );

      test('It should response the GET method', async () =>
      const response = await request(app).get('/api/branches');
      expect(response.statusCode).toBe(200);
      );
      )


      And package.json for test setting




      "scripts":
      "lint": "eslint .",
      "start": "node .",
      "posttest": "npm run lint",
      "test": "jest --detectOpenHandles"
      ,
      "jest":
      "testEnvironment": "node"




      Every time I run npm run test, the log always return:




      Jest has detected the following 1 open handle potentially keeping Jest
      from exiting:

      ● TCPWRAP

      11 |

      12 | test('It should response the GET method', async () => );

      16 | })

      at Test.Object..Test.serverAddress
      (node_modules/supertest/lib/test.js:59:33)

      at new Test (node_modules/supertest/lib/test.js:36:12)

      at Object.obj.(anonymous function) [as get]
      (node_modules/supertest/index.js:25:14)

      at Object.get (test/unit/branch.test.js:13:45)




      the log is pointing at get function. People in forum use jest --forceExit, but it is not the way I want. Are there any solutions for this problem? Thanks for the response










      share|improve this question














      I am trying to build a test using Jest and Supertest for my loopback 3 rest API server. The test is running, but Jest did not exit gracefully.



      This is my test script branch.test.js:



      const app = require('../server/server');
      const request = require('supertest');

      describe('Test the root path', () =>
      afterAll(done =>
      app.close(done);
      );

      test('It should response the GET method', async () =>
      const response = await request(app).get('/api/branches');
      expect(response.statusCode).toBe(200);
      );
      )


      And package.json for test setting




      "scripts":
      "lint": "eslint .",
      "start": "node .",
      "posttest": "npm run lint",
      "test": "jest --detectOpenHandles"
      ,
      "jest":
      "testEnvironment": "node"




      Every time I run npm run test, the log always return:




      Jest has detected the following 1 open handle potentially keeping Jest
      from exiting:

      ● TCPWRAP

      11 |

      12 | test('It should response the GET method', async () => );

      16 | })

      at Test.Object..Test.serverAddress
      (node_modules/supertest/lib/test.js:59:33)

      at new Test (node_modules/supertest/lib/test.js:36:12)

      at Object.obj.(anonymous function) [as get]
      (node_modules/supertest/index.js:25:14)

      at Object.get (test/unit/branch.test.js:13:45)




      the log is pointing at get function. People in forum use jest --forceExit, but it is not the way I want. Are there any solutions for this problem? Thanks for the response







      node.js testing jestjs loopbackjs supertest






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 24 at 13:35









      bublehbubleh

      288311




      288311






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55324359%2ftesting-loopback-3-with-jest-and-supertest-does-not-exit-gracefully%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55324359%2ftesting-loopback-3-with-jest-and-supertest-does-not-exit-gracefully%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          위키백과:대문 둘러보기 메뉴기부 안내모바일판 대문크리에이티브 커먼즈 저작자표시-동일조건변경허락 3.0CebuanoDeutschEnglishEspañolFrançaisItaliano日本語NederlandsPolskiPortuguêsРусскийSvenskaTiếng ViệtWinaray中文العربيةCatalàفارسیSrpskiУкраїнськаБългарскиНохчийнČeštinaDanskEsperantoEuskaraSuomiעבריתMagyarՀայերենBahasa IndonesiaҚазақшаBaso MinangkabauBahasa MelayuBân-lâm-gúNorskRomânăSrpskohrvatskiSlovenčinaTürkçe

          용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh