Skip to content

Commit ad362b1

Browse files
committed
Merge pull request ember-cli#865 from rjackson/print-rebuild-times
Print build times for `ember server`.
2 parents 933d7dd + 80a5a8f commit ad362b1

3 files changed

Lines changed: 7 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* [ENHANCEMENT] Add broccoli-asset-rev for fingerprinting + source re-writing. [#814](https://github.com/stefanpenner/ember-cli/pull/814)
1616
* [BUGFIX] Prevent broccoli from watching `node_modules/ember-cli/lib/broccoli/`. [#857](https://github.com/stefanpenner/ember-cli/pull/857)
1717
* [BUGFIX] Prevent collision between running `ember server` and `ember test --server` simultaneously. [#862](https://github.com/stefanpenner/ember-cli/pull/862)
18+
* [ENHANCEMENT] Show timing and slow tree listing for each rebuild. [#860](https://github.com/stefanpenner/ember-cli/pull/860) & [#865](https://github.com/stefanpenner/ember-cli/pull/865)
1819

1920
### 0.0.28
2021

lib/models/watcher.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@ module.exports = Task.extend({
1212

1313
this.watcher.on('error', this.didError.bind(this));
1414
this.watcher.on('change', this.didChange.bind(this));
15-
16-
this._lastError = null;
1715
},
1816

1917
didError: function(error) {
20-
this._lastError = error;
21-
2218
this.analytics.trackError({
2319
description: error && error.message
2420
});
@@ -29,12 +25,9 @@ module.exports = Task.extend({
2925
},
3026

3127
didChange: function(results) {
32-
var totalTime = results.totalTime;
28+
var totalTime = results.totalTime / 1e6;
3329

34-
if (this._lastError) {
35-
this._lastError = null;
36-
this.ui.write(chalk.green('\n\nBuild successful.\n'));
37-
}
30+
this.ui.write(chalk.green('\nBuild successful - ' + Math.round(totalTime) + 'ms.\n'));
3831

3932
this.analytics.track({
4033
name: 'ember rebuild',

tests/unit/models/watcher-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('Watcher', function() {
3030
describe('watcher:change', function() {
3131
beforeEach(function() {
3232
watcher.emit('change', {
33-
totalTime: 12344
33+
totalTime: 12344000000
3434
});
3535
});
3636

@@ -49,8 +49,8 @@ describe('Watcher', function() {
4949
}]);
5050
});
5151

52-
it('logs nothing', function() {
53-
assert.equal(ui.output.length, 0);
52+
it('logs that the build was successful', function() {
53+
assert.equal(ui.output, '\u001b[32m\nBuild successful - 12344ms.\n\u001b[39m');
5454
});
5555
});
5656

@@ -77,7 +77,7 @@ describe('Watcher', function() {
7777
});
7878

7979
watcher.emit('change', {
80-
totalTime: 12344
80+
totalTime: 12344000000
8181
});
8282
});
8383

0 commit comments

Comments
 (0)