@megatherium/bench
v0.3.1
Published
Returns a benchmarking function.
Downloads
2
Readme
bench
Returns a benchmarking function.
See the whole documentation or the coverage report.
Getting started
Install the module:
$ npm install @megatherium/bench
Use the module:
import assert from 'assert';
import bench from '@megatherium/bench';
const mark = bench('Sleeping 2 seconds');
setTimeout(() => {
const timeInMilliseconds = mark();
assert.strictEqual(timeInMilliseconds >= 2000, true);
}, 2000);
API (1)
Exports
bench(label?: string, customLog?: log.Logger): Function
Returns a benchmarking-function. Calling the benchmarking-function will return the time in milliseconds since it's creation and print a benchmark in the debug
-channel.
Scripts
The following scripts can be executed using npm run
:
build
Builds the module.build-docs
Builds the documentation.build-source
Builds the source code.build-tests
Builds test-cases from jsdoc examples.clear
Clears the module from a previous build.clear-coverage
Clears the coverage reports and caches.clear-docs
Clears the previous documentation build.clear-source
Clears the previous source build.clear-tests
Clears the generated jsdoc example test files.fix
Runs all automated fixes.fix-lint
Automatically fixes linting problems.release
Runs semantic release. Meant to be only executed by the CI, not by human users.test
Executes all tests.test-coverage
Generates coverage reports from the test results using nyc.test-deps
Executes a depcheck.test-e2e
Executes End-to-End-Tests using cucumber.test-integration
Executes integration tests using jest.test-lint
Executes linting tests using eslint.test-unit
Executes unit tests using mocha.update
Checks for dependency updates using renovate.
Contribution
See Contribution Guidelines for more details.