That's not good as the beforeEach hook will finish before the file is written. And if there's an error, then done will be called twice.

Use the synchronous version of write.