nock 8.0.0 → 8.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/.travis.yml +1 -0
  2. package/CHANGELOG.md +107 -114
  3. package/README.md +103 -42
  4. package/lib/common.js +15 -1
  5. package/lib/intercept.js +24 -11
  6. package/lib/interceptor.js +21 -22
  7. package/lib/match_body.js +1 -1
  8. package/lib/recorder.js +6 -3
  9. package/lib/request_overrider.js +3 -3
  10. package/lib/scope.js +30 -28
  11. package/package.json +10 -7
  12. package/tests/test_back.js +5 -2
  13. package/tests/test_body_match.js +40 -0
  14. package/tests/test_browserify.js +54 -52
  15. package/tests/test_intercept.js +195 -47
  16. package/tests/test_isomorphic_fetch.js +45 -45
  17. package/.npmignore +0 -2
  18. package/coverage/coverage.json +0 -1
  19. package/coverage/lcov-report/base.css +0 -212
  20. package/coverage/lcov-report/index.html +0 -106
  21. package/coverage/lcov-report/nock/index.html +0 -93
  22. package/coverage/lcov-report/nock/index.js.html +0 -98
  23. package/coverage/lcov-report/nock/lib/back.js.html +0 -1022
  24. package/coverage/lcov-report/nock/lib/common.js.html +0 -1070
  25. package/coverage/lcov-report/nock/lib/delayed_body.js.html +0 -305
  26. package/coverage/lcov-report/nock/lib/global_emitter.js.html +0 -71
  27. package/coverage/lcov-report/nock/lib/index.html +0 -223
  28. package/coverage/lcov-report/nock/lib/intercept.js.html +0 -1253
  29. package/coverage/lcov-report/nock/lib/interceptor.js.html +0 -1670
  30. package/coverage/lcov-report/nock/lib/match_body.js.html +0 -275
  31. package/coverage/lcov-report/nock/lib/mixin.js.html +0 -107
  32. package/coverage/lcov-report/nock/lib/recorder.js.html +0 -1323
  33. package/coverage/lcov-report/nock/lib/request_overrider.js.html +0 -1643
  34. package/coverage/lcov-report/nock/lib/scope.js.html +0 -1133
  35. package/coverage/lcov-report/nock/lib/socket.js.html +0 -272
  36. package/coverage/lcov-report/prettify.css +0 -1
  37. package/coverage/lcov-report/prettify.js +0 -1
  38. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  39. package/coverage/lcov-report/sorter.js +0 -158
  40. package/coverage/lcov.info +0 -2428
  41. package/tests/browserify-public/browserify-bundle.js +0 -34332
  42. package/tests/test.js +0 -32
@@ -1,53 +1,53 @@
1
1
  'use strict';
2
2
 
3
- var nock = require('../');
4
- var test = require('tap').test;
5
- var fetch = require('isomorphic-fetch');
3
+ if (process.versions.node >= '0.11' ) {
4
+ var nock = require('../');
5
+ var test = require('tap').test;
6
+ var fetch = require('isomorphic-fetch');
6
7
 
7
- test("basic match works", function(t) {
8
- var scope = nock('http://isomorphicfetchland.com').
9
- get('/path').
10
- reply(200, 'somedata');
8
+ test("basic match works", function(t) {
9
+ var scope = nock('http://isomorphicfetchland.com').
10
+ get('/path').
11
+ reply(200, 'somedata');
11
12
 
12
- fetch('http://isomorphicfetchland.com/path').
13
- then(function(res) {
14
- return res.text();
15
- }).
16
- then(function(text) {
17
- scope.done();
18
- t.equal(text, 'somedata', "response should match");
19
- t.end();
20
- }).
21
- catch(function(err) {
22
- throw err;
13
+ fetch('http://isomorphicfetchland.com/path').
14
+ then(function(res) {
15
+ return res.text();
16
+ }).
17
+ then(function(text) {
18
+ scope.done();
19
+ t.equal(text, 'somedata', "response should match");
20
+ t.end();
21
+ }).
22
+ catch(function(err) {
23
+ throw err;
24
+ });
23
25
  });
24
- });
25
26
 
26
- test("string-based reqheaders match works", function(t) {
27
- var scope = nock('http://isomorphicfetchland.com', {
28
- reqheaders: {
29
- 'header': 'header value',
30
- }
31
- }).
32
- get('/path2').
33
- reply(200, 'somemoardata');
27
+ test("string-based reqheaders match works", function(t) {
28
+ var scope = nock('http://isomorphicfetchland.com', {
29
+ reqheaders: {
30
+ 'header': 'header value',
31
+ }
32
+ }).
33
+ get('/path2').
34
+ reply(200, 'somemoardata');
34
35
 
35
- fetch('http://isomorphicfetchland.com/path2', {
36
- headers: {
37
- 'header': 'header value',
38
- }
39
- }).
40
- then(function(res) {
41
- return res.text();
42
- }).
43
- then(function(text) {
44
- scope.done();
45
- t.equal(text, 'somemoardata', "response should match");
46
- t.end();
47
- }).
48
- catch(function(err) {
49
- throw err;
36
+ fetch('http://isomorphicfetchland.com/path2', {
37
+ headers: {
38
+ 'header': 'header value',
39
+ }
40
+ }).
41
+ then(function(res) {
42
+ return res.text();
43
+ }).
44
+ then(function(text) {
45
+ scope.done();
46
+ t.equal(text, 'somemoardata', "response should match");
47
+ t.end();
48
+ }).
49
+ catch(function(err) {
50
+ throw err;
51
+ });
50
52
  });
51
- });
52
-
53
-
53
+ }
package/.npmignore DELETED
@@ -1,2 +0,0 @@
1
- node_modules
2
- .gitignore