Skip to content

Commit 0f12bff

Browse files
committed
adding ability to set port number
1 parent 9a3e02a commit 0f12bff

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
1919
-h, --help output usage information
2020
-V, --version output the version number
21+
-p, --port <num> set the port number
2122
-r, --root <dir> set root directory
2223
-u, --use <plugin> use transform plugin(s)
2324

bin/_duo-tester

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var resolve = require('path').resolve;
1616

1717
var program = new Command('duo-tester')
1818
.version(pkg.version)
19+
.option('-p, --port <num>', 'set the port number', 3000)
1920
.option('-r, --root <dir>', 'set root directory', process.cwd())
2021
.option('-u, --use <plugin>', 'use transform plugin(s)', collect, []);
2122

lib/browser.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ var html = require.resolve('./html.hbs');
77
var mocha = require.resolve('mocha-phantomjs/node_modules/mocha');
88
var path = require('path');
99
var serve = require('duo-serve');
10-
var url = 'http://localhost:3000/';
1110

1211
/**
1312
* Run tests using PhantomJS (via mocha-phantomjs)
1413
*/
1514

1615
module.exports = function (entries, options) {
16+
var url = 'http://localhost:' + options.port + '/';
17+
1718
var server = serve(options.root)
1819
.entry(entries)
1920
.html(html)
@@ -29,7 +30,7 @@ module.exports = function (entries, options) {
2930
res.sendFile(path.resolve(mocha, '../mocha.js'));
3031
});
3132

32-
server.listen(3000, function () {
33+
server.listen(options.port, function () {
3334
console.log();
3435
console.log(' duo-tester running at %s', url);
3536
console.log();

lib/phantom.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ var phantomjs = require('phantomjs');
1010
var script = require.resolve('mocha-phantomjs');
1111
var serve = require('duo-serve');
1212
var spawn = require('win-spawn');
13-
var url = 'http://localhost:3000/';
1413

1514
/**
1615
* Run tests using PhantomJS (via mocha-phantomjs)
1716
*/
1817

1918
module.exports = function (entries, options) {
19+
var url = 'http://localhost:' + options.port + '/';
20+
2021
var server = serve(options.root)
2122
.entry(entries)
2223
.favicon(false)
@@ -34,7 +35,7 @@ module.exports = function (entries, options) {
3435
res.sendFile(path.resolve(mocha, '../mocha.js'));
3536
});
3637

37-
server.listen(3000, start);
38+
server.listen(options.port, start);
3839
};
3940

4041
function start() {

0 commit comments

Comments
 (0)