New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

mocha-profiler

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mocha-profiler

Generate a CPU profile of your Mocha test suite execution

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

mocha-profiler

Generate a CPU profile of your Mocha test suite execution

Overview

This Mocha hook allows you to generate a V8 CPU profile of your test suite's execution. The profiling starts immediately before the first test is run and ends immediately after all tests run. This is accomplished using Mocha's beforeAll() and afterAll() hooks.

The benefits of doing this are that the CPU profile will not include functions which get only executed during your application's startup or, even worse, on-the-fly source code compilation.

Installation

  • Install the package: npm i -D mocha-profiler
  • Add the package to your .mocharc.js configuration file:
module.exports = {
 require: [
   'mocha-explorer',
 ],
}

Usage

  • Run your test suite
  • A file is generated in your current working directory

VS Code

  • Install ms-vscode.vscode-js-profile-table VS Code extension
  • Just click on the file from VS Code's explorer
  • Enjoy

VS Code screenshot

Chrome

  • In Chrome, navigate to chrome://inspect
  • Open dedicated DevTools for Node
  • Go to Profiler tab
  • Right-click in the sidebar (below the Profiles header) and select Load...
  • Navigate to the generated CPU profile and load it
  • Enjoy

License

See the LICENSE file.

Keywords

cpu

FAQs

Package last updated on 08 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts