mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Fixing unit test failure in Windows OS (#2601)
Co-authored-by: Xianming Zhong <chinesedfan@qq.com>
This commit is contained in:
@@ -5,6 +5,7 @@ var url = require('url');
|
|||||||
var zlib = require('zlib');
|
var zlib = require('zlib');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
var path = require('path');
|
||||||
var server, proxy;
|
var server, proxy;
|
||||||
|
|
||||||
describe('supports http with nodejs', function () {
|
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) {
|
it('should pass errors for a failed stream', function (done) {
|
||||||
|
var notExitPath = path.join(__dirname, 'does_not_exist');
|
||||||
|
|
||||||
server = http.createServer(function (req, res) {
|
server = http.createServer(function (req, res) {
|
||||||
req.pipe(res);
|
req.pipe(res);
|
||||||
}).listen(4444, function () {
|
}).listen(4444, function () {
|
||||||
axios.post('http://localhost:4444/',
|
axios.post('http://localhost:4444/',
|
||||||
fs.createReadStream('/does/not/exist')
|
fs.createReadStream(notExitPath)
|
||||||
).then(function (res) {
|
).then(function (res) {
|
||||||
assert.fail();
|
assert.fail();
|
||||||
}).catch(function (err) {
|
}).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();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user