webpack: Use the correct port in Casper tests.

Previously we used 9994 unconditionally, whereas we should be using
9984 or 9994 depending whether it's being run manually or via the
Casper tests.
This commit is contained in:
Tim Abbott
2016-04-12 19:19:56 -07:00
parent 47879c5e00
commit 98d5f64f36
2 changed files with 17 additions and 8 deletions

View File

@@ -74,7 +74,7 @@ os.setpgrp()
# Pass --nostatic because we configure static serving ourselves in # Pass --nostatic because we configure static serving ourselves in
# zulip/urls.py. # zulip/urls.py.
cmds = [['./tools/compile-handlebars-templates', 'forever'], cmds = [['./tools/compile-handlebars-templates', 'forever'],
['./tools/webpack', 'watch'], ['./tools/webpack', '--watch', '--port', str(webpack_port)],
['python', 'manage.py', 'rundjango'] + ['python', 'manage.py', 'rundjango'] +
manage_args + ['localhost:%d' % (django_port,)], manage_args + ['localhost:%d' % (django_port,)],
['python', 'manage.py', 'runtornado'] + ['python', 'manage.py', 'runtornado'] +

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
from __future__ import absolute_import from __future__ import absolute_import
import optparse
import os import os
import subprocess import subprocess
import sys import sys
@@ -17,14 +18,22 @@ def run():
subprocess.check_call(['tools/node', 'node_modules/.bin/webpack'] + subprocess.check_call(['tools/node', 'node_modules/.bin/webpack'] +
['--config', 'tools/webpack.production.config.js']) ['--config', 'tools/webpack.production.config.js'])
def run_watch(): def run_watch(port):
# watch and rebuild on changes, serve file from memory via webpack-dev-server # watch and rebuild on changes, serve file from memory via webpack-dev-server
subprocess.Popen(['tools/node', 'node_modules/.bin/webpack-dev-server'] + subprocess.Popen(['tools/node', 'node_modules/.bin/webpack-dev-server'] +
['--config', 'tools/webpack.config.js', '--watch-poll']) ['--config', 'tools/webpack.config.js', '--watch-poll', '--port', port])
if __name__ == '__main__': parser = optparse.OptionParser()
if len(sys.argv) == 2 and sys.argv[1] == 'watch': parser.add_option('--watch',
run_watch() action='store_true', dest='watch', default=False,
else: help='watch for changes to source files (for development)')
parser.add_option('--port',
action='store', dest='port',
default='9994', help='Set the port for the webpack server to run on')
(options, args) = parser.parse_args()
if options.watch:
run_watch(options.port)
else:
run() run()