Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
forked fromlukeed/uvu

uvu is an extremely fast and lightweight test runner for Node.js and the browser

License

NotificationsYou must be signed in to change notification settings

ArtskydJ/uvu

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uvu
versionCIlicensesdownloads
uvu is an extremely fast and lightweight test runner for Node.js and the browser
UltimateVelocity,Unleashed

example with suites

Features

  • Superlightweight
  • Extremelyperformant
  • Individually executable test files
  • Supportsasync/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!

// tests/demo.jsimport{test}from'uvu';import*asassertfrom'uvu/assert';test('Math.sqrt()',()=>{assert.is(Math.sqrt(4),2);assert.is(Math.sqrt(144),12);assert.is(Math.sqrt(2),Math.SQRT2);});test('JSON',()=>{constinput={foo:'hello',bar:'world'};constoutput=JSON.stringify(input);assert.snapshot(output,`{"foo":"hello","bar":"world"}`);assert.equal(JSON.parse(output),input,'matches original');});test.run();

Then execute this test file:

# via `uvu` cli, for all `/tests/**` files$ uvu -r esm tests# via `node` directly, for file isolation$ node -r esm tests/demo.js

Note: The-r esm is for legacy Node.js versions.Learn More

View theuvu CLI documentation

Assertions

Theuvu/assert module iscompletely optional.

In fact, you may use any assertion library, including Node's nativeassert module! This works becauseuvu relies on thrown Errors to detect failures. Implicitly, this also means that any uncaught exceptions and/or unhandledPromise rejections will result in a failure, which is what you want!

API

Module:uvu

Viewuvu API documentation

The main entry from which you will import thetest orsuite methods.

Module:uvu/assert

Viewuvu/assert API documentation

A collection of assertion methods to use within your tests. Please note that:

  • these are browser compatible
  • these arecompletely optional

Benchmarks

via the/bench directory with Node v10.21.0

Below you'll find each test runner with two timing values:

  • thetook ___ 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'sstdout 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

About

uvu is an extremely fast and lightweight test runner for Node.js and the browser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript100.0%

[8]ページ先頭

©2009-2025 Movatter.jp