Fix crashing tests #3

Closed
opened 4 months ago by inga-lovinde · 0 comments
Owner

npm run test fails with

 FAIL  src/transaction/transaction.controller.spec.ts
  ● Test suite failed to run

    Jest worker encountered 4 child process exceptions, exceeding retry limit

      at ChildProcessWorker.initialize (../node_modules/jest-worker/build/workers/ChildProcessWorker.js:185:21)

Test Suites: 1 failed, 2 passed, 3 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        11.852 s
Ran all test suites.

There are also following messages in output:

Node.js v18.18.2
/home/inga/projects/test-assignment-payments/src/transaction/transaction.controller.spec.ts:20
                insertOne: jest.fn(() => Promise.reject(new Error("DatabaseNotReachable"))),
                                                        ^

Error: DatabaseNotReachable
    at Object.<anonymous> (/home/inga/projects/test-assignment-payments/src/transaction/transaction.controller.spec.ts:19:49)
    at /home/inga/projects/test-assignment-payments/node_modules/jest-mock/build/index.js:449:39
    at Object.<anonymous> (/home/inga/projects/test-assignment-payments/node_modules/jest-mock/build/index.js:457:13)
    at Object.mockConstructor [as insertOne] (/home/inga/projects/test-assignment-payments/node_modules/jest-mock/build/index.js:170:19)
    at TransactionController.getAmountWithoutExchange (/home/inga/projects/test-assignment-payments/src/transaction/transaction.controller.ts:119:37)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at TransactionController.commission (/home/inga/projects/test-assignment-payments/src/transaction/transaction.controller.ts:56:30)
    at Object.<anonymous> (/home/inga/projects/test-assignment-payments/src/transaction/transaction.controller.spec.ts:60:20)

It looks like this rejection is not handled properly, probably with nest process crashing. It should be handled properly, so that specific tests fail with relevant error messages, rather than just "Jest worker encountered 4 child process exceptions, exceeding retry limit".

`npm run test` fails with ``` FAIL src/transaction/transaction.controller.spec.ts ● Test suite failed to run Jest worker encountered 4 child process exceptions, exceeding retry limit at ChildProcessWorker.initialize (../node_modules/jest-worker/build/workers/ChildProcessWorker.js:185:21) Test Suites: 1 failed, 2 passed, 3 total Tests: 2 passed, 2 total Snapshots: 0 total Time: 11.852 s Ran all test suites. ``` There are also following messages in output: ``` Node.js v18.18.2 /home/inga/projects/test-assignment-payments/src/transaction/transaction.controller.spec.ts:20 insertOne: jest.fn(() => Promise.reject(new Error("DatabaseNotReachable"))), ^ Error: DatabaseNotReachable at Object.<anonymous> (/home/inga/projects/test-assignment-payments/src/transaction/transaction.controller.spec.ts:19:49) at /home/inga/projects/test-assignment-payments/node_modules/jest-mock/build/index.js:449:39 at Object.<anonymous> (/home/inga/projects/test-assignment-payments/node_modules/jest-mock/build/index.js:457:13) at Object.mockConstructor [as insertOne] (/home/inga/projects/test-assignment-payments/node_modules/jest-mock/build/index.js:170:19) at TransactionController.getAmountWithoutExchange (/home/inga/projects/test-assignment-payments/src/transaction/transaction.controller.ts:119:37) at processTicksAndRejections (node:internal/process/task_queues:95:5) at TransactionController.commission (/home/inga/projects/test-assignment-payments/src/transaction/transaction.controller.ts:56:30) at Object.<anonymous> (/home/inga/projects/test-assignment-payments/src/transaction/transaction.controller.spec.ts:60:20) ``` It looks like this rejection is not handled properly, probably with nest process crashing. It should be handled properly, so that specific tests fail with relevant error messages, rather than just "Jest worker encountered 4 child process exceptions, exceeding retry limit".
inga-lovinde closed this issue 4 months ago
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: inga-lovinde/test-assignment-payments#3
Loading…
There is no content yet.