I am trying to deploy my loopback app with CI, and jest does not exit, and as a result CI cannot continue. Same thing happens on my locale if I stop the database container.My tests are not running against db, but I think when jest boots up the app, it tries to connect, and I tried to catch and close the connection but it did not help. Here is the output from jest tests.
Test Suites: 3 passed, 3 total
Tests: 13 passed, 13 total
Snapshots: 0 total
Time: 6.304s
Ran all test suites.
● Cannot log after tests are done. Did you forget to wait for something async in your test?
Attempted to log "Connection fails: Error: connect ECONNREFUSED 127.0.0.1:5432
It will be retried for the next request.".
at BufferedConsole.error (node_modules/jest-util/build/BufferedConsole.js:136:10)
at msg (node_modules/strong-globalize/lib/globalize.js:245:13)
at packMessage (node_modules/strong-globalize/lib/globalize.js:227:16)
at Object.rfc5424 (node_modules/strong-globalize/lib/globalize.js:242:12)
at StrongGlobalize.error (node_modules/strong-globalize/lib/strong-globalize.js:163:26)
at DataSource.postInit (node_modules/loopback-datasource-juggler/lib/datasource.js:479:13)
at PendingItem.callback (node_modules/loopback-connector-postgresql/lib/postgresql.js:103:17)
at client.connect (node_modules/pg-pool/index.js:248:23)
at Connection.connectingErrorHandler (node_modules/pg/lib/client.js:140:14)
error: uncaughtException: connect ECONNREFUSED 127.0.0.1:5432 date=Fri Feb 22 2019 20:54:31 GMT+0300 (+03), pid=86092, uid=501, gid=20, cwd=/Users/hazimdikenli/workspace/ATEZ-BTD/app, execPath=/Users/hazimdikenli/.nvm/versions/node/v8.11.3/bin/node, version=v8.11.3, argv=[/Users/hazimdikenli/.nvm/versions/node/v8.11.3/bin/node, /Users/hazimdikenli/workspace/ATEZ-BTD/app/node_modules/jest-worker/build/workers/processChild.js], rss=237056000, heapTotal=201125888, heapUsed=157644632, external=419986, loadavg=[3.91162109375, 3.453125, 3.39453125], uptime=3318870, trace=[column=11, file=util.js, function=Object._errnoException, line=992, method=_errnoException, native=false, column=20, file=util.js, function=_exceptionWithHostPort, line=1014, method=null, native=false, column=14, file=net.js, function=TCPConnectWrap.afterConnect [as oncomplete], line=1186, method=afterConnect [as oncomplete], native=false], stack=[Error: connect ECONNREFUSED 127.0.0.1:5432, at Object._errnoException (util.js:992:11), at _exceptionWithHostPort (util.js:1014:20), at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)]
● process.exit called with "1"
at gracefulExit (node_modules/winston/lib/winston/logger.js:660:15)
at done (node_modules/winston/node_modules/async/lib/async.js:167:19)
at node_modules/winston/node_modules/async/lib/async.js:40:16
at Object.<anonymous>.exports.Console.onComplete (node_modules/winston/lib/winston/transports/transport.js:128:7)
at Object.<anonymous>.exports.Console.Object.<anonymous>.Console.log (node_modules/winston/lib/winston/transports/console.js:128:8)
at Object.<anonymous>.exports.Console.Object.<anonymous>.Transport.logException (node_modules/winston/lib/winston/transports/transport.js:134:8)
at logAndWait (node_modules/winston/lib/winston/logger.js:649:15)
My tests are not running against db, but I think when jest boots up the app, it tries to connect, and I tried to catch and close the connection but it did not help. I think this is happening when the app boots up by jest.So how can I catch this, or make the jest exit with success. Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire