tricknotes / ember-cli-rails

Unify your EmberCLI and Rails Workflows
http://thoughtbot.github.io/ember-cli-rails/
MIT License
713 stars 205 forks source link

Build and Compile for Test Environment #556

Open smolnar opened 6 years ago

smolnar commented 6 years ago

Which operating system and version is the project developed on? macOS 10.12.6

Which version of ruby is the project developed on? Ruby 2.4.2

Which version of npm is the project developed on? 4.2.0

Which version of ember-cli is the project developed on? 2.14.0

What is the rails version? 4.2.10

What is the ember-cli-rails version (from Gemfile)? 0.10.0

What is the ember-cli-rails-addon version (from package.json)? 0.10.0

Is your application server multi-threaded (such as puma and unicorn) or is it multi-process (such as thin and webrick)? Puma, multi-threaded

What are the contents of config/initializers/ember.rb?

EmberCli.configure do |c|
  c.app :frontend, yarn: true
end

What are the contents of the Rails' view that renders the Ember application? Default

How are the EmberCLI-related routes defined?

mount_ember_app :frontend, to: '/'

How is the application deployed? Capistrano + ember-cli-deploy

What is the issue?

We're running a Rails server for our Capybara specs to cut down on a time of a first build of our Ember app, so the server is still running in-between the specs as well and Capybara is not responsible for spawning it. As we're writing the specs, we're sometimes changing the code and as you can see in here

# ember-cli-rails/lib/ember_cli/app.rb

def build
  unless EmberCli.skip?
    if development?
      build_and_watch
    elsif test?
      compile
    end

    @build.wait!
  end
end

the test environment only supports compilation, so our changes after starting the server are not propagated and therefore we are forced to restart the server. Is it possible to provide an option for this, e.g.

```ruby
EmberCli.configure do |c|
  c.app :frontend, yarn: true, build_and_watch: 'always' # other options: ['development', 'test'] or 'test' 
end

so the build_and_watch works for other environments as well? We're happy to provide a PR of this as well, just want to hear your opinion.