Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/t-ski/min-test

Minimal test script for quickstart NodeJS projects.
https://github.com/t-ski/min-test

nodejs testing zero-dependency

Last synced: about 10 hours ago
JSON representation

Minimal test script for quickstart NodeJS projects.

Awesome Lists containing this project

README

        

# MinTest

A minimal test script in favour of lean unit testing with lean NodeJS projects.

**Download**

``` cli
curl -o min-test.js https://raw.githubusercontent.com/t-ski/min-test/main/min-test.js
```

**Via NPM** `package.json` `npm i`
``` json
"scripts": {
"prepare": "curl -o min-test.js https://raw.githubusercontent.com/t-ski/min-test/main/min-test.js"
}
```

### Usage

MinTest recursively scans and evaluates test files in the `./test` directory. Each file named according to the pattern `*.test.js` is a test file and subject to evaluation. The global scope defines the `test()` function that provides a simple, yet powerful (weak-deep-equal) assertion interface:

> Optionally, a different test directory path may be specified through the first positional CLI argument.

``` cli
node min-test.js ?
```

``` ts
test(actual: unknown, expected: unknown);
```

### Example

test/example.test.js
``` js
test(5 + 5, 10); // ✅
test((() => 5 + 5)(), 10); // ✅
test(5, "5"); // ✅

test(5 + 5, 9); // ❌
```

##

© Thassilo Martin Schiepanski