You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The expect-expect rule works great for identifying a test that doesn't have any assertions, but it doesn't work for identifying halfway-complete tests. Often more complex test cases (such as JSDOM tests) will have multiple assertions, usually before something has occurred to assert the base state is correct, then perform an action, and then assert that the values have changed as expected. I have found a few times where I'll be writing a test and get distracted halfway through and forget to finish the second half of the test. Code coverage looks good since all of the actions were performed, but the test was missing the critical assertions at the end.
In almost every test, there should be an assertion as the last statement. The only case where I can think of that not being true is when the assertions are inside of callback function, but that can be avoided by putting expect.assertions(number) as the last line.
Since it seems like a generally useful option which aligns with the spirit of this rule, I wanted to suggest this as a new feature.
The text was updated successfully, but these errors were encountered:
The expect-expect rule works great for identifying a test that doesn't have any assertions, but it doesn't work for identifying halfway-complete tests. Often more complex test cases (such as JSDOM tests) will have multiple assertions, usually before something has occurred to assert the base state is correct, then perform an action, and then assert that the values have changed as expected. I have found a few times where I'll be writing a test and get distracted halfway through and forget to finish the second half of the test. Code coverage looks good since all of the actions were performed, but the test was missing the critical assertions at the end.
In almost every test, there should be an assertion as the last statement. The only case where I can think of that not being true is when the assertions are inside of callback function, but that can be avoided by putting
expect.assertions(number)
as the last line.Since it seems like a generally useful option which aligns with the spirit of this rule, I wanted to suggest this as a new feature.
The text was updated successfully, but these errors were encountered: