Skip to content

Commit

Permalink
Tied the functionality to the --bail_on_uncaught_error or -b option.
Browse files Browse the repository at this point in the history
  • Loading branch information
airportyh committed Oct 6, 2014
1 parent d29cc1d commit 27dfc64
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
18 changes: 11 additions & 7 deletions lib/ci/browser_test_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,22 @@ BrowserTestRunner.prototype = {
tryAttach: function(browser, id, socket){
this.id = id
this.browserName = browser
var self = this
if (id == this.launcher.id){
socket.on('test-result', this.onTestResult.bind(this))
socket.on('log', function(log){this.logs.push(log)}.bind(this))
socket.once('all-test-results', this.onAllTestResults.bind(this))
socket.on('top-level-error', function(msg,url,line){
self.reporter.report(self.browserName, {
passed: false,
name: 'Global error: ' + msg + ' at ' + url + ', line ' + line + '\n',
logs: [],
error: {}
var config = this.launcher.config
if (config.get('bail_on_uncaught_error')){
socket.on('top-level-error', function(msg, url, line){
self.reporter.report(self.browserName, {
passed: false,
name: 'Global error: ' + msg + ' at ' + url + ', line ' + line + '\n',
logs: [],
error: {}
})
})
}.bind(this))
}
var tap = new BrowserTapConsumer(socket)
tap.on('test-result', this.onTestResult.bind(this))
tap.on('all-test-results', this.onAllTestResults.bind(this))
Expand Down
16 changes: 1 addition & 15 deletions testcases/top_level_error/hello_tests.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
/*test('says hello world', function(){
test('says hello world', function(){
equal(hello(), 'hello world', 'should equal hello world');
});

test('says hello to person', function(){
equal(hello('Bob'), 'hello Bob', 'should equal hello Bob');
});
*/
for (var i = 0; i < 10; i++)
console.log('hello world')
describe('hello', function(){
it('should say hello', function(){
expect(hello()).toBe('hello world');
waits(200);
});
it('should say hello to person', function(){
expect(hello('Bob')).toBe('hello Bob');
waits(200);
});
});

0 comments on commit 27dfc64

Please sign in to comment.