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
/tstPublic

Tests without efforts

License

NotificationsYou must be signed in to change notification settings

dy/tst

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test withoutefforts.

  • no tooling, vanilla ESM
  • works both node/browser
  • async functions support
  • inspectable errors
  • stacktrace with sourcemaps
  • clean l&f in browser/node
  • supportsassert,chai etc.
  • minimal, 0dep
  • tape API

usage

importtest,{ok,is,not,throws}from'tst.js'test('tst demo test',()=>{ok(true);ok(true,'this time with an optional message');ok('not true, but truthy enough');is(1+1,2);is(Math.max(1,2,3),3);is({},{})throws(()=>{thrownewError('oh no!');},/ohno!/);})

api

  • test.only − run only selected test(s)
  • test.mute − run test(s), mute assertions
  • test.skip − bypass test(s)
  • test.todo − bypass test(s), mark as WIP
  • test.demo − demo run, skip failed assertions.

assert

  • ok(a, msg?) − generic truthfulness assert
  • is(a, b, msg?) − assert withObject.is for primitives anddeepEqual for objects
  • not(a, b, msg?) - assert with!Object.is for primitives and!deepEqual for objects
  • any(a, [a, b, c], msg?) − assert with optional results
  • same(listA, listB, msg?) − assert same members of a list/set/map/object
  • throws(fn, msg?) − fn must throw
  • pass(msg),fail(msf) − pass or fail the whole test.

why?

Testing should not involve maintaining test runner.
It should be simple astap/tape, working in browser/node, ESM, with nice l&f, done in a straightforward way.
I wasn't able to find such test runner that so I had to create one.

🕉️

About

Tests without efforts

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp