()
| 102 | // ============================================================================= |
| 103 | |
| 104 | async function testAutoCloseOnEnd() { |
| 105 | const filePath = path.join(tmpDir, 'writer-autoclose-end.txt'); |
| 106 | const fh = await open(filePath, 'w'); |
| 107 | const w = fh.writer({ autoClose: true }); |
| 108 | await w.write(Buffer.from('auto close test')); |
| 109 | await w.end(); |
| 110 | |
| 111 | // Handle should be closed |
| 112 | await assert.rejects(fh.stat(), { code: 'EBADF' }); |
| 113 | assert.strictEqual(fs.readFileSync(filePath, 'utf8'), 'auto close test'); |
| 114 | } |
| 115 | |
| 116 | // ============================================================================= |
| 117 | // autoClose: true - handle closed after fail() |
no test coverage detected