I wouldn't pass the test here, even if the count eventually will be more than `1`, this code will be executed. I would demand the logic of the success / failure at the code that actually makes the test "done", so at the end of the test we check how many times the `attach` was fired. Something like:

```js
    onAttach: function() {
      if (++count === 1) {
        setImmediate(function() {
          sidebar.show().then(() => sidebar.hide()).then(null, assert.fail);
        });
      }
    },
    onHide: function() {
      if (count === 1)
        assert.pass('sidebar was attached once.')
      else
        assert.fail('sidebar was attached ' + count + 'times.');

      sidebar.destroy();
      done();
    }
```

However, both this version and the original are passing even without the changes in `sidebar/view.js`, where it should be fails.
I suspect that is because the first `sidebar.show()` executes somehow the code inside `onHide`, and therefore the tests always pass – the sidebar got destroyed and didn't have a chance to be attached twice. At least, this is happening on my machine: it could be a timing issue. Could you confirm that?