avoid / capture / verify a Javascript alert when testing a method that displays one with qunit
问题 I'm just starting using Qunit and would like to know whether is there a way to capture/verify/omit alerts, For example: function to_test() { alert("I'm displaying an alert"); return 42; } and then have something like: test("to_test", function() { //in this case I'd like to test the alert. alerts("I'm displaying an alert", to_test(), "to_test() should display an alert"); equals(42, to_test(), "to_test() should return 42" ); // in this case I'd like to omit the alert }); I'm open to the