Closed jaswilli closed 2 years ago
Thanks for the report and the details. Personally, I almost had removed the initializer, however I didn't because I wasn't sure if this would make upgrading unnecessarily difficult. Yet, I didn't expect it to break in such a way. Could you please submit a PR including instructions how to set up tests without the initializer?
I'm having the same issue here:
node 14.19
"ember-source": "3.28.1"
"@adopted-ember-addons/ember-stripe-elements": "2.0.2"
"ember-auto-import": "2.4.0",
@esbanarango thanks for the report. All I can offer at the moment is to release a version without the initialiser. However, that would put the burden of how to figure out test support on everyone who needs test support. Therefore I would prefer to include an upgrade path (at least in the form of a section in the README). However, at the moment I have very limited time to figure that out and write that down. So, if someone can submit a PR, that would help speed things up tremendously.
@st-h here it is: https://github.com/adopted-ember-addons/ember-stripe-elements/pull/41
@esbanarango Thanks for picking this up, I hadn't had a chance to get back to it yet.
Thanks a lot. Released as 2.0.3
Hi,
Do we know for certain that the dynamic import from the app initializer is supported by ember auto import and that it's working as expected? I'm trying to move an app over from the old version of this addon to the one here (in the adopted-ember-addons namespace) and so far I've been unable to get tests working because when the app boots up it blows up on the dynamic import in the app initializer (https://github.com/adopted-ember-addons/ember-stripe-elements/blob/master/app/initializers/ember-stripe-elements.js) like so:
I'm using dynamic import elsewhere in the app in question so I'm pretty sure I have things configured correctly. Also, here's a minimal reproduction of what I'm seeing: https://github.com/jaswilli/stripetest.
Of note is that if I remove the initializer and just
import StripeMock from '@adopted-ember-addons/ember-stripe-elements/test-support';
from within a test and assignStripeMock
towindow
from within abeforeEach
hook things work as expected, so I think the test helpers themselves are fine.According to this issue https://github.com/ef4/ember-auto-import/issues/488 ember auto import is unable to dynamically import libraries through a v1 addon, which as far as I know is what we're seeing here. It's completely possible I'm misunderstanding some nuance though.
Assuming I'm not missing something and this is actually broken, should we remove the initializer and instead document how to wire up the
StripeMock
inside a test hook?