ember-cli

How to debug ember-cli tests running in phantomjs

眉间皱痕 提交于 2019-12-20 09:46:08
问题 Context: I have an acceptance test for my ember-cli application, and the test passes just fine in Chrome. However, in phantomjs, my test fails -- the UI doesn't get created the same way, and I'm trying to work out why. (I think the test is broken because of https://github.com/ember-cli/ember-cli/issues/1763, but the general question of how to debug remains) In Chrome, I can use the standard debugging tools on my tests and all is well -- but in phantomjs, I can't get at it with a debugger. I

How to mock an Ember-CLI service in an acceptance test?

耗尽温柔 提交于 2019-12-20 08:56:44
问题 Quick summary/tldr: It seems that Ember's container lookup process + Ember-CLI's module resolver doesn't allow manually un-registering a service and then registering a replacement if the original service can be resolved using the resolver (I want to do the method described here, but it doesn't work) How can I mock an Ember-CLI service in an acceptance test without using a hacky, custom resolver? (example project/acceptance test here) Detailed explanation + example Create a new service that is

Ember serve: every port is in use

萝らか妹 提交于 2019-12-20 03:49:10
问题 When I specify no port or set the port explicitly, I always see: ember serve --port 4207 Port 4207 is already in use. It doesn't seem to matter which port I pick. When I start with port 0 (let the cli pick an available port) it starts on on something around 30000~40000. I am on a Mac. I just upgraded my ember-cli to 3.12.0 Also: If I start another ember app I have locally, it will run on port 4200. But then I stop it and start the above app and it won't start on that port. What is wrong here?

How to specify compression for custom build environment in Ember

吃可爱长大的小学妹 提交于 2019-12-20 03:42:32
问题 How do I specify compression, bundling and adding invalidation hashes to filenames for a custom environment? The production environment will automatically compress and consolidate files and add invalidation hashes to the file names. I.e. whenever I use ember build --environment=production to trigger the if (environment === 'production'){} case in config/environment.js But I want to create and build for a QA environment that also compresses files and adds invalidation hashes to file names. I.e

Square brackets surrounding parameter in function definition

寵の児 提交于 2019-12-19 01:15:05
问题 I came across the following code in the Ember CLI website: export default Ember.Helper.helper(function([value]) { return value.toUpperCase(); }); What confuses me is the square brackets surrounding the value parameter. I can understand it in a function call, but why in function definition? 回答1: This is all very surprising to me, but it appears to be valid javascript, according to the ECMAScript 2017 language specification, the formal parameter in a function declaration can any "binding

Square brackets surrounding parameter in function definition

↘锁芯ラ 提交于 2019-12-19 01:14:35
问题 I came across the following code in the Ember CLI website: export default Ember.Helper.helper(function([value]) { return value.toUpperCase(); }); What confuses me is the square brackets surrounding the value parameter. I can understand it in a function call, but why in function definition? 回答1: This is all very surprising to me, but it appears to be valid javascript, according to the ECMAScript 2017 language specification, the formal parameter in a function declaration can any "binding

ember-cli --proxy works for GET but fails on PUT and POST

我只是一个虾纸丫 提交于 2019-12-18 20:08:10
问题 I'm trying to move my application from Ember Appkit to ember-cli and I'm having trouble replicating the proxy functionality previously provided by the APIMethod and proxyURL methods. I'm starting the server to proxy to localhost:3000 ember serve --proxy http://localhost:3000/ This will read my data from the rails server correctly. However, when I try to write to the server, I get an error message POST http://localhost:4200/api/v1/posts 408 (Request Time-out) It's trying to post to port 4200,

ember render hbs swallowing thrown error

守給你的承諾、 提交于 2019-12-18 16:55:28
问题 I have a simple component integration test: test('it throws error my-custom-input is called', function(assert) { assert.throws(() => { this.render(hbs`{{my-custom-input}}`); }, /my-custom-input component error/, 'Error must have been thrown'); }); Source code of component.js is like: export default Ember.Component.extend({ layout, init() { this._super(...arguments); throw 'my-custom-input component error'; } } While my ember-cli version was 2.3.0, the test was passing. However, after I've

ember-cli meta config/environment file

亡梦爱人 提交于 2019-12-18 14:52:08
问题 I'm using ember-cli to structure my app. It compiles all the files to the dist/ directory. However as I inspected the compiled index.html I noticed it was creating this meta tag. <meta name="user/config/environment" content="%7B%22modulePrefix%22%3A%22user%22%2C%22environment%22%3A%22development%22%2C%22baseURL%22%3A%22/%22%2C%22locationType%22%3A%22auto%22%2C%22contentSecurityPolicy%22%3A%7B%22default-src%22%3A%22%27none%27%20localhost%22%2C%22script-src%22%3A%22%27self%27%20%27unsafe-inline

Ember CLI: where to reopen framework classes

扶醉桌前 提交于 2019-12-18 12:48:03
问题 I'd like to reopen Ember or Ember Data framework classes. Using Ember CLI, where is the right place to put these so that they get initialized property? Here's an example of something I'd like to do: import DS from 'ember-data'; DS.Model.reopen({ rollback: function() { this._super(); // do some additional stuff } }); 回答1: I think the best way to execute modules that have side effects would be to create an initializer. Something like this: // app/initializers/modify-model.js import DS from