You can just register it for the test only using $provide.

```js
describe('ui.bootstrap.typeahead', function() {
  beforeEach(module('ui.bootstrap.typeahead', function($provide) {
    $provide.directive('formatter', function() {
      ...
    });
  });
});
```