()
| 118 | |
| 119 | { |
| 120 | async function doTest() { |
| 121 | tmpdir.refresh(); |
| 122 | |
| 123 | const dest = path.resolve(tmpDir, 'baz.js'); |
| 124 | |
| 125 | // handle is object |
| 126 | { |
| 127 | await executeOnHandle(dest, common.mustCall(async (handle) => { |
| 128 | assert.strictEqual(typeof handle, 'object'); |
| 129 | })); |
| 130 | } |
| 131 | |
| 132 | // file stats |
| 133 | { |
| 134 | await executeOnHandle(dest, common.mustCall(async (handle) => { |
| 135 | let stats = await handle.stat(); |
| 136 | verifyStatObject(stats); |
| 137 | assert.strictEqual(stats.size, 35); |
| 138 | |
| 139 | await handle.truncate(1); |
| 140 | |
| 141 | stats = await handle.stat(); |
| 142 | verifyStatObject(stats); |
| 143 | assert.strictEqual(stats.size, 1); |
| 144 | |
| 145 | stats = await stat(dest); |
| 146 | verifyStatObject(stats); |
| 147 | |
| 148 | stats = await handle.stat(); |
| 149 | verifyStatObject(stats); |
| 150 | |
| 151 | await handle.datasync(); |
| 152 | await handle.sync(); |
| 153 | })); |
| 154 | } |
| 155 | |
| 156 | // File stats throwIfNoEntry: false |
| 157 | { |
| 158 | const stats = await stat('meow.js', { throwIfNoEntry: false }); |
| 159 | assert.strictEqual(stats, undefined); |
| 160 | } |
| 161 | |
| 162 | // File system stats |
| 163 | { |
| 164 | const statFs = await statfs(dest); |
| 165 | verifyStatFsObject(statFs); |
| 166 | } |
| 167 | |
| 168 | // File system stats bigint |
| 169 | { |
| 170 | const statFs = await statfs(dest, { bigint: true }); |
| 171 | verifyStatFsObject(statFs, true); |
| 172 | } |
| 173 | |
| 174 | // Test fs.read promises when length to read is zero bytes |
| 175 | { |
| 176 | const dest = path.resolve(tmpDir, 'test1.js'); |
| 177 | await executeOnHandle(dest, common.mustCall(async (handle) => { |
no test coverage detected
searching dependent graphs…