NeuraLegion/cypress-har-generator

Dispose of tmp files on each new recordHar

henricook opened this issue · 1 comments

This plugin is great and very helpful for me

In the situation where I'm running e.g. 500 tests and my goal is to output a HAR file only for a failed test... I'm using a global beforeEach to cy.recordHar() and then in a global afterEach only if the test has failed do I do cy.saveHar

Looking at the code I think this means that I'll have lots of old HARs in /tmp - which might grow to be quite a size.

Would it be desireable to have recordHar stop/delete any in progress recordings? Or present the dispose method more publicly so that I can do something like:

if (state === 'failed') {
    cy.saveHar({outDir: './cypress/hars'});
  } else {
    cy.disposeOfHar();
  }

Awesome, thanks @derevnjuk !