Preventing duplicated external writes during Mocha test retries
Mocha allows for test retries via the this.retries(n) method or the --retries CLI flag. When a test fails and is retried, the framework re-executes the test function from the beginning to determine if the failure was transient. A challenge arises when tests involve external side effects, such as database inserts or API calls. Because Mocha does not provide a