Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4870

Embroider advice for static js addon inclusions for tests

$
0
0

Hi! We are currently trying to port our application over to using embroider as a build system.

Our first exercise is working on our addons to make them “embroider-safe”.

We have an addon that provides test support utilities, and one of the things it provides is a static javascript file that contains static fixtures for pretender. This javascript file is not imported by its callers, it rather is saved to a global variable at script evaluation and accessed that way.

currently we create this javascript file by conbining all the fixture files and apply babel using broccoli in the index file of the addon, and put the result in public/assets. Then other addons and our app just pull in the file via script tag in their test index.html, which triggers the script eval and saving to global.

Where this gets complicated is the static javascript file makes use of momentjs to format some date fields. The old addon format “figures this out” and is able to successfully reference moment when used by other addons and our app.

This approach seems to be less successful in embroider, as it has trouble resolving moment from the other addons and the app, even though moment is a dependency and is able to be referenced in local files.

I guess my question is, acknowledging this legacy approach might not be ideal, what is a preferred way to import static fixtures from a test support addon. Do I just move these fixtures into test-support and start importing them when used? That would be a heavy update since we have thousands of tests that use these fixtures. Just trying to figure out what my options are.

4 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 4870

Trending Articles