gemini-express
Advanced tools
Comparing version 0.9.1 to 0.9.2
@@ -19,3 +19,2 @@ var cleankill = require('cleankill'); | ||
function Server(root) { | ||
var _this = this; | ||
var _root = root || process.cwd(); | ||
@@ -28,31 +27,31 @@ | ||
_this.start = function(opts, cb) { | ||
getPort(opts, function(err, port) { | ||
if(err) throw err; | ||
httpClose({ timeout: 2000 }, httpServer); | ||
httpServer.listen(port, function() { | ||
console.log('Express hosting ' + _root + ' at http://localhost:' + port); | ||
if(cb) cb('http://localhost:' + port); | ||
}); | ||
return { | ||
start: function(opts, cb) { | ||
getPort(opts, function(err, port) { | ||
if (err) throw err; | ||
httpClose({timeout: 2000}, httpServer); | ||
httpServer.listen(port, function() { | ||
console.log('Express hosting ' + _root + ' at http://localhost:' + port); | ||
if (cb) cb('http://localhost:' + port); | ||
}); | ||
httpServer.port = port; | ||
httpServer.port = port; | ||
cleankill.onInterrupt(function(done) { | ||
httpServer.close(function() { | ||
console.log('Express closed.'); | ||
done(); | ||
cleankill.onInterrupt(function(done) { | ||
httpServer.close(function() { | ||
console.log('Express closed.'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}; | ||
}, | ||
_this.stop = function() { | ||
httpServer.close(function() { | ||
console.log('Express stopped.'); | ||
}); | ||
}; | ||
return _this; | ||
stop: function() { | ||
httpServer.close(function() { | ||
console.log('Express stopped.'); | ||
}); | ||
} | ||
} | ||
}; | ||
module.exports = Server; |
{ | ||
"name": "gemini-express", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"description": "Plugin for starting up Express when running tests with Gemini", | ||
"repository": "https://github.com/Saulis/gemini-express/", | ||
"main": "lib/plugin.js", | ||
@@ -6,0 +7,0 @@ "scripts": { |
# gemini-express | ||
Plugin for starting up Express when running tests with Gemini | ||
[![Build Status](https://travis-ci.org/Saulis/gemini-express.svg?branch=master)](https://travis-ci.org/Saulis/gemini-express) | ||
## Notes | ||
@@ -5,0 +7,0 @@ Requires a version of gemini that supports plugin loading. See https://github.com/bem/gemini/pull/127 |
@@ -74,3 +74,3 @@ var expect = require('chai').expect; | ||
expect(server.start.calledOnce); | ||
expect(server.start.calledOnce).to.be.true; | ||
}); | ||
@@ -111,3 +111,3 @@ | ||
expect(server.stop.called); | ||
expect(server.stop.called).to.be.true; | ||
}); | ||
@@ -128,5 +128,5 @@ | ||
expect(deferred.resolve.called); | ||
expect(deferred.resolve.called).to.be.true; | ||
}); | ||
}); | ||
}); |
@@ -1,2 +0,1 @@ | ||
var assert = require('chai').assert; | ||
var expect = require('chai').expect; | ||
@@ -61,3 +60,3 @@ var sinon = require('sinon'); | ||
assert(app.use.calledWith('foobar')); | ||
expect(app.use.calledWith('foobar')).to.be.true; | ||
}); | ||
@@ -99,3 +98,3 @@ | ||
assert(httpServer.close.called); | ||
expect(httpServer.close.called).to.be.true; | ||
}); | ||
@@ -124,5 +123,5 @@ | ||
assert(httpServer.close.called); | ||
expect(httpServer.close.called).to.be.true; | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
99278
29
250