Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDarshan Sen <raisinten@gmail.com>2021-02-15 17:55:17 +0300
committerMichaƫl Zasso <targos@protonmail.com>2021-02-28 16:40:01 +0300
commitb5691051831c6f4bb8fd3cd35271674d8d430b77 (patch)
tree2b3f92c54eea8927257452731e0a4ce791f3513f /test
parentd039e6fa80099a672efb72af24f85c2c5b86b2f9 (diff)
test: clarify usage of tmpdir.refresh()
This emphasizes that `tmpdir.refresh()` must be called only once in each test file when needed. PR-URL: https://github.com/nodejs/node/pull/37383 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Diffstat (limited to 'test')
-rw-r--r--test/common/README.md7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/common/README.md b/test/common/README.md
index 9bbc107dd85..f05308d0da3 100644
--- a/test/common/README.md
+++ b/test/common/README.md
@@ -945,13 +945,18 @@ The realpath of the testing temporary directory.
Deletes and recreates the testing temporary directory.
-The first time `refresh()` runs, it adds a listener to process `'exit'` that
+The first time `refresh()` runs, it adds a listener to process `'exit'` that
cleans the temporary directory. Thus, every file under `tmpdir.path` needs to
be closed before the test completes. A good way to do this is to add a
listener to process `'beforeExit'`. If a file needs to be left open until
Node.js completes, use a child process and call `refresh()` only in the
parent.
+It is usually only necessary to call `refresh()` once in a test file.
+Avoid calling it more than once in an asynchronous context as one call
+might refresh the temporary directory of a different context, causing
+the test to fail somewhat mysteriously.
+
## UDP pair helper
The `common/udppair` module exports a function `makeUDPPair` and a class