-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing with mocha times out on failed assert #1676
Comments
@mrfitz42 This is a mocha error. To run a mocha test with any node-oracledb functionality, we usually use Please check our https://github.com/oracle/node-oracledb/blob/main/test/opts/.mocharc.yaml file to check the test configuration settings in mocha for the node-oracledb tests provided in this repo. The reason that hang might be happening, is because the connection is not explicitly closed, after the error is thrown and the program takes its time to close the connections. |
Running What do you mean by "the connection is not explicitly closed" when the test calls |
@mrfitz42 My apologies. On second look, I realise that We will look at it and let you know. |
I can see the As a workaround, can you use try/catch something like this? or just an if stmts
It still needs to be investigated if this is something related to mocha and async functions returning a promise.. |
If you are using old-style callbacks you cannot throw exceptions. You must always call the |
Well that's annoying. Is there any way of resolving the pending promise in the callback rather than wrapping try-catch around the asserts? If wrapping the asserts is the only way, I'll have to change about 1500 unit tests. |
I see some workarounds like this might help
or
|
Thank you very much. Adding |
Closing this as this is not a node-oracledb issue |
While unit testing legacy code which uses async and callbacks, no ESM or Promises, I noticed that many tests that failed an assert would hang and timeout rather that displaying the failure. Code has been upgraded to use the latest non-ESM-only package versions. I narrowed down the issue to tests that open a database connection.
I am not sure if this is a oracledb issue or a mocha issue, but I thought I would start here since the assert failure generates the following error message in node:
While mocha's timeout mentions:
database version: Oracle 19c Enterprise edition version 19.21.0.0.0
process.platform: 'linux'
process.version: 'v20.11.0'
process.arch: 'x64'
require('oracledb').versionString: '6.5.1'
require('oracledb').oracleClientVersionString: undefined
Hangs on failed assert()
The text was updated successfully, but these errors were encountered: