Socket
Socket
Sign inDemoInstall

tape

Package Overview
Dependencies
Maintainers
3
Versions
158
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tape - npm Package Compare versions

Comparing version 5.7.5 to 5.8.0

test/assertion.js

2

index.js

@@ -70,3 +70,3 @@ 'use strict';

function createHarness(conf_) {
var results = new Results();
var results = new Results({ todoIsOK: !!(process.env.TODO_IS_OK === '1') });
if (!conf_ || conf_.autoclose !== false) {

@@ -73,0 +73,0 @@ results.once('done', function () { results.close(); });

@@ -44,5 +44,5 @@ 'use strict';

function encodeResult(res, count) {
function encodeResult(res, count, todoIsOK) {
var output = '';
output += (res.ok ? 'ok ' : 'not ok ') + count;
output += (res.ok || (todoIsOK && res.todo) ? 'ok ' : 'not ok ') + count;
output += res.name ? ' ' + coalesceWhiteSpaces(res.name) : '';

@@ -95,4 +95,5 @@

function Results() {
if (!(this instanceof Results)) { return new Results(); }
function Results(options) {
if (!(this instanceof Results)) { return new Results(options); }
var opts = (arguments.length > 0 ? arguments[0] : options) || {};
this.count = 0;

@@ -106,2 +107,3 @@ this.fail = 0;

this._isRunning = false;
this.todoIsOK = !!opts.todoIsOK;
}

@@ -203,3 +205,3 @@

}
write(encodeResult(res, self.count + 1));
write(encodeResult(res, self.count + 1, self.todoIsOK));
self.count++;

@@ -206,0 +208,0 @@

@@ -15,3 +15,3 @@ 'use strict';

var inspect = require('object-inspect');
var is = require('object-is');
var is = require('object-is/polyfill')();
var objectKeys = require('object-keys');

@@ -92,5 +92,7 @@ var every = require('array.prototype.every');

this._cb = args.cb;
this.ended = false;
this._progeny = [];
this._teardown = [];
this._ok = true;
this._objectPrintDepth = 5;
var depthEnvVar = process.env.NODE_TAPE_OBJECT_PRINT_DEPTH;

@@ -105,10 +107,7 @@ if (args.opts.objectPrintDepth) {

}
} else {
this._objectPrintDepth = 5;
}
var self = this;
for (var prop in self) {
if (typeof self[prop] === 'function') {
self[prop] = callBind(self[prop], self);
for (var prop in this) {
if (typeof this[prop] === 'function') {
this[prop] = callBind(this[prop], this);
}

@@ -978,2 +977,6 @@ }

Test.prototype.assertion = function assertion(fn) {
callBind.apply(fn)(this, $slice(arguments, 1));
};
// eslint-disable-next-line no-unused-vars

@@ -980,0 +983,0 @@ Test.skip = function skip(name_, _opts, _cb) {

{
"name": "tape",
"version": "5.7.5",
"version": "5.8.0",
"description": "tap-producing test harness for node and browsers",

@@ -10,12 +10,6 @@ "main": "index.js",

"exports": {
".": [
{
"default": "./index.js"
},
"./index.js"
],
".": "./index.js",
"./lib/default_stream": "./lib/default_stream.js",
"./lib/results": "./lib/results.js",
"./lib/test": "./lib/test.js",
"./package": "./package.json",
"./package.json": "./package.json"

@@ -30,5 +24,5 @@ },

"dependencies": {
"@ljharb/resumer": "^0.1.2",
"@ljharb/through": "^2.3.12",
"array.prototype.every": "^1.1.5",
"@ljharb/resumer": "^0.1.3",
"@ljharb/through": "^2.3.13",
"array.prototype.every": "^1.1.6",
"call-bind": "^1.0.7",

@@ -42,3 +36,3 @@ "deep-equal": "^2.2.3",

"has-dynamic-import": "^2.1.0",
"hasown": "^2.0.1",
"hasown": "^2.0.2",
"inherits": "^2.0.4",

@@ -49,10 +43,10 @@ "is-regex": "^1.1.4",

"object-inspect": "^1.13.1",
"object-is": "^1.1.5",
"object-is": "^1.1.6",
"object-keys": "^1.1.1",
"object.assign": "^4.1.5",
"resolve": "^2.0.0-next.5",
"string.prototype.trim": "^1.2.8"
"string.prototype.trim": "^1.2.9"
},
"devDependencies": {
"@ljharb/eslint-config": "^21.1.0",
"@ljharb/eslint-config": "^21.1.1",
"array.prototype.flatmap": "^1.3.2",

@@ -62,2 +56,3 @@ "aud": "^2.0.4",

"concat-stream": "^1.6.2",
"cross-env": "^2.0.1",
"eclint": "^2.8.1",

@@ -68,4 +63,2 @@ "ecstatic": "^4.1.4",

"falafel": "^2.2.5",
"intl-fallback-symbol": "^1.0.0",
"is-core-module": "^2.13.1",
"jackspeak": "=2.1.1",

@@ -94,4 +87,4 @@ "js-yaml": "^3.14.0",

"posttest": "aud --production",
"tests-only": "nyc tap 'test/*.js'",
"tests-only:windows": "nyc node_modules\\tap\\bin\\run.js test/*.js",
"tests-only": "cross-env NODE_OPTIONS='--no-warnings' nyc tap 'test/*.js'",
"tests-only:windows": "cross-env NODE_OPTIONS='--no-warnings' nyc node_modules\\tap\\bin\\run.js test/*.js",
"test:example": "find example -name '*.js' | grep -v fail | grep -v static | xargs tap"

@@ -113,5 +106,5 @@ },

"type": "git",
"url": "git://github.com/ljharb/tape.git"
"url": "git://github.com/tape-testling/tape.git"
},
"homepage": "https://github.com/ljharb/tape",
"homepage": "https://github.com/tape-testling/tape",
"keywords": [

@@ -118,0 +111,0 @@ "tap",

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

var stripFullStack = require('./common').stripFullStack;
var stripDeprecations = require('./common').stripDeprecations;
var runProgram = require('./common').runProgram;

@@ -43,3 +44,3 @@

t.same(r.exitCode, 0);
t.same(r.stderr.toString('utf8'), '');
t.same(stripDeprecations(r.stderr.toString('utf8')), '');
t.end();

@@ -80,3 +81,3 @@ });

t.same(r.exitCode, 1);
t.same(r.stderr.toString('utf8'), '');
t.same(stripDeprecations(r.stderr.toString('utf8')), '');
t.end();

@@ -103,3 +104,3 @@ });

t.same(r.exitCode, 0);
t.same(r.stderr.toString('utf8'), '');
t.same(stripDeprecations(r.stderr.toString('utf8')), '');
t.end();

@@ -133,3 +134,3 @@ });

t.same(r.exitCode, 1);
t.same(r.stderr.toString('utf8'), '');
t.same(stripDeprecations(r.stderr.toString('utf8')), '');
t.end();

@@ -188,3 +189,3 @@ });

