use ui.writeError in lib/cli/cli.js

fixes GH-2254
would should keep (or something like it):

```js
if (this.testing && error) {
  console.error(error.message);
  console.error(error.stack);
}
```

or when something breaks in testing, it is very hard to see.