-
Notifications
You must be signed in to change notification settings - Fork 739
Robustly clean up and restore state after tests #834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I agree that Another improvement might be using a dedicated temp directory module like |
@freitagbr Huh? |
I'll write up a PR in the next couple days. |
|
Some test suites have different requirements from others. For example, some require a full copy of Long-term, we should migrate most suites to the same beforeEach step (i.e. with a full copy of |
Another thing (caught this in #874), we should robustly set |
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 badafterEach()
which assumes the test doesn't change working directory:shelljs/test/ln.js
Lines 18 to 20 in 9035b27
Another issue is that
t.context.tmp
usually refers to a relative path returned byutils.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?
The text was updated successfully, but these errors were encountered: