Commit fb304b7d fb304b7d95401947cc0fd3c5661abb768f1b0d38 by Nicolas Perriault

fixes #704 - provide an 'exit' tester event to hook before runner exits

casper.test.on("exit", function() {
  console.log("exited");
})

casper.test.begin("sample", function(test) {
  test.assert(true);
  test.done();
});

will print "exited" on the last line of the output.
1 parent 3428e039
......@@ -1524,6 +1524,7 @@ Tester.prototype.renderResults = function renderResults(exit, status, save) {
this.saveResults(save);
}
if (exit === true) {
this.emit("exit");
this.casper.exit(status ? ~~status : exitStatus);
}
};
......
......@@ -317,6 +317,11 @@ class TestCommandOutputTest(CasperExecTestBase):
], failing=True)
@timeout(20)
def test_exit_test(self):
script_path = os.path.join(TEST_ROOT, 'tester', 'exit.js')
self.assertCommandOutputContains('test ' + script_path, ['exited'])
@timeout(20)
def test_skipped_test(self):
script_path = os.path.join(TEST_ROOT, 'tester', 'skipped.js')
self.assertCommandOutputContains('test ' + script_path, [
......