vaimee / desmo-dapp

0 stars 1 forks source link

Review the last standing callback #11

Open relu91 opened 2 years ago

relu91 commented 2 years ago

That is needed for some tests, I'm not sure I should remove it. In detail, if we are in a test that is using that worker, the test will set a callback used instead of the function this.err which will cause the process.exit(1);.

_Originally posted by @FerrariAndrea in https://github.com/vaimee/desmo-dapp/pull/8#discussion_r955018477_

We have to discuss why is still needed for the tests and try to remove it if it makes sense

FerrariAndrea commented 2 years ago

In order to achieve a good coverage percentage of Jest, I need to test some cases that in the "production" behavior will call the process.exit(1) That is a good practice for the Iexec Oracle app, because this should help the workerpool to know if the running is finished before the time-out (we know that in the actual state of the Iexec platform that doesn't seem to happen anyway).

If during the test I run the process.exit(1) that will kill the entire test queue. Using jest there is a way to handle that? Maybe we can try that after the test-refactoring #7

relu91 commented 2 years ago

If during the test I run the process.exit(1) that will kill the entire test queue. Using jest there is a way to handle that?

Of course there is: https://stackoverflow.com/questions/46148169/stubbing-process-exit-with-jest

Maybe we can try that after the test-refactoring https://github.com/vaimee/desmo-dapp/issues/7

Yes let's solve this in #7