Node.js测试报错 发表于 Mar 14 2015 | 分类于 Node.js 12Uncaught Error: ENOENT, open 'C:\Users\jingling\project\test\images\avatar.jpg' at Error (native) 原因:12345678910it('login success', function (done) { request.put('/users/profile') .attach('avatar','../test/images/avatar.jpg') //这里的文件地址不能用 ../,应该直接写成'test/images/avatar.jpg' .expect(200,function(err,res){ console.log(res.body); res.body.data.avatar.should.exists; res.body.data.nick_name.should.equal(newUser.nick_name+'new'); done(err); });});