How can I measure the execution time of a npm/yarn task on the command line without modifying the scripts.
In my special use case I want to execute an existing E2E-Test (yarn test:e2e) 100 times and take the average value.
You could use the npm package gnomon:
A command line utility, a bit like moreutils's ts, to prepend timestamp information to the standard output of another command.
Install it like this:
$ npm i -g gnomon
With this you could run:
$ yarn install | gnomon
And it might give you an output like this:
$ yarn install | gnomon
0.5327s yarn install v1.9.4
1.9652s [1/4] Resolving packages...
0.0160s success Already up-to-date.
0.0163s Done in 2.38s.
0.0003s
Total 2.5315s