ember-codemods / ember-modules-codemod

Codemod to upgrade Ember apps to JavaScript (ES6) modules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sinon.stub(Ember, '$') does not transform properly

opened this issue · comments

Using sinon to stub Ember.$ does not get transformed properly. The real issue is that a proper transformation does not guarantee the same behavior so that would lend weight to not "fixing" this.

const jQ = this._sandbox.stub(Ember, '$').callsFake(someFunc);

I recreated a failing test here: https://github.com/efx/ember-modules-codemod/tree/topic-stubbed
Posting an issue for other users. If this gets more weight I can take a stab at fixing it again.

The real issue is that a proper transformation does not guarantee the same behavior so that would lend weight to not "fixing" this.

I agree. I think the fix for this is in the app that does this. Stubbing like this is pretty brittle, and there really isn't an obvious work around for the codemod to take.

Apologies, but I think this one is going to end up being a "won't fix".