Skip to content

Commit 04cba95

Browse files
LiviaMedeirosrichardlau
authored andcommitted
test: add tmpdir.resolve()
PR-URL: #49079 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
1 parent 779043d commit 04cba95

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
@@ -1027,6 +1027,13 @@ Avoid calling it more than once in an asynchronous context as one call
10271027
might refresh the temporary directory of a different context, causing
10281028
the test to fail somewhat mysteriously.
10291029

1030+
### `resolve([...paths])`
1031+
1032+
* `...paths` [\<string>][<string>]
1033+
* return [\<string>][<string>]
1034+
1035+
Resolves a sequence of paths into absolute path in the temporary directory.
1036+
10301037
### `hasEnoughSpace(size)`
10311038

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

test/common/tmpdir.js

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ function onexit() {
5555
}
5656
}
5757

58+
function resolve(...paths) {
59+
return path.resolve(tmpPath, ...paths);
60+
}
61+
5862
function hasEnoughSpace(size) {
5963
const { bavail, bsize } = fs.statfsSync(tmpPath);
6064
return bavail >= Math.ceil(size / bsize);
@@ -64,4 +68,5 @@ module.exports = {
6468
path: tmpPath,
6569
refresh,
6670
hasEnoughSpace,
71+
resolve,
6772
};

0 commit comments

Comments
 (0)