Npm test db-connection failed

npm test -t db-connection is failed.
Connection is working from mongo shell and compass but not from npm.

I tried below 2 options:

Second try as:

error :

server@1.0.0 test C:\Program Files\nodejs\mflix-js
jest --passWithNoTests “db-connection”

npm ERR! Test failed. See above for more details.

Is there any way we can see what was above?

I suspect you are not calling npm from the appropriate directory.

This is my directory structure :
Volume in drive C is Windows

Directory of C:\mflix-js

02/28/2020 07:28 AM .
02/28/2020 07:28 AM …
02/28/2020 07:25 AM 927 .babelrc
02/28/2020 07:28 AM 328 .env
02/28/2020 07:25 AM 172 .eslintrc
02/28/2020 07:25 AM 150 .prettierrc
02/28/2020 07:25 AM build
02/28/2020 07:25 AM 300 dotenv_unix
02/28/2020 07:25 AM 99 index.js
02/28/2020 07:25 AM 162 jest.config.js
02/28/2020 07:25 AM mflix
02/28/2020 07:25 AM 554,209 package-lock.json
02/28/2020 07:25 AM 2,815 package.json
02/28/2020 07:25 AM 11,819 README.rst
02/28/2020 07:25 AM src
02/28/2020 07:25 AM test
10 File(s) 570,981 bytes
6 Dir(s) 64,641,622,016 bytes free

I am running from same directory as :
C:\mflix-js>npm test -t db-connection
‘CALL “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” prefix -g’ is not recognized as an internal or external command,
operable program or batch file.

server@1.0.0 test C:\mflix-js
jest --passWithNoTests “db-connection”

npm ERR! Test failed. See above for more details.

The first thing I would check is the version of node as this looks like an installation issue.

By setting and changing multiple things on my PC, I am able to ;npm install’ and ‘npm start’.

‘npm test db-connection’ is still failing, looking into this, if you already know some solution, let me know - thanks.

PS C:\mflix-js> npm test -t connection-pooling

server@1.0.0 test C:\mflix-js
jest --passWithNoTests “connection-pooling”

Determining test suites to run…Browserslist: caniuse-lite is outdated. Please run next command npm update
Setup Mongo Connection
(node:8852) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to MongoClient.connect.
FAIL test/connection-pooling.test.js
Connection Pooling
× Connection pool size is 50 (206ms)

● Connection Pooling › Connection pool size is 50

expect(received).toBe(expected) // equality

Expected: 50
Received: undefined

   8 |   test("Connection pool size is 50", async () => {
   9 |     const response = await MoviesDAO.getConfiguration()
> 10 |     expect(response.poolSize).toBe(50)
     |                               ^
  11 |   })
  12 | })
  13 |

  at toBe (test/connection-pooling.test.js:10:31)
  at tryCatch (node_modules/regenerator-runtime/runtime.js:45:40)
  at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:271:22)
  at Generator.prototype.<computed> [as next] (node_modules/regenerator-runtime/runtime.js:97:21)
  at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
  at _next (node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)

Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 6.316s
Ran all test suites matching /connection-pooling/i.
Teardown Mongo Connection
npm ERR! Test failed. See above for more details.

Did you try what was proposed in the output you provided?

It also looks like you are ahead of what you are supposed to do. The test connection-pooling is chapter 4. From the error I suspect that you were not able to run any test yet. You should pass the test db-connection, as tried in your first post, before continuing.

ahhhh…my bad.
I ran “npm test -t connection-pooling” instead of “npm test -t db-connection”.
My db-connection is working fine now