metatests
is an extremely simple to use test framework and runner for Metarhia
technology stack built on the following principles:
-
Test cases are files, tests are either imperative (functions) or declarative (arrays and structures).
-
Assertions are done using the built-in Node.js
assert
module. The framework also provides additional testing facilities (like spies). -
Tests can be run in parallel.
-
All tests are executed in isolated sandboxes. The framework allows to easily mock modules required by tests and provides ready-to-use mocks for timers and other core functionality.
-
Testing asynchronous operations must be supported.
-
Testing pure functions without asynchronous operations and state can be done without extra boilerplate code using DSL based on arrays.
mt.case('Test common.duration', { common }, { // ... 'common.duration': [ ['1d', 86400000 ], ['10h', 36000000 ], ['7m', 420000 ], ['13s', 13000 ], ['2d 43s', 172843000], // ... ], // ... });
-
The framework must work in Node.js and browsers (using Webpack or any other module bundler that supports CommonJS modules and emulates Node.js globals).
- See github for full contributors list