Socket
Socket
Sign inDemoInstall

testlite

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    testlite

Easy, lightweight testing


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

testlite

Easy, lightweight testing

testlite on NPM

Build Status testlite's Total Downloads on NPM testlite's Version on NPM bitHound Overall Score bitHound Code Dependencies Dev Dependencies Known Vulnerabilities testlite's License testlite's Stars on GitHub

Example Usage

// add.js

module.exports = (num1, num2) => {
	return num1 + num2
};

// tests/addTest.js

const assert = require('assert');
const add = require('../add.js');
module.exports = {
	'exports' : {
		'should add two numbers': () => {
			assert.strictEqual(add(1, 2), 3);
			assert.strictEqual(add(4, 5), 9);
		}, 'should return NaN if one of the arguments is NaN': () => {
			assert.strictEqual(add(NaN, 2), NaN);
			assert.strictEqual(add(parseInt('...'), 5), NaN);
			assert.strictEqual(add(NaN, NaN), NaN);
		}
	}
};

// tests/test.js

const tl = require('testlite');
tl('add.js', require('./addTest.js'));
tl.test();

Note that it is extremely important to call tl.test() or else nothing will happen.

API

  • require('testlite'): Function - the function to create a test.
    • testName: String - the high-level name of the test, ex. Array.
    • testTests: Object - the tests.
      • The key is the lower-level name of the test, ex. indexOf().
      • The value is an object.
        • The key is the name of the test, ex. should return -1 when element is not found
        • The value is a function that test this functionality.
          • returns
            • Nothing, if the test is synchronous.
            • If the test is asynchronous, a promise. A promise that resolves means success, a promise that rejects means failure.
  • require('testlite').test: Function - the function to be called to start testing.

Keywords

FAQs

Last updated on 13 Aug 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc