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

tst

Package Overview
Dependencies
Maintainers
2
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tst - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

38

index.js

@@ -44,5 +44,13 @@ var chalk = require('chalk');

async: false,
last: false
last: false,
_timeout: test.TIMEOUT
};
//mocha-compat only
testObj.timeout = (function (value) {
if (value == null) return this._timeout;
this._timeout = value;
return this;
}).bind(testObj);
//handle args

@@ -164,3 +172,3 @@ if (!fn) {

if (!testObj.status !== 'warning') testObj.status = 'success';
if (!testObj.status !== 'group') testObj.status = 'success';

@@ -175,4 +183,2 @@ print(testObj);

else {
if (!testObj.timeout) testObj.timeout = testObj.TIMEOUT;
//this race should be done within the timeout, self and all registered kids

@@ -186,7 +192,9 @@ testObj.promise = Promise.race([

new Promise(function (resolve, reject) {
// setTimeout()
setTimeout(function () {
reject(new Error('Timeout ' + testObj._timeout + 'ms reached. Please fix the test or set `this.timeout(' + (testObj._timeout + 1000) + ');`.'));
}, testObj._timeout);
})
]).then(function () {
testObj.time = now() - testObj.time;
if (testObj.status !== 'warning') testObj.status = 'success';
if (testObj.status !== 'group') testObj.status = 'success';

@@ -205,3 +213,3 @@ print(testObj);

while (parent) {
parent.status = 'warning';
parent.status = 'group';
parent = parent.parent;

@@ -263,4 +271,4 @@ }

}
else if (testObj.status === 'warning') {
printWarn(testObj, single);
else if (testObj.status === 'group') {
printGroup(testObj, single);
}

@@ -326,3 +334,3 @@ else if (testObj.status === 'success') {

} else {
console.group('%c+ ' + testObj.title + '%c ' + testObj.time.toFixed(2) + 'ms', 'color: black; font-weight: normal', 'color:rgb(150,150,150); font-size:0.9em');
printGroup(testObj);
}

@@ -332,4 +340,3 @@ }

if (!single) {
console.log();
console.log(indent(testObj) +' ' + chalk.white('+') + ' ' + chalk.white(testObj.title) + chalk.gray(' ' + testObj.time.toFixed(2) + 'ms'));
printGroup(testObj);
}

@@ -343,8 +350,9 @@ else {

//print yellow warning (not all tests passed)
function printWarn (testObj, single) {
function printGroup (testObj) {
if (isBrowser) {
console[single ? 'log' : 'group']('%c~ ' + testObj.title + '%c ' + testObj.time.toFixed(2) + 'ms', 'color: orange; font-weight: normal', 'color:rgb(150,150,150); font-size:0.9em');
console.group('%c+ ' + testObj.title + '%c ' + testObj.time.toFixed(2) + 'ms', 'color: orange; font-weight: normal', 'color:rgb(150,150,150); font-size:0.9em');
}
else {
console.log(chalk.yellow(indent(testObj) + ' ~ ' + testObj.title) + chalk.gray(' ' + testObj.time.toFixed(2) + 'ms'));
console.log();
console.log(indent(testObj) +' ' + chalk.yellow('+') + ' ' + chalk.yellow(testObj.title) + chalk.gray(' ' + testObj.time.toFixed(2) + 'ms'));
}

@@ -351,0 +359,0 @@ }

{
"name": "tst",
"version": "1.1.0",
"version": "1.1.1",
"description": "Minimalistic test runner for node/browser",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -20,6 +20,6 @@ [![npm install tst](https://nodei.co/npm/tst.png?mini=true)](https://npmjs.org/package/tst/)

test('Group tests', function () {
test('Nested', function () {
test('A', function () {
});
test('Nested', function () {
test('B', function () {

@@ -32,2 +32,7 @@ });

});
test('Async stuff', function (done) {
this.timeout(3000);
setTimeout(done, 2100);
});
```

@@ -38,3 +43,2 @@

### Related

@@ -41,0 +45,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