-
Notifications
You must be signed in to change notification settings - Fork 743
Description
Inspired by #833. We should create a robust solution to ensure each test runs with fresh state, and we successfully cleanup after each test.
Right now, some tests can cd() to change the working directory, and we won't properly cleanup after them. As an example, here's a bad afterEach() which assumes the test doesn't change working directory:
Lines 18 to 20 in 9035b27
| test.afterEach.always(t => { | |
| shell.rm('-rf', t.context.tmp); | |
| }); |
Another issue is that t.context.tmp usually refers to a relative path returned by utils.getTempDir(). I think we can be more robust by returning an absolute path.
We should create utility functions to do robust setup and teardown, to be used by every test suite (and the test suites can extend this to provide additional setup).
@freitagbr any additional thoughts?