mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
test: add tmpdir.resolve()
PR-URL: https://github.com/nodejs/node/pull/49079 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
@@ -1062,6 +1062,13 @@ Avoid calling it more than once in an asynchronous context as one call
|
||||
might refresh the temporary directory of a different context, causing
|
||||
the test to fail somewhat mysteriously.
|
||||
|
||||
### `resolve([...paths])`
|
||||
|
||||
* `...paths` [\<string>][<string>]
|
||||
* return [\<string>][<string>]
|
||||
|
||||
Resolves a sequence of paths into absolute path in the temporary directory.
|
||||
|
||||
### `hasEnoughSpace(size)`
|
||||
|
||||
* `size` [\<number>][<number>] Required size, in bytes.
|
||||
|
||||
@@ -70,6 +70,10 @@ function onexit(useSpawn) {
|
||||
}
|
||||
}
|
||||
|
||||
function resolve(...paths) {
|
||||
return path.resolve(tmpPath, ...paths);
|
||||
}
|
||||
|
||||
function hasEnoughSpace(size) {
|
||||
const { bavail, bsize } = fs.statfsSync(tmpPath);
|
||||
return bavail >= Math.ceil(size / bsize);
|
||||
@@ -87,4 +91,5 @@ module.exports = {
|
||||
hasEnoughSpace,
|
||||
path: tmpPath,
|
||||
refresh,
|
||||
resolve,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user