GeezerVison is showing github.com — test: add `tmpdir.resolve()` · nodejs/node@13bd7a0
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: test/common/README.md +7Lines changed: 7 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1062,6 +1062,13 @@ Avoid calling it more than once in an asynchronous context as one call |
1062 | 1062 | might refresh the temporary directory of a different context, causing |
1063 | 1063 | the test to fail somewhat mysteriously. |
1064 | 1064 |
|
| 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 | + |
1065 | 1072 | ### `hasEnoughSpace(size)` |
1066 | 1073 |
|
1067 | 1074 | * `size` [\<number>][<number>] Required size, in bytes. |
|
Collapse file
Copy file name to clipboardExpand all lines: test/common/tmpdir.js +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -70,6 +70,10 @@ function onexit(useSpawn) { |
70 | 70 | } |
71 | 71 | } |
72 | 72 |
|
| 73 | +function resolve(...paths) { |
| 74 | + return path.resolve(tmpPath, ...paths); |
| 75 | +} |
| 76 | + |
73 | 77 | function hasEnoughSpace(size) { |
74 | 78 | const { bavail, bsize } = fs.statfsSync(tmpPath); |
75 | 79 | return bavail >= Math.ceil(size / bsize); |
@@ -87,4 +91,5 @@ module.exports = { |
87 | 91 | hasEnoughSpace, |
88 | 92 | path: tmpPath, |
89 | 93 | refresh, |
| 94 | + resolve, |
90 | 95 | }; |