@megatherium/bench
v0.3.1
Published
Returns a benchmarking function.
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:
buildBuilds the module.build-docsBuilds the documentation.build-sourceBuilds the source code.build-testsBuilds test-cases from jsdoc examples.clearClears the module from a previous build.clear-coverageClears the coverage reports and caches.clear-docsClears the previous documentation build.clear-sourceClears the previous source build.clear-testsClears the generated jsdoc example test files.fixRuns all automated fixes.fix-lintAutomatically fixes linting problems.releaseRuns semantic release. Meant to be only executed by the CI, not by human users.testExecutes all tests.test-coverageGenerates coverage reports from the test results using nyc.test-depsExecutes a depcheck.test-e2eExecutes End-to-End-Tests using cucumber.test-integrationExecutes integration tests using jest.test-lintExecutes linting tests using eslint.test-unitExecutes unit tests using mocha.updateChecks for dependency updates using renovate.
Contribution
See Contribution Guidelines for more details.
