0.9.16 • Published 4 years ago

truenit v0.9.16

Weekly downloads
10
License
MIT
Repository
github
Last release
4 years ago

Truenit

Build Status npm version FOSSA Status

When should I use Truenit?

  • You want to execute your tests locally during development with a CLI (command line interface).
  • You want to execute your tests on every save on a continuous integration server.
  • You want to use RequireJS or Node or anything else for your source files.

Installation

truenit is available on npm. To install it and its dependencies, run:

$ npm install truenit --save-dev

Usage

1. Import the library in your test file:

const truenit = require( 'truenit' );

2. Register tests with functions that test your test.

// Registers a test to be tested later so that the output is aligned.
truenit.registerTest( 'Module1', () => {

  // Do whatever tests here with Module1.
  // Example:
  truenit.notOk( 6 === 5, 'message if it fails' );
  
} );

// Registers a test that should throw an error.
truenit.registerThrowTest( 'Module2', () => {

  // Do whatever tests here with Module2 that throws an error.
  // Example:
  truenit.ok( 6 === 5, 'message if it fails' );
  
} );

3. Run the tests and the file.

truenit.start();

4. Enjoy the output.

$ npm test

Testing all...

   Testing Module1...     Passed.
   Testing Module2...     Passed.
   Testing Node...        Passed.
   Testing ScreenView...  Passed.
   Testing Property...    Passed.
   Testing OtherClass...  Passed.
   Testing S...           Passed.
   
 All tests passed!
 
$ _

Individual tests

You can also individually test one at a time:

// Tests immediately when called, but doesn't align the result with other tests.
truenit.test( 'Module1', () => {

  // Do whatever tests here with Module1.
  // Example:
  truenit.notOk( 6 === 5, 'message if it fails' );
  
} );

// Tests immediately that the function errors.
truenit.throws( 'Module2', () => {

  // Do whatever tests here that should error with Module2.
  // Example:
  truenit.ok( 6 === 5, 'will not be called' );
  
} );

Documentation

Get Involved

Contact me via email.

Help improve truenit by creating a New Issue.

Copyright © 2019 Brandon Li. All Rights Reserved.  |  See the LICENSE

0.9.15

4 years ago

0.9.16

4 years ago

0.9.14

4 years ago

0.9.13

4 years ago

0.9.12

4 years ago

0.9.8

4 years ago

0.9.7

4 years ago

0.9.9

4 years ago

0.9.10

4 years ago

0.9.11

4 years ago

0.9.6

5 years ago

0.9.5

5 years ago

0.9.1

5 years ago

0.9.0

5 years ago

0.0.0-dev.3

5 years ago

0.0.0-dev.2

5 years ago

0.0.0-dev.1

5 years ago

0.0.0-dev.0

5 years ago

0.0.0

5 years ago