Skip to content

Commit 13bd7a0

Browse files
LiviaMedeirosRafaelGSS
authored andcommitted
test: add tmpdir.resolve()
PR-URL: #49079 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent 89b1bce commit 13bd7a0

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

test/common/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,13 @@ Avoid calling it more than once in an asynchronous context as one call
10621062
might refresh the temporary directory of a different context, causing
10631063
the test to fail somewhat mysteriously.
10641064

1065+
### `resolve([...paths])`
1066+
1067+
* `...paths` [\<string>][<string>]
1068+
* return [\<string>][<string>]
1069+
1070+
Resolves a sequence of paths into absolute path in the temporary directory.
1071+
10651072
### `hasEnoughSpace(size)`
10661073

10671074
* `size` [\<number>][<number>] Required size, in bytes.

test/common/tmpdir.js

+5
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ function onexit(useSpawn) {
7070
}
7171
}
7272

73+
function resolve(...paths) {
74+
return path.resolve(tmpPath, ...paths);
75+
}
76+
7377
function hasEnoughSpace(size) {
7478
const { bavail, bsize } = fs.statfsSync(tmpPath);
7579
return bavail >= Math.ceil(size / bsize);
@@ -87,4 +91,5 @@ module.exports = {
8791
hasEnoughSpace,
8892
path: tmpPath,
8993
refresh,
94+
resolve,
9095
};

0 commit comments

Comments
 (0)