give better messages with javascript errors
This commit is contained in:
parent
ccafb37bbe
commit
3f630c73e9
@ -248,7 +248,13 @@ void HeadlessSpecRunner::finishSuite(const QString &duration, const QString &tot
|
||||
std::cout << "FAIL: ";
|
||||
} else {
|
||||
green();
|
||||
std::cout << "PASS: ";
|
||||
std::cout << "PASS";
|
||||
|
||||
if (hasErrors) {
|
||||
std::cout << " with JS errors";
|
||||
}
|
||||
|
||||
std::cout << ": ";
|
||||
}
|
||||
|
||||
std::cout << qPrintable(total) << " tests, " << qPrintable(failed) << " failures, " << qPrintable(duration) << " secs.";
|
||||
@ -280,10 +286,9 @@ void HeadlessSpecRunner::timerEvent(QTimerEvent *event)
|
||||
if (hasErrors && m_runs > 2)
|
||||
QApplication::instance()->exit(1);
|
||||
|
||||
if (!hasErrors) {
|
||||
if (isFinished) {
|
||||
int exitCode = 0;
|
||||
if (didFail) {
|
||||
if (didFail || hasErrors) {
|
||||
exitCode = 1;
|
||||
} else {
|
||||
if (usedConsole) {
|
||||
@ -298,7 +303,6 @@ void HeadlessSpecRunner::timerEvent(QTimerEvent *event)
|
||||
std::cout << "WARNING: too many runs and the test is still not finished!" << std::endl;
|
||||
QApplication::instance()->exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "specrunner.moc"
|
||||
|
@ -24,6 +24,20 @@ describe "jasmine-headless-webkit" do
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe 'success but with js error' do
|
||||
it "should succeed with error code 0" do
|
||||
system %{bin/jasmine-headless-webkit -j spec/jasmine/success_with_error/success_with_error.yml --report #{report}}
|
||||
$?.exitstatus.should == 1
|
||||
|
||||
parts = File.read(report).strip.split('/')
|
||||
parts.length.should == 4
|
||||
parts[0].should == "1"
|
||||
parts[1].should == "0"
|
||||
parts[2].should == "F"
|
||||
end
|
||||
end
|
||||
|
||||
describe 'failure' do
|
||||
it "should fail with an error code of 1" do
|
||||
system %{bin/jasmine-headless-webkit -j spec/jasmine/failure/failure.yml --report #{report}}
|
||||
|
3
spec/jasmine/success_with_error/success_with_error.js
Normal file
3
spec/jasmine/success_with_error/success_with_error.js
Normal file
@ -0,0 +1,3 @@
|
||||
var good = 2;
|
||||
var bad = null;
|
||||
if (bad.myProperty) {}
|
9
spec/jasmine/success_with_error/success_with_error.yml
Normal file
9
spec/jasmine/success_with_error/success_with_error.yml
Normal file
@ -0,0 +1,9 @@
|
||||
src_files:
|
||||
- spec/jasmine/success_with_error/success_with_error.js
|
||||
|
||||
spec_files:
|
||||
- spec/jasmine/success_with_error/success_with_error_spec.js
|
||||
|
||||
src_dir: .
|
||||
spec_dir: .
|
||||
|
@ -0,0 +1,6 @@
|
||||
describe('Success with error', function() {
|
||||
it("should not fail", function() {
|
||||
expect(good).toEqual(2);
|
||||
})
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user