()
| 118 | // ============================================================================= |
| 119 | |
| 120 | async function testAutoCloseOnFail() { |
| 121 | const filePath = path.join(tmpDir, 'writer-autoclose-fail.txt'); |
| 122 | const fh = await open(filePath, 'w'); |
| 123 | const w = fh.writer({ autoClose: true }); |
| 124 | await w.write(Buffer.from('partial')); |
| 125 | w.fail(new Error('test fail')); |
| 126 | |
| 127 | // Handle should be closed |
| 128 | await assert.rejects(fh.stat(), { code: 'EBADF' }); |
| 129 | // Partial data should still be on disk (fail doesn't truncate) |
| 130 | assert.strictEqual(fs.readFileSync(filePath, 'utf8'), 'partial'); |
| 131 | } |
| 132 | |
| 133 | // ============================================================================= |
| 134 | // start option - write at specified offset |
no test coverage detected