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

vows

Package Overview
Dependencies
Maintainers
0
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vows - npm Package Compare versions

Comparing version 0.5.6 to 0.5.8

11

lib/vows.js

@@ -73,3 +73,3 @@ //

}
runTest(args);
runTest(args, this.ctx);
vows.tryEnd(batch);

@@ -79,3 +79,3 @@

if (vow.callback.length >= 2 || !batch.suite.options.error) {
runTest([err]);
runTest([err], this.ctx);
} else {

@@ -87,3 +87,3 @@ output('errored', { type: 'promise', error: err.stack || err.message || JSON.stringify(err) });

function runTest(args) {
function runTest(args, ctx) {
var topic, status;

@@ -98,3 +98,3 @@

try {
vow.callback.apply(vow.binding || null, args);
vow.callback.apply(ctx === global || !ctx ? vow.binding : ctx, args);
output('honored');

@@ -136,2 +136,3 @@ } catch (e) {

if ((s.results.total > 0) && (s.results.time === null)) {
s.reporter.print('\n\n');
s.reporter.report(['error', { error: "Asynchronous Error", suite: s }]);

@@ -154,3 +155,3 @@ }

s.reporter.report(['error', {
error: "not fired!",
error: "callback not fired",
context: title,

@@ -157,0 +158,0 @@ batch: b,

@@ -86,4 +86,9 @@ var eyes = require('eyes').inspector({ stream: null, styles: false });

this.error = function (obj) {
return '✗ ' + $('Errored ').red + '» ' + $(obj.suite.subject).bold + ': '
+ $('' + $(obj.context).italic + ' ∙ ') + $(obj.error).red;
var string = '✗ ' + $('Errored ').red + '» ';
string += $(obj.error).red.bold + '\n';
string += (obj.context ? ' in ' + $(obj.context).red + '\n': '');
string += ' in ' + $(obj.suite.subject).red + '\n';
string += ' in ' + $(obj.suite._filename).red;
return string;
};

@@ -12,3 +12,5 @@

this.env.callback = function (/* arguments */) {
var ctx = this;
var args = Array.prototype.slice.call(arguments);
var emit = (function (args) {

@@ -21,2 +23,3 @@ //

var e = args.shift();
that.emitter.ctx = ctx;
// We handle a special case, where the first argument is a

@@ -28,5 +31,5 @@ // boolean, in which case we treat it as a result, and not

if (typeof(e) === 'boolean' && args.length === 0) {
that.emitter.emit('success', e);
that.emitter.emit.call(that.emitter, 'success', e);
} else {
if (e) { that.emitter.emit('error', e) }
if (e) { that.emitter.emit.call(that.emitter, 'error', e) }
else { that.emitter.emit.apply(that.emitter, ['success'].concat(args)) }

@@ -37,2 +40,3 @@ }

return function () {
that.emitter.ctx = ctx;
that.emitter.emit.apply(that.emitter, ['success'].concat(args));

@@ -39,0 +43,0 @@ };

@@ -12,4 +12,4 @@ {

"directories" : { "test": "./test" },
"version" : "0.5.6",
"version" : "0.5.8",
"engines" : {"node": ">=0.2.6"}
}

@@ -247,2 +247,22 @@ var path = require('path');

},
"using this.callback with a user context": {
topic: function () {
this.callback.call({ boo: true }, null, 'hello');
},
"should give access to the user context": function (res) {
assert.isTrue(this.boo);
}
},
"passing this.callback to a function": {
topic: function () {
this.boo = true;
var async = function (callback) {
callback(null);
};
async(this.callback);
},
"should give access to the topic context": function () {
assert.isTrue(this.boo);
}
},
"with multiple arguments": {

@@ -249,0 +269,0 @@ topic: function () {

Sorry, the diff of this file is not supported yet

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