Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(bench): update bench deps, add teenytest, and update bench runner for node 12+ #165

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions bench/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ const spawn = promisify(execFile);
const PAD = reset().dim(' || ');

const runners = {
ava: [require.resolve('ava/cli.js'), 'suites/ava/**'],
jest: [require.resolve('jest/bin/jest.js'), 'suites/jest', '--env=node'],
mocha: [require.resolve('mocha/bin/mocha'), 'suites/mocha'],
tape: [require.resolve('tape/bin/tape'), 'suites/tape'],
uvu: [require.resolve('uvu/bin.js'), 'suites/uvu'],
ava: ['./node_modules/ava/cli.js', 'suites/ava/**'],
jest: ['./node_modules/jest/bin/jest.js', 'suites/jest', '--env=node'],
mocha: ['./node_modules/mocha/bin/mocha', 'suites/mocha'],
tape: ['./node_modules/tape/bin/tape', 'suites/tape'],
teenytest: ['./node_modules/teenytest/bin/teenytest', 'suites/teenytest'],
uvu: ['./node_modules/uvu/bin.js', 'suites/uvu'],
};

function format(arr) {
Expand Down
11 changes: 6 additions & 5 deletions bench/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"private": true,
"devDependencies": {
"ava": "3.10.1",
"jest": "26.1.0",
"mocha": "8.0.1",
"tape": "5.0.1",
"uvu": "0.1.0"
"ava": "3.15.0",
"jest": "27.3.1",
"mocha": "9.1.3",
"tape": "5.3.2",
"teenytest": "6.0.2",
"uvu": "0.5.2"
}
}
25 changes: 25 additions & 0 deletions bench/suites/teenytest/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const assert = require('assert');
const math = require('../../math');

module.exports = {
sum: function() {
assert.equal(typeof math.sum, 'function');
assert.equal(math.sum(1, 2), 3);
assert.equal(math.sum(-1, -2), -3);
assert.equal(math.sum(-1, 1), 0);
},

div: function() {
assert.equal(typeof math.div, 'function');
assert.equal(math.div(1, 2), 0.5);
assert.equal(math.div(-1, -2), 0.5);
assert.equal(math.div(-1, 1), -1);
},

mod: function() {
assert.equal(typeof math.mod, 'function');
assert.equal(math.mod(1, 2), 1);
assert.equal(math.mod(-3, -2), -1);
assert.equal(math.mod(7, 4), 3);
},
}
11 changes: 6 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,12 @@ Below you'll find each test runner with two timing values:
Each test runner's `stdout` is printed to the console to verify all assertions pass.<br>Said output is excluded below for brevity.

```
~> "ava" took 594ms ( ??? )
~> "jest" took 962ms (356 ms)
~> "mocha" took 209ms ( 4 ms)
~> "tape" took 122ms ( ??? )
~> "uvu" took 72ms ( 1.3ms)
~> "ava" took 1.04s (764 ms)
~> "jest" took 1.63s (333 ms)
~> "mocha" took 269ms (7 ms)
~> "tape" took 138ms ( n/a )
~> "teenytest" took 133ms ( n/a )
~> "uvu" took 96ms (1.5 ms)
```


Expand Down