Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

--suppress-web-console option #628

Closed
wants to merge 7 commits into from

2 participants

@watinha

Simple changes to pass the command line option --suppress-web-console (for "cfx test" command) up to harness.js. When this option is set, all web-console messages (such as "[JavaScript Warning...", "Invalid chrome URI:" or "OpenGL LayerManager..."), will not appear in the command line, when running the cfx test command.

I am not sure if this is useful to anyone else ;)

@Gozala
Owner

This looks great, thans! Although it there seems to be some merging conflicts. Could you please merge with master so we can land it ?

Thanks!

@watinha

Hey Gozala, just did the merge. I also fixed an issue that this pull request caused, that prevented tests from showing the correct stack trace, since there was an error while printing it.

@Gozala
Owner

Thank a lot @watinha sorry to take so long to come back to you. Please make sure to mention @gozala or whoever is involved in the pull request in a future, that way mentioned user is notified about updates in pull request & will react promptly.

@Gozala Gozala closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
1  app-extension/bootstrap.js
@@ -172,6 +172,7 @@ function startup(data, reasonCode) {
filter: options.filter,
profileMemory: options.profileMemory,
stopOnError: options.stopOnError,
+ suppressWebConsole: options.suppressWebConsole,
verbose: options.verbose,
}
}
View
11 lib/sdk/test/harness.js
@@ -39,6 +39,10 @@ var profileMemory;
// Whether we should stop as soon as a test reports a failure.
var stopOnError;
+// Whether we should print web console logs from the browser
+// in the command-line
+var suppressWebConsole;
+
// Function to call to retrieve a list of tests to execute
var findAndRunTests;
@@ -298,12 +302,14 @@ var runTests = exports.runTests = function runTests(options) {
iterationsLeft = options.iterations;
profileMemory = options.profileMemory;
stopOnError = options.stopOnError;
+ suppressWebConsole = options.suppressWebConsole;
onDone = options.onDone;
print = options.print;
findAndRunTests = options.findAndRunTests;
try {
- cService.registerListener(consoleListener);
+ if (!suppressWebConsole)
+ cService.registerListener(consoleListener);
print("Running tests on " + system.name + " " + system.version +
"/Gecko " + system.platformVersion + " (" +
system.id + ") under " +
@@ -322,6 +328,7 @@ var runTests = exports.runTests = function runTests(options) {
};
unload(function() {
- cService.unregisterListener(consoleListener);
+ if (!suppressWebConsole)
+ cService.unregisterListener(consoleListener);
});
View
3  lib/sdk/test/runner.js
@@ -38,6 +38,7 @@ function runTests(findAndRunTests) {
filter: cfxArgs.filter,
profileMemory: cfxArgs.profileMemory,
stopOnError: cfxArgs.stopOnError,
+ suppressWebConsole: cfxArgs.suppressWebConsole,
verbose: cfxArgs.verbose,
print: stdout.write,
onDone: onDone
@@ -59,7 +60,7 @@ function printFailedTests(tests, verbose, print) {
iterationNumber++;
if (!singleIteration)
- print(" Iteration " + iterationNumber + ":\n");
+ print(" Iteration " + iterationNumber + ":\n");
for each (let test in testRun) {
if (test.failed > 0) {
View
11 python-lib/cuddlefish/__init__.py
@@ -194,6 +194,12 @@
metavar=None,
default=False,
cmds=['test', 'testex', 'testpkgs'])),
+ (("", "--suppress-web-console",), dict(dest="suppressWebConsole",
+ help="Prevent web console logs in command line",
+ action="store_true",
+ metavar=None,
+ default=False,
+ cmds=['test'])),
(("", "--override-version",), dict(dest="override_version",
help="Pass in a version string to use in generated docs",
metavar=None,
@@ -521,7 +527,7 @@ def initializer(env_root, args, out=sys.stdout, err=sys.stderr):
print >>out, 'Do "cfx test" to test it and "cfx run" to try it. Have fun!'
else:
print >>out, '\nYour sample add-on is now ready in the \'' + args[1] + '\' directory.'
- print >>out, 'Change to that directory, then do "cfx test" to test it, \nand "cfx run" to try it. Have fun!'
+ print >>out, 'Change to that directory, then do "cfx test" to test it, \nand "cfx run" to try it. Have fun!'
return 0
def buildJID(target_cfg):
@@ -550,7 +556,6 @@ def run(arguments=sys.argv[1:], target_cfg=None, pkg_cfg=None,
(options, args) = parse_args(**parser_kwargs)
config_args = get_config_args(options.config, env_root);
-
# reparse configs with arguments from local.json
if config_args:
parser_kwargs['arguments'] += config_args
@@ -632,7 +637,7 @@ def run(arguments=sys.argv[1:], target_cfg=None, pkg_cfg=None,
if 'tests' not in target_cfg:
target_cfg['tests'] = []
inherited_options.extend(['iterations', 'filter', 'profileMemory',
- 'stopOnError'])
+ 'stopOnError', 'suppressWebConsole'])
enforce_timeouts = True
elif command == "run":
use_main = True
Something went wrong with that request. Please try again.