From 6b4f3b038697f3fc12ca4485abaf7ea67e9c9504 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Thu, 15 Mar 2012 10:24:57 -0700 Subject: [PATCH] Use --headless arg to enable console reporter and exit on finish. --- Atom/src/Atom.mm | 16 +++++++--------- Rakefile | 4 ++-- spec/spec-bootstrap.coffee | 5 ++--- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Atom/src/Atom.mm b/Atom/src/Atom.mm index 0fecdd337..b3f2449ed 100755 --- a/Atom/src/Atom.mm +++ b/Atom/src/Atom.mm @@ -84,13 +84,6 @@ } -- (void)exitAfterSpecs { - [self modifyJavaScript:^(CefRefPtr context, CefRefPtr global) { - CefRefPtr atom = context->GetGlobal()->GetValue("atom"); - atom->SetValue("exitAfterSpecs", CefV8Value::CreateBool(YES), V8_PROPERTY_ATTRIBUTE_NONE); - }]; -} - - (CefRefPtr)atomContext { return _clientHandler->GetBrowser()->GetMainFrame()->GetV8Context(); } @@ -122,13 +115,18 @@ } - (void)loadEnd { + if ([[[NSProcessInfo processInfo] arguments] containsObject:@"--headless"]) { + [self modifyJavaScript:^(CefRefPtr context, CefRefPtr global) { + CefRefPtr atom = context->GetGlobal()->GetValue("atom"); + atom->SetValue("headless", CefV8Value::CreateBool(YES), V8_PROPERTY_ATTRIBUTE_NONE); + }]; + } + if ([[[NSProcessInfo processInfo] arguments] containsObject:@"--benchmark"]) { - [self exitAfterSpecs]; [self runBenchmarks:self]; } if ([[[NSProcessInfo processInfo] arguments] containsObject:@"--test"]) { - [self exitAfterSpecs]; [self runSpecs:self]; } } diff --git a/Rakefile b/Rakefile index dc0ebebf1..06fd0b2ad 100644 --- a/Rakefile +++ b/Rakefile @@ -32,13 +32,13 @@ end desc "Run the specs" task :test do - $ATOM_ARGS.push "--test" + $ATOM_ARGS.push "--test", "--headless" Rake::Task["run"].invoke end desc "Run the benchmarks" task :benchmark do - $ATOM_ARGS.push "--benchmark" + $ATOM_ARGS.append "--benchmark", "--headless" Rake::Task["run"].invoke end diff --git a/spec/spec-bootstrap.coffee b/spec/spec-bootstrap.coffee index 0d7b573e0..fd6437860 100644 --- a/spec/spec-bootstrap.coffee +++ b/spec/spec-bootstrap.coffee @@ -14,7 +14,7 @@ $('head').append $$ -> $('body').append $$ -> @div id: 'jasmine-content' -reporter = if atom.exitAfterSpecs +reporter = if atom.headless new jasmine.ConsoleReporter(document) else new jasmine.AtomReporter(document) @@ -23,5 +23,4 @@ require 'spec-suite' jasmineEnv = jasmine.getEnv() jasmineEnv.addReporter(reporter) jasmineEnv.specFilter = (spec) -> reporter.specFilter(spec) -jasmineEnv.execute() - +jasmineEnv.execute() \ No newline at end of file