I upgraded a small app from ember-cli from 0.1.11 to 0.2.0 today. It took a couple hours. Here are some notes.
First, I read the release notes.
I recommend committing your changes right before running ember init
. That way, you can accept all the overwrites and easily discard the ones you don't want. kellyselden maintains a repo called ember-cli-output that tracks the changes in what ember init
generates over time. You can find the v0.2.0 changes here.
After selectively committing those changes, I had to also make the following changes to bower.json
:
- "ember": "v1.10.0-beta.4",
+ "ember": "v1.10.0",
- "ember-data": "1.0.0-beta.14.1",
+ "ember-data": "1.0.0-beta.15",
- "ember-qunit": "0.1.8",
+ "ember-qunit": "0.2.8",
- "ember-qunit-notifications": "0.0.5",
+ "ember-qunit-notifications": "0.0.7",
Then I ran rm -rf bower_components && bower install
to get the new versions.
Whenever you run ember build
, ember serve
, or ember test
, you'll see
The package `ember-data` is not a properly formatted package, we have used a fallback lookup to resolve it at `/Users/jamesarosen/Code/Tango/node_modules/ember-data`. This is generally caused by an addon not having a `main` entry point (or `index.js`).
That's a known issue. You can safely ignore it for now.
I found JSHint to be picker about unused variables after this upgrade. Thus, I had to change things like
import Ember from "ember";
export default Ember.Route.extend({
- beforeModel: function(transition) {
+ beforeModel: function() {
if (this.get('session.signedIn')) {
this.replaceWith('index');
}
}
});
The upgrade to ember-qunit comes with an upgrade to qunit itself. The most significant changes are that module
, test
, assert
, and ok
are no longer defined as globals.
For tests that aren't using moduleForModel
or moduleForComponent
, import module
and test
:
import { module, test } from "qunit";
assert
and ok
now hang off of an assert
object, which is passed in to the test
callback:
test('foo returns "bar"', function(assert) {
assert.equal(subject.get('foo'), "bar");
});
I had some component tests that did runtime template compilation:
var component;
moduleForComponent('popover-group', 'PopoverGroupComponent', {
setup: function() {
component = this.subject({
template: Ember.Handlebars.compile('content')
});
}
});
ember-template-compiler.js
is no longer included in the app by default. We don't use it in dev or when compiling for production. To add it just for the test environment, I added it in Brocfile.js
:
+app.import({
+ test: 'bower_components/ember/ember-template-compiler.js'
+});
I've opened an issue about this. My approach isn't the best, but it works for now.
"Pickier" ;)