Can I use "ember generate" to generate tests for existing "objects"?

I have an Ember EAK project ported to the Ember CLI with tests coded for the mocha / chai test runner not starting correctly in the ported project, even though I installed ember-cli-mocha. Can I use "ember generate", with mocha blueprints, to generate new test stubs where I can go in and more or less reimplement what I had with tests in EAK?

Therefore, I want to use "ember generate" to generate tests for existing routes, controllers and views, not create new stub objects and tests.

+3


source to share


2 answers


Yes, you can actually do this using blueprints ember generate

controller-test

, route-test

etc.

ember generate controller-test my-resource

      



This is documented at http://www.ember-cli.com/#appendix . This is a feature of ember-cli, not an ember feature, so the documentation for the former. More information can be obtained using ember generate help

.

+5


source


Try to run

ember g component-test component-module-name ember g component-test component-module-name --unit

ember g component-test --help



Display

ember generate <blueprint> <options...>
  Generates new code from blueprints.
  aliases: g
  --dry-run (Boolean) (Default: false)
    aliases: -d
  --verbose (Boolean) (Default: false)
    aliases: -v
  --pod (Boolean) (Default: false)
    aliases: -p
  --classic (Boolean) (Default: false)
    aliases: -c
  --dummy (Boolean) (Default: false)
    aliases: -dum, -id
  --in-repo-addon (String) (Default: null)
    aliases: --in-repo <value>, -ir <value>

      component-test <name> <options...>
        Generates a component integration or unit test.
        --test-type (integration, unit) (Default: integration)
          aliases: -i (--test-type=integration), -u (--test-type=unit), --integration (--test-type=integration), -unit (--test-type=unit)

      

+1


source







All Articles