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 - npm Package Compare versions

Comparing version 7.1.1 to 7.2.0

0

assert.js

@@ -0,0 +0,0 @@ import {current} from './tst.js'

2

package.json
{
"name": "tst",
"description": "Tests without efforts",
"version": "7.1.1",
"version": "7.2.0",
"repository": "dy/tst",

@@ -6,0 +6,0 @@ "author": "Dmitry Iv.",

@@ -5,18 +5,17 @@ # tst

## Gems
* tape API
* no tooling, vanilla ESM
* works with any [assert](https://www.npmjs.com/package/assert), [chai](https://www.npmjs.com/package/chai) etc.
* async functions support
* inspectable errors
* correct stacktrace with sourcemaps
* nice look & feel in browser/node
* good l&f in browser/node
* supports [assert](https://www.npmjs.com/package/assert), [chai](https://www.npmjs.com/package/chai) etc.
* tiny bundle, 0dep
## Usage
## usage
```js
import test, {ok,is,not,throws} from 'tst.js'
import test, { ok, is, not, throws } from 'tst.js'
test('these tests will all pass', () => {
test('pass', () => {
ok(true);

@@ -35,14 +34,6 @@ ok(true, 'this time with an optional message');

test('these tests will not pass', () => {
test('fail', () => {
is(42, '42');
is({}, {x:1});
})
test.skip('this test will not run', () => {
})
test.browser('browser-only test', () => {
})
```

@@ -54,3 +45,3 @@

## test types
## api

@@ -60,11 +51,9 @@ * `test.skip` โˆ’ bypass test, mutes output

* `test.todo` โˆ’ bypass test, indicate WIP sign
* `test.node` โˆ’ run test in node/deno only env.
* `test.browser` โˆ’ run test in browser only test.
<!-- * `test.demo` โˆ’ demo run, ignores doesn't count. -->
* `test.demo` โˆ’ demo run, skips failed assertions.
## assertions
## assert
* `ok(a, msg?)` โˆ’ generic truthfulness assert
* `is(a, b, msg?)` โˆ’ assert with `equal` for primitives and `deepEqual` for objects
* `not(a, b, msg?)` - assert with `equal` for primitives and `deepEqual` for objects
* `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

@@ -76,4 +65,10 @@ * `almost(a, b, eps, msg?)` โˆ’ assert approximate value/array

### Neighbors
## why?
Testing should not involve maintaining test runner.<br/>
It should be simple as [tap/tape](https://ghub.io/tape), working in browser/node, ESM, with nice l&f, done in a straightforward way.<br/>
I wasn't able to find such test runner that so I had to create one.
### similar
* [uvu](https://github.com/lukeed/uvu)

@@ -84,2 +79,2 @@ * [tape-modern](https://ghub.io/tape-modern)

<p align="center">๐Ÿ•‰๏ธ</p>
<p align="center"><a href="https://github.com/krishnized/license">๐Ÿ•‰๏ธ</a></p>

@@ -5,12 +5,12 @@ const GREEN = '\u001b[32m', RED = '\u001b[31m', YELLOW = '\u001b[33m', RESET = '\u001b[0m', CYAN = '\u001b[36m', GRAY = '\u001b[30m'

let assertIndex = 0,
index = 1,
passed = 0,
failed = 0,
skipped = 0,
only = 0,
current = null,
start,
queue = new Promise(resolve => start = resolve)
index = 1,
passed = 0,
failed = 0,
skipped = 0,
only = 0,
current = null,
start,
queue = new Promise(resolve => start = resolve)
export {current}
export { current }

@@ -35,8 +35,2 @@

}
test.node = function (name, run) {
return createTest({ name, run, skip: !isNode, tag: 'node' })
}
test.browser = function (name, run) {
return createTest({ name, run, skip: isNode, tag: 'browser' })
}

@@ -69,3 +63,3 @@ function createTest(test) {

let {operator: op, message: msg} = arg;
let { operator: op, message: msg } = arg;

@@ -91,3 +85,3 @@ assertIndex++

let {operator: op, message: msg, ...info} = arg;
let { operator: op, message: msg, ...info } = arg;

@@ -94,0 +88,0 @@ isNode ? (

Sorry, the diff of this file is not supported yet

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