sindresorhus / time-grunt

Display the elapsed execution time of grunt tasks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

item shows up twice, second is after Total

dylang opened this issue · comments

For example:

Elapsed time
test            422ms
mochaTest:unit  48ms
Total           470ms
mochaTest:unit  48ms

Unfortunately I don't have a public repo to demonstrate this.

make sure you're on the latest version.

Just started this project.

~/opower/x-web/x-web-task-collection ✗ WEB-1885-innovation-day ❯ npm ls time-grunt
x-web-task-collection@0.0.0 /Users/dgreene/opower/x-web/x-web-task-collection
└── time-grunt@0.1.1

Seems like it only happens with async tasks, and only the last one.

lapsed time
jshint        315ms
jshint:grunt  33ms
jshint:test   58ms
Total         406ms
jshint:test   58ms

vs

Elapsed time
test            316ms
jshint:grunt    91ms
jshint:src      25ms
jshint:test     30ms
mochaTest:unit  40ms
Total           502ms
mochaTest:unit  40ms

It seems to be happening when this is called:

grunt.log.header('Elapsed time');

So maybe the unhook is not working as expected.

A possible workaround is to return early from the header hook if name is undefined.

Another possible workaround is to make sure the original header fn is called.

grunt.util.hooker.orig(grunt.log, 'header')('Elapsed time');

Sounds like a Hooker bug though. Mind opening a ticket here? https://github.com/cowboy/javascript-hooker