This is the core module of the tripwire
project which is designed to be used for testing your Javascript or TypeScript packages.
It is designed to work in and is tested with the following environments.
node
browser
-
worker
(browser)
It currently provides assertion
functions to make testing simplier and easier by providing common assertion checks that you can run against your code.
It provides both assert
and expect
support, where the assert
functions are a set of fixed operations, which the expect
is a more descriptive language API.
The assert
functions are built on-top of the underlying expect
support, and if no assertions are thrown the result of the internal "chained" descriptive language API is returned. Which means you can mix the expect
objects with the responses from the assert
functions.
To avoid dependency issues, this project will use the mininal set of external dependencies so that it can ensure and maintain compatibility with current (and future) runtimes.
The API documentation is generated from the source code via typedoc and is located here
Install the npm packare: npm install @nevware21/tripwire --save-dev
It is suggested / recommended that you use the following definition in your
package.json
so that you are compatible with any future releases as they become available we do not intend to make ANY known breaking changes moving forward until v2.x"@nevware21/tripwire": ">= 0.1.2 < 2.x"
To use the core functionalities, import the necessary modules and functions:
import { assert, expect } from '@nevware21/tripwire';
assert.isObject([]); // throws
expect(() => { dosomething(); }).to.not.throw();
expect(() => { throw new Error("failed")}).to.throw();
The API documentation is generated from the source code via typedoc and is located here
General support is currently set to ES5 supported runtimes and higher.
This module uses @nevware21/ts-utils to provide some of it core functionality which includes internal polyfills to provide support on older browsers.
While every effort will be made to maintain as much technical compatibility as possible, some assertions and functionality will require later browsers to function correctly.
Read our primary contributing guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes.
This project is licensed under the MIT License. See the LICENSE file for details.