Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions logged as null #640

Closed
futuraprime opened this issue Jul 15, 2013 · 1 comment
Closed

Functions logged as null #640

futuraprime opened this issue Jul 15, 2013 · 1 comment

Comments

@futuraprime
Copy link

I've been significantly frustrated in debugging tests because Karma's logs report null whenever they see a function, e.g.

console.log("this is a function:", function() { return 'wat'; });

yields

Chrome 28.0 (Mac) LOG: [ 'this is a function:', null ]

whereas inside the debug view in Chrome, it correctly logs the function. Worse, where it's seeing null everywhere it quashes objects, so this mock:

var App = function() {
  return {
    pageController : {
      currentPage : {
        on : function() {},
        toJSON : function() {},
        get : function() {
          return dark;
        }
      }
    },
    mainLayout : {
      header : {
        show : function() {},
        $el : {}
      }
    }
  };
};

console.log("in test", App());

is logged out as:

Chrome 28.0 (Mac) LOG: [ 'in test',
  { pageController: {},
    mainLayout: { header: [Object] } } ]

where pageController is inaccurately shown as an empty object. (Again, in Chrome's debugger, the log correctly reflects what's going on.)

@vojtajina
Copy link
Contributor

Yep, we need to fix this. Currently everything is serialized with
JSON.stringify, which is lame.

On Mon, Jul 15, 2013 at 2:24 PM, Evan Hensleigh notifications@github.comwrote:

I've been significantly frustrated in debugging tests because Karma's logs
report null whenever they see a function, e.g.

console.log("this is a function:", function() { return 'wat'; });

yields

Chrome 28.0 (Mac) LOG: [ 'this is a function:', null ]

whereas inside the debug view in Chrome, it correctly logs the function.
Worse, where it's seeing null everywhere it quashes objects, so this mock:

var App = function() {
return {
pageController : {
currentPage : {
on : function() {},
toJSON : function() {},
get : function() {
return dark;
}
}
},
mainLayout : {
header : {
show : function() {},
$el : {}
}
}
};
};

console.log("in test", App());

is logged out as:

Chrome 28.0 (Mac) LOG: [ 'in test',
{ pageController: {},
mainLayout: { header: [Object] } } ]

where pageController is inaccurately shown as an empty object. (Again, in
Chrome's debugger, the log correctly reflects what's going on.)


Reply to this email directly or view it on GitHubhttps://github.com//issues/640
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants