Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Soft assertions in javascript

I have two backend projects P1 & P2. Data from P1 has to flow into P2 after some processing via a middleware. I am writing this middleware and I have to create an E2E testing module.

I will have 100s of test cases and in each there may be 3 or 4 expect statements. The chai 'expect' function is a form of hard assertion. How can I get soft assertions in javascript. Basically, the test case will run all 3 or 4 expect statements and report which one's failed.

like image 300
suku Avatar asked Jun 11 '26 05:06

suku


1 Answers

Chai does not allow soft asserts, it is against their assertion philosophy. Try using the library https://www.npmjs.com/package/soft-assert

like image 81
Ray Avatar answered Jun 13 '26 20:06

Ray