Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/t-ski/min-test
- Owner: t-ski
- Created: 2024-05-24T23:44:42.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-06-25T17:23:15.000Z (5 months ago)
- Last Synced: 2024-06-25T19:17:18.442Z (5 months ago)
- Topics: nodejs, testing, zero-dependency
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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