From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Richard Lau <riclau@uk.ibm.com>
Date: Mon, 16 Dec 2019 16:25:31 -0500
Subject: test: use tmpdir.refresh() in test-esm-windows.js

Use `tmpdir.refresh()` in `test/es-module/test-esm-windows.js` so
that the temporary directory is cleaned before use and when the test
exits.

PR-URL: https://github.com/nodejs/node/pull/30997
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
(cherry picked from commit e23aebc684a45f725811211f9740bcee3bcdbe26)

diff --git a/test/es-module/test-esm-windows.js b/test/es-module/test-esm-windows.js
index 64ba1249a76c06ee3461b56f7ac69a650e6fbfcc..44af65d6a4e0315b31508cab3183c0142ff0d17c 100644
--- a/test/es-module/test-esm-windows.js
+++ b/test/es-module/test-esm-windows.js
@@ -15,9 +15,8 @@ const imp = (file) => {
 };
 
 (async () => {
-  const tmp = tmpdir.path;
-  await fs.mkdir(tmp).catch(() => {});
-  const rel = (file) => path.join(tmp, file);
+  tmpdir.refresh();
+  const rel = (file) => path.join(tmpdir.path, file);
 
   { // Load a single script
     const file = rel('con.mjs');
