New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

wTesting

Package Overview
Dependencies
Maintainers
1
Versions
876
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wTesting

Framework for convenient unit testing. Testing provides the intuitive interface, simple tests structure, asynchronous code handling mechanism, colorful report, verbosity control and more. Use the module to get free of routines which can be automated.

  • 1.0.588
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

utility::Testing status stable

Framework for convenient unit testing. Utility Testing provides the intuitive interface, simple tests structure, asynchronous code handling mechanism, colorful report, verbosity control and more. Use the module to get free of routines which can be automated.

tester.gif

Why wTesting?

  • Simple test syntax
  • Simple grouping of test cases
  • Running of group of test suites and running of separate test suite
  • Testing of separate routines
  • Colorful report
  • Verbosity control
  • Enhanced test checks messages
  • Displaying code of test case in report
  • Async function support
  • Abstract test suites
  • Runs tests concurrently

Installation

To install :

npm install -g wTesting@stable

Test files

Name of test file should has the suffix .test so that the testing utility could find and run it. Create a test file First.test.js in any project directory

require( 'wTesting' );

function myTest( test )
{
  /* describe what is going to happen */
  test.case = 'info about test case';

  /* do it and save results */
  var got = 'abc'.indexOf( 'a' );
  var expected = 0;

  /* compare result with expected */
  test.identical( got, expected );
}

/*
Map that describes test suit, contains
- name of the suit,
- map of test routines
- and other options
*/

var testSuite =
{
  name : 'name of my test suit',
  tests :
  {
      myTest : myTest
  }
}

/* Initilize test suit */
testSuite = wTestSuite( testSuite );

/* Run all tests of the suit */
wTester.test( testSuite.name );

Running tests

tst .run ./someDirectory

Running all test suites in directory by utility Testing. To run file First.test.js run command tst .run ./ in directory of file.

tst .run ./path/to/suite

Running of separate test suite by utility Testing.

node ./path/to/suite

Running of separate test suite by NodeJS directly.

Running options

Utility provides more control of testing process by running options. It is control parameters of the testing that is passed to the run command.

tst .run ./someDirectory verbosity:5

Option verbosity - change amount of output test information. Accepts a value from 0 to 9. Default value is 4.

tst .run ./path/to/suite routine:someRoutine

Option routine - used to test separate test routine. Accepts name of test routine.

tst .run ./someDirectory testRoutineTimeOut:10000

Option testRoutineTimeOut - limits the testing time for test routines. Accepts time in milliseconds. Default value is 5000ms.

Documentation

Please see documentation in the doc directory.

For gentle introduction use tutorials. For getting exhaustive information on one or another aspect use list of concepts to find a concept of interest and get familiar with it.

Cheat sheet

All information about utility in short form given in cheat sheet.

Quick references

Keywords

FAQs

Package last updated on 12 Jun 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc