TypeError: Class constructor NodeEnvironment cannot be invoked without 'new'

PS E:\MongoDB-University\MongoDB-JavaScript-Developer\mflix-js>  node -v
v17.7.0
PS E:\MongoDB-University\MongoDB-JavaScript-Developer\mflix-js> npm -v
8.5.3
PS E:\MongoDB-University\MongoDB-JavaScript-Developer\mflix-js> npm test -t db-connection

> server@1.0.0 test
> jest --passWithNoTests "db-connection"

Determining test suites to run...Setup Mongo Connection
 FAIL  test/db-connection.test.js
  ● Test suite failed to run

    TypeError: Class constructor NodeEnvironment cannot be invoked without 'new'



      at new MongoEnvironment (test/config/mongoEnvironment.js:30:113)
      at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:333:13)
      at async runJest (node_modules/@jest/core/build/runJest.js:404:19)
      at async _run10000 (node_modules/@jest/core/build/cli/index.js:320:7)
      at async runCLI (node_modules/@jest/core/build/cli/index.js:173:3)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.279 s
Ran all test suites matching /db-connection/i.
Teardown Mongo Connection
(node:17468) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:17468) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
(node:17468) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
(node:17468) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
PS E:\MongoDB-University\MongoDB-JavaScript-Developer\mflix-js>

i’m facing same issue…did you have solve this error??

Hi @Gene_Gallant & @Deepak_Kumar_Sharma , welcome to the community.
I tried to reproduce this error by installing the same node and npm version as yours. But I was able to run the tests easily. Can you please make sure that your connection string is correct and valid?

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

Thanks for your time and consideration… What I failed to do was to ensure that the .env file was in its proper directory… something so simple yet so troublesome… Thanks again…