uvu is an extremely fast and lightweight test runner for Node.js and the browser
Installations
npm install uvu
Score
96.3
Supply Chain
99.1
Quality
75.9
Maintenance
100
Vulnerability
100
License
Developer
lukeed
Developer Guide
Module System
CommonJS, ESM
Min. Node Version
>=8
Typescript Support
Yes
Node Version
18.3.0
NPM Version
8.11.0
Statistics
2,979 Stars
238 Commits
99 Forks
21 Watching
6 Branches
23 Contributors
Updated on 24 Nov 2024
Bundle Size
25.71 kB
Minified
9.82 kB
Minified + Gzipped
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
308,151,061
Last day
-8.6%
513,983
Compared to previous day
Last week
1.8%
2,963,797
Compared to previous week
Last month
5.8%
12,671,380
Compared to previous month
Last year
25.5%
145,506,694
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Ultimate Velocity, Unleashed
Features
- Super lightweight
- Extremely performant
- Individually executable test files
- Supports
async
/await
tests - Supports native ES Modules
- Browser-Compatible
- Familiar API
Install
$ npm install --save-dev uvu
Usage
Check out
/examples
for a list of working demos!
1// tests/demo.js 2import { test } from 'uvu'; 3import * as assert from 'uvu/assert'; 4 5test('Math.sqrt()', () => { 6 assert.is(Math.sqrt(4), 2); 7 assert.is(Math.sqrt(144), 12); 8 assert.is(Math.sqrt(2), Math.SQRT2); 9}); 10 11test('JSON', () => { 12 const input = { 13 foo: 'hello', 14 bar: 'world' 15 }; 16 17 const output = JSON.stringify(input); 18 19 assert.snapshot(output, `{"foo":"hello","bar":"world"}`); 20 assert.equal(JSON.parse(output), input, 'matches original'); 21}); 22 23test.run();
Then execute this test file:
1# via `uvu` cli, for all `/tests/**` files 2$ uvu -r esm tests 3 4# via `node` directly, for file isolation 5$ node -r esm tests/demo.js
Note: The
-r esm
is for legacy Node.js versions. Learn More
Assertions
The uvu/assert
module is completely optional.
In fact, you may use any assertion library, including Node's native assert
module! This works because uvu
relies on thrown Errors to detect failures. Implicitly, this also means that any uncaught exceptions and/or unhandled Promise
rejections will result in a failure, which is what you want!
API
Module: uvu
The main entry from which you will import the test
or suite
methods.
Module: uvu/assert
A collection of assertion methods to use within your tests. Please note that:
- these are browser compatible
- these are completely optional
Benchmarks
via the
/bench
directory with Node v10.21.0
Below you'll find each test runner with two timing values:
- the
took ___
value is the total process execution time – from startup to termination - the parenthesis value (
(___)
) is the self-reported execution time, if known
Each test runner's stdout
is printed to the console to verify all assertions pass.
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)
License
MIT © Luke Edwards
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: license:0
- Info: FSF or OSI recognized license: MIT License: license:0
Reason
0 existing vulnerabilities detected
Reason
Found 11/28 approved changesets -- score normalized to 3
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/ci.yml:1
- Info: no jobLevel write permissions found
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/lukeed/uvu/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/lukeed/uvu/ci.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:38
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:39
- Warn: downloadThenRun not pinned by hash: .github/workflows/ci.yml:48
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 2 npmCommand dependencies pinned
- Info: 0 out of 1 downloadThenRun dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 14 are checked with a SAST tool
Score
3.7
/10
Last Scanned on 2024-11-18
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