Skip to content
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

withinSandbox may fail to create sandbox directory due to non-unique name #166

Closed
mcmire opened this issue Jan 19, 2024 · 2 comments · Fixed by #171
Closed

withinSandbox may fail to create sandbox directory due to non-unique name #166

mcmire opened this issue Jan 19, 2024 · 2 comments · Fixed by #171
Assignees

Comments

@mcmire
Copy link
Contributor

mcmire commented Jan 19, 2024

withinSandbox creates a temporary directory using the current timestamp, and throws if the directory already exists. This will inevitably cause a problem if two tests that use withinSandbox are running at the same time (which is likely if they are located in two separate files and you are running the entire test suite for a project, since Jest runs multiple files in parallel). The result is that the aforementioned error will appear, or strangely, the directory will fail to get removed.

To fix this, we should assign a unique name to the temporary directory.

@desi
Copy link

desi commented Jan 22, 2024

Two suggestions discussed were:

  1. Use a UUID
  2. Use the test module name in conjunction with the project name.

@desi
Copy link

desi commented Jan 22, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants