adobe/aio-tvm

jest@29 surfaces new errors for async operations that weren't stopped

Closed this issue · 1 comments

Jest@29 detects asynchronous operations that weren't stopped, resulting in test errors: see PRs #70 and #71

Errors:

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. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.

  ●  Cannot log after tests are done. Did you forget to wait for something async in your test?
    Attempted to log "metricsURL not set, batchedMetrics still present".

      at console.log (node_modules/@jest/console/build/CustomConsole.js:141:10)
      at Timeout.processBatchCounter [as _onTimeout] (node_modules/@adobe/aio-metrics-client/src/index.js:34:13)


  ●  Cannot log after tests are done. Did you forget to wait for something async in your test?
    Attempted to log "metricsURL not set, batchedMetrics still present".

      at console.log (node_modules/@jest/console/build/CustomConsole.js:141:10)
      at Timeout.processBatchCounter [as _onTimeout] (node_modules/@adobe/aio-metrics-client/src/index.js:34:13)


  ●  Cannot log after tests are done. Did you forget to wait for something async in your test?
    Attempted to log "metricsURL not set, batchedMetrics still present".

      at console.log (node_modules/@jest/console/build/CustomConsole.js:141:10)
      at Timeout.processBatchCounter [as _onTimeout] (node_modules/@adobe/aio-metrics-client/src/index.js:34:13)


  ●  Cannot log after tests are done. Did you forget to wait for something async in your test?
    Attempted to log "metricsURL not set, batchedMetrics still present".

      at console.log (node_modules/@jest/console/build/CustomConsole.js:141:10)
      at Timeout.processBatchCounter [as _onTimeout] (node_modules/@adobe/aio-metrics-client/src/index.js:34:13)

The fix is to add jest.mock('@adobe/aio-metrics-client') in the affected test code.