varpath=require('path')vartest=require('tap').testvarwriteStream=require('../index.js')functionrepeat(times,string){varoutput=''for(varii=0;ii<times;++ii){output+=string}returnoutput}vartarget=path.resolve(__dirname,repeat(1000,'test'))test('name too long',function(t){t.plan(2)varstream=writeStream(target)varhadError=falsestream.on('error',function(er){if(!hadError){t.is(er.code,'ENAMETOOLONG',target.length+' character name results in ENAMETOOLONG')hadError=true}})stream.on('close',function(){t.ok(hadError,'got error before close')})stream.end()})