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
I'm currently working on a plugin that, in its afterEach hook, needs to check if a certain action completed as expected. Initially, I was using an expect assertion, but thought I'd "up my game" a bit by writing a custom Cypress.log to provide plugin-specific details about the failure. Since having both an error log and the expect assertion was confusing, I poked around and found that if I set this.currentTest.state = 'failed' the test would fail. So now I'm writing a custom Cypress log and setting the test to fail via that property, which is the experience I'm looking for.
However, I'm concerned that the state property on currentTest might be considered an internal implementation detail of Cypress (or Mocha?). That could, in turn, lead to this not working in the future or causing conflicts with other plugins. So, does anyone know if it is acceptable to set that value on currentTest?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm currently working on a plugin that, in its
afterEach
hook, needs to check if a certain action completed as expected. Initially, I was using anexpect
assertion, but thought I'd "up my game" a bit by writing a customCypress.log
to provide plugin-specific details about the failure. Since having both an error log and theexpect
assertion was confusing, I poked around and found that if I setthis.currentTest.state = 'failed'
the test would fail. So now I'm writing a custom Cypress log and setting the test to fail via that property, which is the experience I'm looking for.However, I'm concerned that the
state
property oncurrentTest
might be considered an internal implementation detail of Cypress (or Mocha?). That could, in turn, lead to this not working in the future or causing conflicts with other plugins. So, does anyone know if it is acceptable to set that value oncurrentTest
?Beta Was this translation helpful? Give feedback.
All reactions