clinicjs / node-clinic

Clinic.js diagnoses your Node.js performance issues
https://clinicjs.org
MIT License
5.67k stars 125 forks source link

Tests profiling support #360

Closed 0xorial closed 2 years ago

0xorial commented 2 years ago

I have a test suite (using mocha) which I want to profile. Is this use case supported? If I run clinic flame -- node ./node_modules/mocha/bin/mocha.js, only thing I get in the output is the instruction of how to call clinic flame and nothing seems to happen. (Running on Windows)

RafaelGSS commented 2 years ago

Could you create a reproducible code? Reference: https://stackoverflow.com/help/minimal-reproducible-example.

0xorial commented 2 years ago

https://github.com/0xorial/mocha-clinic-test

RafaelGSS commented 2 years ago

Thanks, @0xorial I'll look at it soon as I have time

RafaelGSS commented 2 years ago

I gave it a shot today and it seems working fine

rafaelgss@rafaelgss-desktop:~/repos/os/tests/mocha-clinic-test$ clinic flame -- node ./node_modules/.bin/mocha test/index.test.js
To generate the report press: Ctrl + C

  Array
    #indexOf()
      ✔ should return -1 when the value is not present (3291ms)

  1 passing (3s)

Analysing data
Generated HTML file is file:///home/rafaelgss/repos/os/tests/mocha-clinic-test/.clinic/25973.clinic-flame.html

Could you re-install and run it again? If that doesn't work, it might be related to your environment (windows).