Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to tweak Ember blueprints

When writing acceptance tests for our application, we use ember generate to stub out the test (ember generate acceptance-test <name>).

The next step is typically to modify the generated test to call ember-simple-auth-testing's authenticateSession() in the module block (and most likely perform some setup with ember-data-factory-guy).

What I would like to do is make a slight tweak to the acceptance-test blueprint's template, however I can't seem to find any documentation on how to extend blueprints.

Does anyone know if any such documentation exists, or how I might go about doing this?

Thanks!

like image 649
Matt d' Avatar asked Feb 09 '23 05:02

Matt d'


1 Answers

You can't extend one, but you can overwrite one. From the Ember CLI docs on blueprints:

Blueprints in your project’s directory take precedence over those packaged with ember-cli. This makes it easy to override the built-in blueprints just by generating one with the same name.

So just run the following command, then modify the templates as you see fit:

ember generate blueprint acceptance-test

You can find the Ember CLI acceptance-test blueprint here. That should be a good reference for writing yours. Also be sure to read the entire section on blueprints in the documentation that I linked to — that should get you familiar with how to write a blueprint.

There is an issue under ember-cli/blueprint about the possibility of supporting 'extend' for blueprints.

like image 104
GJK Avatar answered Mar 08 '23 13:03

GJK