Gathering detailed insights and metrics for buffalo-test
Gathering detailed insights and metrics for buffalo-test
Gathering detailed insights and metrics for buffalo-test
Gathering detailed insights and metrics for buffalo-test
Performance test runner based on Benchmark.js and Mocha
npm install buffalo-test
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
25 Commits
2 Watchers
6 Branches
1 Contributors
Updated on Nov 22, 2021
Latest Version
2.0.0
Package Id
buffalo-test@2.0.0
Unpacked Size
39.70 kB
Size
11.79 kB
File Count
11
NPM Version
8.1.0
Node Version
16.13.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Performance test runner based on BuffaloBench and inspired by Mocha
The purpose of this plugin is not only run benchmarks but to allow the developers to ensure that their application performance does not drops between commits or pull requests. By default it will fail if performance drops a certain percentage (2.5% by default).
To accomplish this task it will save a history based on the current git head id, package version or current date (git by default)
You can get this library as a Node.js module available through the npm registry:
1// With npm 2$ npm install buffalo-test --save 3// With yarn 4$ yarn add buffalo-test
Create a folder for your tests in your project (default bench
) and put your files in there.
1let { compare, suite, benchmark } = require("buffalo-test"); 2 3compare("regex vs string", () => { 4 benchmark("RegExp#test", () => /orl/.test("Hello World!")); 5 benchmark("String#indexOf", () => "Hello World!".indexOf("o") > -1); 6}); 7 8suite("suite only", () => { 9 benchmark("suite only", () => /o/.test("Hello World!")); 10});
To run the benchmarks just run from your terminal:
1$ buffalo-test
It will show somthing like:
1 2 Compare: regex vs string 3 ✔ RegExp#test 6.104s (15,844,390 ops/sec) 4 ✔ String#indexOf 6.075s (495,271,182 ops/sec) 5 Compare: regex vs string completed in 12.179s, String#indexOf was fastest by 96.801% 6 7 Suite: suite only 8 ✔ suite only 5.871s (22,695,850 ops/sec) 9 Suite: suite only passed in 5.871s 10 113 passing (18.05s)
See the bench/index.js file.
Buffalo-test provides the same hooks as mocha, before()
, after()
, beforeEach()
and afterEach()
. before()
and after()
run only once by suite. beforeEach()
and afterEach()
run before and after each benchmark respectively.
Also beforeCycle()
and afterCycle()
can be used to run code before and after the benchmark cycle.
Although buffalo-test is not a test-runner, you can run tests using expect.js
or another library to check in each cycle that the benchmark is good.
Failed benchmarks, errors or test non cycle will be showed in the terminal as mocha does.
As with mocha, you can run only
benchmarks by appending .only()
or skip them by appending .skip()
to the desired suite.
1Usage: buffalo-test [options] [dirs...] 2 3Performance test runner based on BuffaloBench and inspired by Mocha 4 5Options: 6 -v, --version Output the version number 7 -r, --reporter <spec> Reporter to use (default: "spec") 8 --enable-regressions Allow benchmark regressions, if false benchmark will fail if there is a regression (default: false) 9 --error-margin <margin> Fail benchmark if performance drops this percentage amount (default: 2.5) 10 --ignore-internals Ignore internal modules when logging (default: true) 11 --ignore-node-modules Ignore node modules when logging (default: true) 12 -R, --repository <repository> Repository to use (default: "file") 13 -t, --tag <tag> Tag to be used to identify this run (default: "git") 14 -T, --tag-date-format <format> Date format for the date tag (default: "YYYY-MM-DD") 15 --file-name <file-name> File to be used by the file repository (default: "bench/.buffalo-test.json") 16 --require Files to require before tests 17 -h, --help Display help for command 18 19Available reporters: 20 - spec 21 22Available repositories: 23 - file
Author: Masquerade Circus. License Apache-2.0
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/25 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
11 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More