Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

testing

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

testing - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

22

index.js

@@ -274,2 +274,19 @@ 'use strict';

{
showResults(error, result);
};
/**
* Show the complete hierarchical error results.
*/
exports.showComplete = function(error, result)
{
log.notice('Complete test results: %s', result);
showResults(error, result);
};
/**
* Show test results.
*/
function showResults(error, result)
{
if (error)

@@ -281,4 +298,3 @@ {

}
log.notice('All tests run with %s', result);
log.notice('Final tests result: %s', result.getSummary());
log.notice('All tests run with %s', result.getSummary());
if (result.failure)

@@ -288,3 +304,3 @@ {

}
};
}

@@ -291,0 +307,0 @@ /**

9

lib/runner.js

@@ -77,2 +77,3 @@ 'use strict';

self.message = message;
console.log(FAILURE_START + self.key + SEPARATOR + message + END);
finished = true;

@@ -90,11 +91,10 @@ }

{
self.message = 'Duplicated call to callback';
message = 'Duplicated call to callback';
}
// only one success allowed
self.failure = true;
self.success = false;
return;
return fail(message);
}
self.success = true;
self.message = message;
console.log(SUCCESS_START + self.key + SEPARATOR + message + END);
finished = true;

@@ -273,2 +273,3 @@ }

{
console.log('Finished test: %s', result.getSummary());
if (finished)

@@ -275,0 +276,0 @@ {

{
"name": "testing",
"version": "0.1.3",
"version": "0.1.4",
"description": "Simple asynchronous testing framework. Never again count your asserts! This tiny testing library is fully callback-based and has a rich API for asserts.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/alexfernandez/testing",

@@ -21,2 +21,4 @@ [![Build Status](https://secure.travis-ci.org/alexfernandez/testing.png)](http://travis-ci.org/alexfernandez/testing)

### Unit tests
Add a test function to your code, checking if results are what should be expected:

@@ -45,11 +47,36 @@

### Running all tests
Run all tests:
testing.run({
this: testAdd,
async: testAsync,
}, callback);
testing.run([
testAdd,
testAsync,
], callback);
Will run tests sequentially.
Will run tests sequentially. Usually test are run inside an exported function `test`:
/**
* Run package tests.
*/
exports.test = function(callback)
{
var tests = [
testAdd,
testAsync,
];
testing.run(tests, callback);
};
// run tests if invoked directly
if (__filename == process.argv[1])
{
exports.test(testing.show);
}
All tests are run every time the file is invoked directly.
The function `test` is exported so that tests from all source code files
can be required and run in sequence from a master file,
usually called `test.js` and placed in the root of the project.
## API

@@ -170,2 +197,10 @@

#### testing.showComplete(error, result)
Like `testing.show()`, but shows the complete hierarchical tree of tests.
Example:
exports.test(testing.showComplete);
### Sample code

@@ -172,0 +207,0 @@

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