Skip to content

Commit b2bb995

Browse files
author
Tom Coleman
committed
Merge pull request meteor#6964 from abernix/issue-6961-fix-test-bindaddr
Allow --port in "test" to support a bindaddr, same as non-test
2 parents a2da8d5 + 454a761 commit b2bb995

2 files changed

Lines changed: 41 additions & 4 deletions

File tree

tools/cli/commands.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,7 +1671,12 @@ function doTestCommand(options) {
16711671

16721672
return runTestAppForPackages(projectContext, _.extend(
16731673
options,
1674-
{ mobileServerUrl: utils.formatUrl(parsedMobileServerUrl) }));
1674+
{
1675+
mobileServerUrl: utils.formatUrl(parsedMobileServerUrl),
1676+
proxyPort: parsedServerUrl.port,
1677+
proxyHost: parsedServerUrl.host,
1678+
}
1679+
));
16751680
}
16761681

16771682
// Returns the "local-test:*" package names for the given package names (or for
@@ -1755,7 +1760,8 @@ var runTestAppForPackages = function (projectContext, options) {
17551760
var runAll = require('../runners/run-all.js');
17561761
return runAll.run({
17571762
projectContext: projectContext,
1758-
proxyPort: options.port,
1763+
proxyPort: options.proxyPort,
1764+
proxyHost: options.proxyHost,
17591765
debugPort: options['debug-port'],
17601766
disableOplog: options['disable-oplog'],
17611767
settingsFile: options.settings,

tools/tests/run.js

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,11 @@ selftest.define("run and SIGKILL parent process", ["yet-unsolved-windows-failure
391391
run.stop();
392392
});
393393

394-
selftest.define("'meteor run --port' requires a port", function () {
394+
selftest.define("'meteor run --port' accepts/rejects proper values", function () {
395395
var s = new Sandbox();
396396
var run;
397397

398-
s.createApp("myapp", "app-prints-pid");
398+
s.createApp("myapp", "standard-app");
399399
s.cd("myapp");
400400

401401
run = s.run("run", "--port", "example.com");
@@ -407,6 +407,37 @@ selftest.define("'meteor run --port' requires a port", function () {
407407
run.waitSecs(30);
408408
run.matchErr("--port must include a port");
409409
run.expectExit(1);
410+
411+
run = s.run("run", "--port", "3500");
412+
run.match('App running at: http://localhost:3500/');
413+
run.stop();
414+
415+
run = s.run("run", "--port", "127.0.0.1:3500");
416+
run.match('App running at: http://127.0.0.1:3500/');
417+
run.stop();
418+
});
419+
420+
selftest.define("'meteor test --port' accepts/rejects proper values", function () {
421+
var s = new Sandbox();
422+
var run;
423+
424+
s.createApp("myapp", "standard-app");
425+
s.cd("myapp");
426+
427+
var runAddPackage = s.run("add", "practicalmeteor:mocha");
428+
runAddPackage.waitSecs(30);
429+
runAddPackage.match(/practicalmeteor:mocha\b.*?added/)
430+
runAddPackage.expectExit(0);
431+
432+
run = s.run("test", "--port", "3700", "--driver-package", "practicalmeteor:mocha");
433+
run.waitSecs(30);
434+
run.match('App running at: http://localhost:3700/');
435+
run.stop();
436+
437+
run = s.run("test", "--port", "127.0.0.1:3700", "--driver-package", "practicalmeteor:mocha");
438+
run.waitSecs(30);
439+
run.match('App running at: http://127.0.0.1:3700/');
440+
run.stop();
410441
});
411442

412443
// Regression test for #3582. Previously, meteor run would ignore changes to

0 commit comments

Comments
 (0)