Use --headless arg to enable console reporter and exit on finish.

This commit is contained in:
Corey Johnson
2012-03-15 10:24:57 -07:00
parent 80641636f9
commit 6b4f3b0386
3 changed files with 11 additions and 14 deletions

View File

@@ -84,13 +84,6 @@
}
- (void)exitAfterSpecs {
[self modifyJavaScript:^(CefRefPtr<CefV8Context> context, CefRefPtr<CefV8Value> global) {
CefRefPtr<CefV8Value> atom = context->GetGlobal()->GetValue("atom");
atom->SetValue("exitAfterSpecs", CefV8Value::CreateBool(YES), V8_PROPERTY_ATTRIBUTE_NONE);
}];
}
- (CefRefPtr<CefV8Context>)atomContext {
return _clientHandler->GetBrowser()->GetMainFrame()->GetV8Context();
}
@@ -122,13 +115,18 @@
}
- (void)loadEnd {
if ([[[NSProcessInfo processInfo] arguments] containsObject:@"--headless"]) {
[self modifyJavaScript:^(CefRefPtr<CefV8Context> context, CefRefPtr<CefV8Value> global) {
CefRefPtr<CefV8Value> 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];
}
}

View File

@@ -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

View File

@@ -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()