Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display test's time in ms #863

Closed
tanx opened this issue May 23, 2013 · 5 comments
Closed

Display test's time in ms #863

tanx opened this issue May 23, 2013 · 5 comments

Comments

@tanx
Copy link

tanx commented May 23, 2013

One killer feature of qunit, that prevents me from switching to mocha completely for my browser tests, is the display of required time in milliseconds. This allows me to abuse my unit tests for simple benchmarking/profiling and iterate quickly to tweek performance.

Mocha currently only displays the time for longer tests: http://whiteout-io.github.io/crypto-lib/test/index.html

What would be awesome if there was an option to always display runtime like so:
bildschirmfoto 2013-05-23 um 13 16 54

@tj
Copy link
Contributor

tj commented Jun 13, 2013

well test cases make horrible benchmarks, I'd definitely recommend against that beyond the really obvious crazy cases where something went really wrong, but we do display the times taken if they exceed --slow

@tj tj closed this as completed Jun 13, 2013
@csvan
Copy link

csvan commented Sep 26, 2015

+1, I agree with @tj that this does not have any real benchmark application, but it's an interesting metric all the same.

@dchambers
Copy link

This is already possible using the -s or --slow flag to set "'slow' test threshold in milliseconds", for example:

mocha test -s 0

@rash240719
Copy link

Why does timing appear only sometimes?
test benchmark

@sangowen
Copy link

sangowen commented Dec 9, 2017

@rash240719
It probably happened because those tests finished under 1ms and their durations were considered 0ms, which are not slow when -s 0.
I believe that this is the only case not being shown by the default reporter.

ref: https://stackoverflow.com/a/32055699

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants