Updates nock dependency to version 1.x.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Sat, 7 Mar 2015 17:36:36 +0000 (17:36 +0000)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Sat, 7 Mar 2015 17:36:36 +0000 (17:36 +0000)
package.json
test/protocol-imports-test.js
test/source-map-test.js

index 15bed5c..d4026c3 100644 (file)
@@ -41,7 +41,7 @@
   "devDependencies": {
     "browserify": "9.x",
     "jshint": "2.6.x",
-    "nock": ">=0.51 <1.0",
+    "nock": "1.x",
     "server-destroy": "1.x",
     "uglify-js": "2.4.x",
     "vows": "0.8.x"
index 60a1ca6..22a38f5 100644 (file)
@@ -291,33 +291,6 @@ vows.describe('protocol imports').addBatch({
       nock.cleanAll();
     }
   },
-  'of a timed out response': {
-    topic: function() {
-      var self = this;
-      var timeout = 100;
-      this.server = http.createServer(function(req, res) {
-        setTimeout(function() {}, timeout * 2);
-      });
-      this.server.listen(port, function() {
-        new CleanCSS({
-          inliner: {
-            timeout: timeout
-          }
-        }).minify('@import url(http://localhost:' + port + '/timeout.css);a{color:red}', self.callback);
-      });
-      enableDestroy(self.server);
-    },
-    'should raise errors': function(errors, minified) {
-      assert.lengthOf(errors, 1);
-      assert.equal(errors[0], 'Broken @import declaration of "http://localhost:' + port + '/timeout.css" - timeout');
-    },
-    'should process @import': function(errors, minified) {
-      assert.equal(minified.styles, '@import url(http://localhost:' + port + '/timeout.css);a{color:red}');
-    },
-    teardown: function() {
-      this.server.destroy();
-    }
-  },
   'of a cyclical reference response': {
     topic: function() {
       this.reqMocks = nock('http://127.0.0.1')
@@ -451,4 +424,35 @@ vows.describe('protocol imports').addBatch({
       nock.cleanAll();
     }
   }
+}).addBatch({
+  'of a timed out response': {
+    topic: function() {
+      nock.enableNetConnect();
+
+      var self = this;
+      var timeout = 100;
+      this.server = http.createServer(function(req, res) {
+        setTimeout(function() {}, timeout * 2);
+      });
+      this.server.listen(port, function() {
+        new CleanCSS({
+          inliner: {
+            timeout: timeout
+          }
+        }).minify('@import url(http://localhost:' + port + '/timeout.css);a{color:red}', self.callback);
+      });
+      enableDestroy(self.server);
+    },
+    'should raise errors': function(errors, minified) {
+      assert.lengthOf(errors, 1);
+      assert.equal(errors[0], 'Broken @import declaration of "http://localhost:' + port + '/timeout.css" - timeout');
+    },
+    'should process @import': function(errors, minified) {
+      assert.equal(minified.styles, '@import url(http://localhost:' + port + '/timeout.css);a{color:red}');
+    },
+    teardown: function() {
+      this.server.destroy();
+      nock.disableNetConnect();
+    }
+  }
 }).export(module);
index a3006ab..0e033cc 100644 (file)
@@ -663,6 +663,8 @@ vows.describe('source-map')
     },
     'timed out response for external source map': {
       topic: function() {
+        nock.enableNetConnect();
+
         var self = this;
         var timeout = 100;
 
@@ -688,10 +690,11 @@ vows.describe('source-map')
       },
       'raises an error': function(errors, _) {
         assert.lengthOf(errors, 1);
-        assert.equal(errors[0], 'Broken source map at "http://127.0.0.1:' + port + '/remote.css.map" - timeout');
+        assert.include(errors[0], 'Broken source map at "http://127.0.0.1:' + port + '/remote.css.map"');
       },
       teardown: function () {
         this.server.destroy();
+        nock.disableNetConnect();
       }
     },
     'absolute source map from external host via http': {