Skip to content

Commit 04cba95

Browse files
LiviaMedeirosrichardlau
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 779043d commit 04cba95

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎test/common/README.md‎

Lines changed: 7 additions & 0 deletions
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‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ function onexit() {
5555
}
5656
}
5757

58+
functionresolve(...paths){
59+
returnpath.resolve(tmpPath, ...paths);
60+
}
61+
5862
functionhasEnoughSpace(size){
5963
const{ bavail, bsize }=fs.statfsSync(tmpPath);
6064
returnbavail>=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)