Skip to content

Commit c59cc3e

Browse files
committed
test: add tmpdir.resolve()
1 parent bb52656 commit c59cc3e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

test/common/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,13 @@ Avoid calling it more than once in an asynchronous context as one call
10561056
might refresh the temporary directory of a different context, causing
10571057
the test to fail somewhat mysteriously.
10581058

1059+
### `resolve([...paths])`
1060+
1061+
* `...paths` [\<string>][<string>]
1062+
* return [\<string>][<string>]
1063+
1064+
Resolves a sequence of paths into absolute path in the temporary directory.
1065+
10591066
### `hasEnoughSpace(size)`
10601067

10611068
* `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
@@ -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)