summaryrefslogtreecommitdiff
path: root/cli/tests/node_compat/test/common/tmpdir.js
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2023-11-25 11:35:36 +0900
committerGitHub <noreply@github.com>2023-11-25 11:35:36 +0900
commit5710fffb120eba88e1b261e3ef379cb02575de42 (patch)
tree1e5fadbbba88bf816c124ed559082a5968adf1d3 /cli/tests/node_compat/test/common/tmpdir.js
parent60b5d32d902deb46f640cbdb0d2d4caf47a437c4 (diff)
chore: update node_compat test suites to v18.18.2 (#21328)
Diffstat (limited to 'cli/tests/node_compat/test/common/tmpdir.js')
-rw-r--r--cli/tests/node_compat/test/common/tmpdir.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/cli/tests/node_compat/test/common/tmpdir.js b/cli/tests/node_compat/test/common/tmpdir.js
index 2c97c51a6..886c4a107 100644
--- a/cli/tests/node_compat/test/common/tmpdir.js
+++ b/cli/tests/node_compat/test/common/tmpdir.js
@@ -62,7 +62,18 @@ function onexit() {
}
}
+function resolve(...paths) {
+ return path.resolve(tmpPath, ...paths);
+}
+
+function hasEnoughSpace(size) {
+ const { bavail, bsize } = fs.statfsSync(tmpPath);
+ return bavail >= Math.ceil(size / bsize);
+}
+
module.exports = {
path: tmpPath,
- refresh
+ refresh,
+ hasEnoughSpace,
+ resolve,
};