From: Jakub Pawlowicz Date: Sat, 7 Mar 2015 17:36:36 +0000 (+0000) Subject: Updates nock dependency to version 1.x. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=ec8069c37c47678bd4260b839c978c2aa66f6244;p=clean-css.git Updates nock dependency to version 1.x. --- diff --git a/package.json b/package.json index 15bed5ca..d4026c3b 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/test/protocol-imports-test.js b/test/protocol-imports-test.js index 60a1ca68..22a38f59 100644 --- a/test/protocol-imports-test.js +++ b/test/protocol-imports-test.js @@ -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); diff --git a/test/source-map-test.js b/test/source-map-test.js index a3006abe..0e033cc0 100644 --- a/test/source-map-test.js +++ b/test/source-map-test.js @@ -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': {