You could do something like this:
var exeptionReached = false;
try {
$.parseJSON($('#ps-data').data().ps);
} catch(e) {
exceptionReached = true;
}
console.log(exceptionReached); //will be true if `parseJSON()` threw an exception
Use qunit to assert exception was reached... or you can save something from the exception object if you want to assume something specific about it, for example:
var ex;
try {
$.parseJSON($('#ps-data').data().ps);
} catch(e) {
ex = e;
}
console.log(ex.message); // something like "Unexpected token ,"
You'll want to check that ex is defined before accessing properties of course. I think you should be able to see how you can test whether or not an exception happened and how to test specifics about that exception if you want... but let me know if you have any extra questions.