# nanoTest

> nano size unit test toolkit.

Latest version **0.9.9-beta32** (published 2022-07-18) · GPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install nanoTest
pnpm add nanoTest
yarn add nanoTest
bun add nanoTest
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.9-beta32 |
| Published | 2022-07-18 |
| First published | 2016-08-06 |
| Weekly downloads | 0 |
| License | GPL-3.0-or-later |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 14.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Soldy |
| Maintainers | soldy |
| Keywords | unit, test, test, simple, unit, test, ultra, fast, unit, test, unittest, nanotest, simpletest |

## Links

- npm: https://www.npmjs.com/package/nanoTest
- Repository: https://github.com/Soldy/nanoTest
- Homepage: https://github.com/Soldy/nanoTest#readme
- Issues: https://github.com/Soldy/nanoTest/issues
- npm.io page: https://npm.io/package/nanoTest

## Dependencies (4)

- [setuprc](https://npm.io/package/setuprc.md) 0.9.9-beta20
- [assertrc](https://npm.io/package/assertrc.md) 1.0.7
- [sandboxrc](https://npm.io/package/sandboxrc.md) 0.9.9-beta23
- [nano-test-output-cli](https://npm.io/package/nano-test-output-cli.md) 0.9.9-beta28

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 0.9.9-beta32 (latest) — 2022-07-18
- 0.9.9-beta31 — 2022-04-09
- 0.9.9-beta30 — 2022-04-09
- 0.9.9-beta29 — 2022-04-09
- 0.9.9-beta28 — 2022-03-26
- 0.9.9-beta27 — 2022-03-20
- 0.9.9-beta26 — 2022-03-11
- 0.9.9-beta25 — 2022-03-10
- 0.9.9-beta22 — 2021-07-25
- 0.9.9-beta21 — 2021-04-17
- 0.9.9-beta20 — 2021-04-15
- 0.9.9-beta17c — 2021-02-11
- 0.9.9-beta17b — 2021-02-10
- 0.9.9-beta17 — 2021-02-09
- 0.9.9-beta16 — 2021-02-09
- … 21 more at https://npm.io/package/nanoTest/versions

## README

Super simple, fast, actively maintened test tool kit.

## nano unit test

Ultra mini unit test.

### install 

```bash
npm install nanoTest
```

### usage 

```javascript
const functest = require("nanoTest");

const test = new funtest();

test.add (
    "example test", 
    ()=>{
        return 93
    },
    "==",
   "93"
);

test.add (
    "example test 2",
    ()=>{
        return 93
    }, 
    "==",
    93
);


test.add (
    "example test 3",
    {
        "function" : (n)=>{
                 return 93 +n
             },
        "options"  : [
              1
        ]
    },
    ">",
    93
);

test.add (
      "example test 4",
      {
        'function' : (n,p)=>{
                 return {
                      'number': 93 +n,
                      'string': p
             },
       'options' : [
              1,
              'something'
        ]
      "j==",
      {
          'number' : 94,
          'string' : 'something'
      }
);
```
### add expected fail

```javascript
test.add (
      'expected fail',
      {
        'function' : ()=>{
                 just_fail();
             },
        'options'  : []
      'error'
);
```



## run test 

```javascript
test.run();
```


## control variables



   |   name                  | type    | default |   comment
   |-------------------------|---------|---------|-----------------------------
   | ```expected_ok```       | integer |     -1  |  test number expected ok
   | ```expected_fail```     | integer |     -1  |  test number expected fail
   | ```expected_error```    | integer |     -1  |  test number expected throw error
   | ```expected_missing```  | integer |     -1  |  test number expected missing
   | ```exit_code_fail```    | boolean |   true  |
   | ```exit_code_error```   | boolean |   true  |
   | ```exit_code_missing``` | boolean |   true  |
   | ```progress_bar```      | boolean |   true  |  enable/disable progress bar
   | ```serialize```         | boolean |   false |  enable test list index visualization
   | ```debug_print```       | string  |   long  |  error message format options : short,long

---
_Source: https://npm.io/package/nanoTest · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
