New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tst

Package Overview
Dependencies
Maintainers
0
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tst

Tests without efforts

  • 8.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
137
decreased by-48.69%
Maintainers
0
Weekly downloads
 
Created
Source

tst

Test without efforts.

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

usage

import test, { 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(() => {
		throw new Error('oh no!');
	}, /oh no!/);
})

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 with Object.is for primitives and deepEqual 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 as tap/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.

🕉️

FAQs

Package last updated on 01 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc