Issue or question about test CI
Hi @loic.huder
I have a problem fr the unit tests. When in the .env.test.local
file the I leave the MONGO_DB_URL to blank, example:
MONGO_DB_URL=
Then when I run npm test
I got:
(base) ale@lindemaria-laptop:~/Software/workspaces/icat/icat-plus$ npm test
> icat-plus@1.0.0 test /home/ale/Software/workspaces/icat/icat-plus
> ./node_modules/mocha/bin/mocha test --opts test/mocha.opts
(node:12048) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:12048) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
(node:12048) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
(node:12048) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
(node:12048) Warning: Accessing non-existent property 'getParameterTypes' of module exports inside circular dependency
TypeError: Cannot read property 'debug' of undefined
at /home/ale/Software/workspaces/icat/icat-plus/test/global.js:20:26
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:12048) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'debug' of undefined
at /home/ale/Software/workspaces/icat/icat-plus/test/global.js:35:26
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:12048) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:12048) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
That is exactly the same behaviour than in the server: https://gitlab.esrf.fr/icat/icat-plus/-/jobs/141151
What am I doing wrong? What is the value of MONGO_DB_URL in your file?
When I give a correct mongoDB (that I assume that it does not run with mongoUnit) then evething works fine:
MONGO_DB_URL="mongodb://localhost:27017/icatplus?authSource=admin"
Edited by Alejandro De Maria Antolinos