t.same(r.exitCode, 1);
t.same(r.stderr.toString('utf8'), '');
t.same(stripDeprecations(r.stderr.toString('utf8')), '');
t.end();

@@ -213,3 +214,3 @@ });

t.same(stripFullStack(stderr), [].concat(
t.same(stripFullStack(stripDeprecations(stderr)), [].concat(
'$TEST/async-await/sync-error.js:7',

@@ -266,3 +267,3 @@ ' throw new Error(\'oopsie\');',

var stderr = r.stderr.toString('utf8');
var stderr = stripDeprecations(r.stderr.toString('utf8'));
var stderrLines = stderr.split('\n').filter(function (line) {

@@ -311,3 +312,3 @@ return !(/\(timers.js:/).test(line)

var stderr = r.stderr.toString('utf8');
var stderr = stripDeprecations(r.stderr.toString('utf8'));

@@ -314,0 +315,0 @@ t.same(stderr, '');

@@ -94,2 +94,6 @@ 'use strict';

).replace(
// Handle more stack trace variation in Node v0.8
/at(:?) Test.tap.test.([^ ]+)/g,
'at$1 Test.$2'
).replace(
// Handle stack trace variation in Node v0.8

@@ -123,1 +127,8 @@ /(\[\.\.\. stack stripped \.\.\.\]\r?\n *at) <anonymous> \(([^)]+)\)/g,

};
module.exports.stripDeprecations = function (msg) {
return String(msg)
.replace(/^\s*\(node:\d+\) ExperimentalWarning: The ESM module loader is experimental\.\s*$/g, '')
.replace(/\(node:\d+\) \[DEP0060\] DeprecationWarning: The `util\._extend` API is deprecated\. Please use Object\.assign\(\) instead\.(\n\(Use `node --trace-deprecation \.\.\.` to show where the warning was created\))?\s*/g, '')
.replace(/\(node:\d+\) \[DEP0060\] DeprecationWarning: The `punycode` API is deprecated\. Please use a userland alternative instead\.(\n\(Use `node --trace-deprecation \.\.\.` to show where the warning was created\))?\s*/g, '');
};

@@ -9,5 +9,9 @@ 'use strict';

tt.equal(typeof tape.run, 'function', 'tape.run is a function');
tt.equal(tape.getHarness()._results.pass, 0);
tt.equal(tape.getHarness().run, undefined, 'tape.getHarness().run is undefined (wait not called)');
tt.end();
});

@@ -6,2 +6,4 @@ 'use strict';

var stripDeprecations = require('./common').stripDeprecations;
var ps = spawn(process.execPath, [path.join(__dirname, 'max_listeners', 'source.js')]);

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

ps.stderr.on('data', function (buf) {
console.log('not ok ' + buf);
if (stripDeprecations(buf)) {
console.log('not ok ' + buf);
}
});

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

var stripFullStack = require('./common').stripFullStack;
var stripDeprecations = require('./common').stripDeprecations;

@@ -71,3 +72,3 @@ var tapeBin = 'node ' + path.join(__dirname, '../bin/tape');

}, function (err, stdout, stderr) {
tt.match(stderr.toString('utf8'), /^\s*(\(node:\d+\) ExperimentalWarning: The ESM module loader is experimental\.)?\s*$/);
tt.equal(stripDeprecations(stderr.toString('utf8')), '');
tt.same(stripFullStack(stdout.toString('utf8')), [

@@ -109,5 +110,5 @@ 'TAP version 13',

]);
tt.match(stderr.toString('utf8'), /^\s*(\(node:\d+\) ExperimentalWarning: The ESM module loader is experimental\.)?\s*$/);
tt.equal(stripDeprecations(stderr.toString('utf8')), '');
tt.equal(err, null); // code 0
});
});

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

var concat = require('concat-stream');
var mockProperty = require('mock-property');

@@ -46,1 +47,38 @@ var common = require('./common');

});
tap.test('tape todo test with TODO_IS_OK', function (assert) {
assert.teardown(mockProperty(process.env, 'TODO_IS_OK', { value: '1' }));
var test = tape.createHarness({ exit: false });
assert.plan(1);
test.createStream().pipe(concat(function (body) {
assert.deepEqual(stripFullStack(body.toString('utf8')), [
'TAP version 13',
'# success',
'ok 1 this test runs',
'# TODO failure',
'ok 2 should never happen # TODO',
' ---',
' operator: fail',
' at: Test.<anonymous> ($TEST/todo.js:$LINE:$COL)',
' ...',
'',
'1..2',
'# tests 2',
'# pass 2',
'',
'# ok',
''
]);
}));
test('success', function (t) {
t.equal(true, true, 'this test runs');
t.end();
});
test('failure', { todo: true }, function (t) {
t.fail('should never happen');
t.end();
});
});

Sorry, the diff of this file is too big to display

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