# mocha-profiler

> Generate a CPU profile of your Mocha test suite execution

Latest version **1.0.0** (published 2021-04-08) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install mocha-profiler
pnpm add mocha-profiler
yarn add mocha-profiler
bun add mocha-profiler
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-04-08 |
| First published | 2021-04-08 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=14 |
| Dependencies | 1 |
| Unpacked size | 16.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Robert Rossmann |
| Maintainers | dreamscapes |
| Keywords | cpu, hook, mocha, profiler |

## Links

- npm: https://www.npmjs.com/package/mocha-profiler
- npm.io page: https://npm.io/package/mocha-profiler

## Dependencies (1)

- [read-pkg-up](https://npm.io/package/read-pkg-up.md) ^7.0.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-04-08

## README

# 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

1. Install the package: `npm i -D mocha-profiler`
1. Add the package to your _.mocharc.js_ configuration file:

```js
module.exports = {
 require: [
   'mocha-explorer',
 ],
}
```

## Usage

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

### VS Code

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

![VS Code screenshot][vscode-profile-screenshot]

### Chrome

1. In Chrome, navigate to [_chrome://inspect_](chrome://inspect)
1. Open dedicated DevTools for Node
1. Go to _Profiler_ tab
1. Right-click in the sidebar (below the _Profiles_ header) and select _Load..._
1. Navigate to the generated CPU profile and load it
1. Enjoy

## License

See the [LICENSE](LICENSE) file.

[vscode-profile-table]: https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-js-profile-table
[vscode-profile-screenshot]: https://user-images.githubusercontent.com/3058150/114101062-7c84f680-98c5-11eb-8b59-4beaa6981535.png

---
_Source: https://npm.io/package/mocha-profiler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
