mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 03:53:50 +00:00 
			
		
		
		
	test-js-with-node: Port from optparse to argparse.
This commit is contained in:
		| @@ -1,5 +1,5 @@ | ||||
| #!/usr/bin/env python3 | ||||
| import optparse | ||||
| import argparse | ||||
| import os | ||||
| import subprocess | ||||
| import sys | ||||
| @@ -60,14 +60,15 @@ enforce_fully_covered = { | ||||
|     'static/js/util.js', | ||||
| } | ||||
|  | ||||
| parser = optparse.OptionParser(USAGE) | ||||
| parser.add_option('--coverage', dest='coverage', | ||||
|                   action="store_true", | ||||
|                   default=False, help='Get coverage report') | ||||
| parser.add_option('--force', dest='force', | ||||
|                   action="store_true", | ||||
|                   default=False, help='Run tests despite possible problems.') | ||||
| (options, args) = parser.parse_args() | ||||
| parser = argparse.ArgumentParser(USAGE) | ||||
| parser.add_argument('--coverage', dest='coverage', | ||||
|                     action="store_true", | ||||
|                     default=False, help='Get coverage report') | ||||
| parser.add_argument('--force', dest='force', | ||||
|                     action="store_true", | ||||
|                     default=False, help='Run tests despite possible problems.') | ||||
| parser.add_argument('args', nargs=argparse.REMAINDER) | ||||
| options = parser.parse_args() | ||||
|  | ||||
| from tools.lib.test_script import get_provisioning_status | ||||
|  | ||||
| @@ -89,7 +90,7 @@ INDEX_JS = 'frontend_tests/zjsunit/index.js' | ||||
| # tracebacks, so you generally want to get coverage reports only | ||||
| # after making sure tests will pass. | ||||
| if options.coverage: | ||||
|     if args: | ||||
|     if options.args: | ||||
|         print('BAD ARGS! Coverage reports run against all files.') | ||||
|         sys.exit(1) | ||||
|  | ||||
| @@ -98,7 +99,7 @@ if options.coverage: | ||||
| else: | ||||
|     # Normal testing, no coverage analysis. | ||||
|     # Run the index.js test runner, which runs all the other tests. | ||||
|     command = ['node', '--stack-trace-limit=100', INDEX_JS] + args | ||||
|     command = ['node', '--stack-trace-limit=100', INDEX_JS] + options.args | ||||
|  | ||||
| print('Starting node tests...') | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user