Quantcast
Viewing all articles
Browse latest Browse all 4827

How to stub imported Ember functions?

@BlueRaja wrote:

The old syntax looked like this:

import Ember from 'ember';
...
Ember.Logger.warn(...);

which was easy to stub using sinon. However, the new syntax:

import { warn } from '@ember/debug';
...
warn(...);

is not so easy to mock. How do I stub in this case?


I tried this in my test file:

import * as EmberDebug from '@ember/debug';
...
sinon.stub(EmberDebug, 'warn');

but then I get this error:

Error: Could not find module `@ember/debug` imported from `my-project/tests/unit/pods/components/my-component/component-test`

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4827

Trending Articles