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

tst

Package Overview
Dependencies
Maintainers
3
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tst

Tests without efforts

  • 6.1.1
  • Source
  • npm
  • Socket score

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

tst

Tests without efforts.

Gems

  • tape-like
  • async functions support
  • inspectable errors
  • correct stacktrace with sourcemaps
  • muted skipped
  • better colors
  • multiple only tests
  • start by idle event
  • ES export
  • test.todo, test.fixme for broken / unfinished tests
  • test.node, test.browser - environment conditional tests
  • test.demo - demo-run (can fail)
  • console.group in browser

Install

npm install tst

or

import t from 'https://unpkg.com/tst?module'

Use

t('these tests will all pass', t => {
	t.ok(true);
	t.ok(true, 'this time with an optional message');
	t.ok('not true, but truthy enough');

	t.is(1 + 1, 2);
	t.is(Math.max(1, 2, 3), 3);
	t.is({}, {})

	t.throws(() => {
		throw new Error('oh no!');
	}, /oh no!/);

	t.pass('ok')
})

t('these tests will not pass', t => {
	t.is(42, '42');
	t.is({}, {x:1});

	t.fail('nok')
})

t.skip('this test will not run', t => {
	t.pass('ok')
})

Creates output in console:

preview

Assertions

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

Neighbors

🕉️

FAQs

Package last updated on 29 May 2020

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