Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make uncaught (top-level) errors float to the top. #157.

  • Loading branch information...
commit 5ad83a5a04019d49469f07b8671094295ba73305 1 parent 3c1fca0
@airportyh authored
View
6 lib/runners.js
@@ -71,11 +71,11 @@ var BrowserRunner = Backbone.Model.extend({
var app = this.get('app')
var server = app.server
socket.on('top-level-error', function(msg, url, line){
- var message = msg + ' at ' + url + ', line ' + line + '\n'
- messages.push({
+ var message = 'Uncaught ' + msg + ' at ' + url + ', line ' + line + '\n'
+ messages.add({
type: 'error'
, text: message
- })
+ }, {at: 0})
})
socket.on('error', function(message){
messages.push({
View
6 testcases/top_level_error/hello.js
@@ -0,0 +1,6 @@
+function hello(name){
+ setTimeout(function(){
+ throw new Error('This is a top level error baby!');
+ }, 1);
+ return 'hello ' + (name || 'world');
+}
View
21 testcases/top_level_error/hello_tests.js
@@ -0,0 +1,21 @@
+/*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);
+ });
+});
View
3  testcases/top_level_error/testem.json
@@ -0,0 +1,3 @@
+{
+ "framework": "jasmine"
+}
Please sign in to comment.
Something went wrong with that request. Please try again.