2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-15 11:59:42 +03:00

Fixing unit test failure in Windows OS (#2601)

Co-authored-by: Xianming Zhong <chinesedfan@qq.com>
This commit is contained in:
jennynju
2020-02-15 19:03:34 +08:00
committed by GitHub
parent 12e00b8018
commit 9267d4def1
+5 -2
View File
@@ -5,6 +5,7 @@ var url = require('url');
var zlib = require('zlib');
var assert = require('assert');
var fs = require('fs');
var path = require('path');
var server, proxy;
describe('supports http with nodejs', function () {
@@ -304,15 +305,17 @@ describe('supports http with nodejs', function () {
});
it('should pass errors for a failed stream', function (done) {
var notExitPath = path.join(__dirname, 'does_not_exist');
server = http.createServer(function (req, res) {
req.pipe(res);
}).listen(4444, function () {
axios.post('http://localhost:4444/',
fs.createReadStream('/does/not/exist')
fs.createReadStream(notExitPath)
).then(function (res) {
assert.fail();
}).catch(function (err) {
assert.equal(err.message, 'ENOENT: no such file or directory, open \'/does/not/exist\'');
assert.equal(err.message, `ENOENT: no such file or directory, open \'${notExitPath}\'`);
done();
});
});