added tests for events; removed --bail option from test command
improved tests; added toJSON override.