Created
August 29, 2018 21:53
-
-
Save ThisIsMissEm/3d2e6be48d7530bff3f26f7efdc708cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npm run test | |
> node-fetch@2.2.0 test /Users/emelia/Work/HighSnobiety/repos/node-fetch | |
> cross-env BABEL_ENV=test mocha --require babel-register test/test.js | |
node-fetch | |
✓ should return a promise | |
✓ should allow custom promise | |
✓ should throw error when no promise implementation are found | |
✓ should expose Headers, Response and Request constructors | |
✓ should support proper toString output for Headers, Response and Request objects | |
✓ should reject with error if url is protocol relative | |
✓ should reject with error if url is relative path | |
✓ should reject with error if protocol is unsupported | |
✓ should reject with error on network failure | |
✓ should resolve into response | |
✓ should accept plain text response | |
✓ should accept html response (like plain text) | |
✓ should accept json response | |
✓ should send request with custom headers | |
✓ should accept headers instance | |
✓ should accept custom host header | |
✓ should accept custom HoSt header | |
✓ should follow redirect code 301 | |
✓ should follow redirect code 302 | |
✓ should follow redirect code 303 | |
✓ should follow redirect code 307 | |
✓ should follow redirect code 308 | |
✓ should follow redirect chain | |
✓ should follow POST request redirect code 301 with GET | |
✓ should follow PATCH request redirect code 301 with PATCH | |
✓ should follow POST request redirect code 302 with GET | |
✓ should follow PATCH request redirect code 302 with PATCH | |
✓ should follow redirect code 303 with GET | |
✓ should follow PATCH request redirect code 307 with PATCH | |
✓ should not follow non-GET redirect if body is a readable stream | |
✓ should obey maximum redirect, reject case | |
✓ should obey redirect chain, resolve case | |
✓ should allow not following redirect | |
✓ should support redirect mode, manual flag | |
✓ should support redirect mode, error flag | |
✓ should support redirect mode, manual flag when there is no redirect | |
✓ should follow redirect code 301 and keep existing headers | |
✓ should treat broken redirect as ordinary response (follow) | |
✓ should treat broken redirect as ordinary response (manual) | |
✓ should ignore invalid headers | |
✓ should handle client-error response | |
✓ should handle server-error response | |
✓ should handle network-error response | |
- should handle DNS-error response | |
✓ should reject invalid json response | |
✓ should handle no content response | |
✓ should reject when trying to parse no content response as json | |
✓ should handle no content response with gzip encoding | |
✓ should handle not modified response | |
✓ should handle not modified response with gzip encoding | |
✓ should decompress gzip response | |
✓ should decompress slightly invalid gzip response | |
✓ should decompress deflate response | |
✓ should decompress deflate raw response from old apache server | |
✓ should skip decompression if unsupported | |
✓ should reject if response compression is invalid | |
✓ should handle errors on the body stream even if it is not used (52ms) | |
✓ should collect handled errors on the body stream to reject if the body is used later (112ms) | |
✓ should allow disabling auto decompression | |
✓ should allow custom timeout (106ms) | |
✓ should allow custom timeout on response body (110ms) | |
✓ should clear internal timeout on fetch response (136ms) | |
✓ should clear internal timeout on fetch redirect (117ms) | |
✓ should clear internal timeout on fetch error (112ms) | |
✓ should set default User-Agent | |
✓ should allow setting User-Agent | |
✓ should set default Accept header | |
✓ should allow setting Accept header | |
✓ should allow POST request | |
✓ should allow POST request with string body | |
✓ should allow POST request with buffer body | |
✓ should allow POST request with ArrayBuffer body | |
✓ should allow POST request with ArrayBuffer body from a VM context | |
✓ should allow POST request with ArrayBufferView (Uint8Array) body | |
✓ should allow POST request with ArrayBufferView (DataView) body | |
✓ should allow POST request with ArrayBufferView (Uint8Array) body from a VM context | |
✓ should allow POST request with ArrayBufferView (Uint8Array, offset, length) body | |
✓ should allow POST request with blob body without type | |
✓ should allow POST request with blob body with type | |
✓ should allow POST request with readable stream as body | |
✓ should allow POST request with form-data as body | |
✓ should allow POST request with form-data using stream as body | |
✓ should allow POST request with form-data as body and custom headers | |
✓ should allow POST request with object body | |
✓ should allow POST request with URLSearchParams as body | |
✓ should still recognize URLSearchParams when extended | |
✓ should still recognize URLSearchParams when extended from polyfill | |
✓ should overwrite Content-Length if possible | |
✓ should allow PUT request | |
✓ should allow DELETE request | |
✓ should allow DELETE request with string body | |
✓ should allow PATCH request | |
✓ should allow HEAD request | |
✓ should allow HEAD request with content-encoding header | |
✓ should allow OPTIONS request | |
✓ should reject decoding body twice | |
✓ should support timeouts (105ms) | |
✓ should support maximum response size, multiple chunk (104ms) | |
✓ should support maximum response size, single chunk | |
✓ should allow piping response body as stream | |
✓ should allow cloning a response, and use both as stream | |
✓ should allow cloning a json response and log it as text response | |
✓ should allow cloning a json response, and then log it as text response | |
✓ should allow cloning a json response, first log as text response, then return json object | |
✓ should not allow cloning a response after its been used | |
✓ should allow get all responses of a header | |
✓ should return all headers using raw() | |
✓ should allow deleting header | |
✓ should send request with connection keep-alive if agent is provided | |
✓ should support fetch with Request instance | |
✓ should support fetch with Node.js URL object | |
✓ should support fetch with WHATWG URL object | |
✓ should support blob round-trip | |
✓ should support overwrite Request instance | |
✓ should support arrayBuffer(), blob(), text(), json() and buffer() method in Body constructor | |
✓ should create custom FetchError (50ms) | |
✓ should support https request (575ms) | |
✓ supports supplying a lookup function to the agent | |
✓ supports supplying a famliy option to the agent | |
issue #414 | |
✓ should reject if attempt to accumulate body stream throws | |
Headers | |
✓ should have attributes conforming to Web IDL | |
✓ should allow iterating through all headers with forEach | |
✓ should allow iterating through all headers with for-of loop | |
✓ should allow iterating through all headers with entries() | |
✓ should allow iterating through all headers with keys() | |
✓ should allow iterating through all headers with values() | |
✓ should reject illegal header | |
✓ should ignore unsupported attributes while reading headers | |
✓ should wrap headers | |
✓ should accept headers as an iterable of tuples | |
✓ should throw a TypeError if non-tuple exists in a headers initializer | |
Response | |
✓ should have attributes conforming to Web IDL | |
✓ should support empty options | |
✓ should support parsing headers | |
✓ should support text() method | |
✓ should support json() method | |
✓ should support buffer() method | |
✓ should support blob() method | |
✓ should support clone() method | |
✓ should support stream as body | |
✓ should support string as body | |
✓ should support buffer as body | |
✓ should support ArrayBuffer as body | |
✓ should support blob as body | |
✓ should support Uint8Array as body | |
✓ should support DataView as body | |
✓ should default to null as body | |
✓ should default to 200 as status code | |
Request | |
✓ should have attributes conforming to Web IDL | |
1) should support wrapping Request instance | |
✓ should throw error with GET/HEAD requests with body | |
✓ should default to null as body | |
✓ should support parsing headers | |
✓ should support arrayBuffer() method | |
✓ should support text() method | |
✓ should support json() method | |
✓ should support buffer() method | |
✓ should support blob() method | |
✓ should support arbitrary url | |
✓ should support clone() method | |
✓ should support ArrayBuffer as body | |
✓ should support Uint8Array as body | |
✓ should support DataView as body | |
external encoding | |
with optional `encoding` | |
- should only use UTF-8 decoding with text() | |
- should support encoding decode, xml dtd detect | |
- should support encoding decode, content-type detect | |
- should support encoding decode, html5 detect | |
- should support encoding decode, html4 detect | |
- should default to utf8 encoding | |
- should support uncommon content-type order, charset in front | |
- should support uncommon content-type order, end with qs | |
- should support chunked encoding, html4 detect | |
- should only do encoding detection up to 1024 bytes | |
without optional `encoding` | |
✓ should throw a FetchError if res.textConverted() is called without `encoding` in require cache | |
162 passing (2s) | |
11 pending | |
1 failing | |
1) Request | |
should support wrapping Request instance: | |
AssertionError: expected { Object (_state, _reader, ...) } to equal { Object (_overheadLength, _valueLength, ...) } | |
+ expected - actual | |
{ | |
- "_disturbed": false | |
- "_readableStreamController": { | |
- "_closeRequested": false | |
- "_controlledReadableStream": [Circular] | |
- "_pullAgain": false | |
- "_pulling": false | |
- "_queue": [] | |
- "_started": false | |
- "_strategyHWM": 1 | |
- "_strategySize": [undefined] | |
- "_underlyingSource": { | |
- "cancel": [Function] | |
- "pull": [Function] | |
- "start": [Function] | |
- } | |
+ "_boundary": "--------------------------302080870961299848127774" | |
+ "_currentStream": [null] | |
+ "_events": { | |
+ "close": [ | |
+ [Function] | |
+ [Function] | |
+ [Function] | |
+ [Function] | |
+ ] | |
+ "data": [ | |
+ [Function] | |
+ [Function] | |
+ ] | |
+ "end": [ | |
+ [Function] | |
+ [Function] | |
+ [Function] | |
+ [Function] | |
+ ] | |
+ "error": [ | |
+ [Function] | |
+ [Function] | |
+ ] | |
} | |
- "_reader": [undefined] | |
- "_state": "readable" | |
- "_storedError": [undefined] | |
+ "_eventsCount": 4 | |
+ "_overheadLength": 100 | |
+ "_released": true | |
+ "_streams": [] | |
+ "_valueLength": 1 | |
+ "_valuesToMeasure": [] | |
+ "dataSize": 0 | |
+ "maxDataSize": 2097152 | |
+ "pauseStreams": true | |
+ "readable": true | |
+ "writable": true | |
} | |
at Context.<anonymous> (test/test.js:2205:24) | |
npm ERR! code ELIFECYCLE | |
npm ERR! errno 1 | |
npm ERR! node-fetch@2.2.0 test: `cross-env BABEL_ENV=test mocha --require babel-register test/test.js` | |
npm ERR! Exit status 1 | |
npm ERR! | |
npm ERR! Failed at the node-fetch@2.2.0 test script. | |
npm ERR! This is probably not a problem with npm. There is likely additional logging output above. | |
npm ERR! A complete log of this run can be found in: | |
npm ERR! /Users/emelia/.npm/_logs/2018-08-29T21_52_39_195Z-debug.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment