+48
| var tap = require('tap'); | ||
| var tape = require('../'); | ||
| tap.test('tape only test', function (tt) { | ||
| var test = tape.createHarness({ exit: false }); | ||
| var tc = tap.createConsumer(); | ||
| var rows = [] | ||
| tc.on('data', function (r) { rows.push(r) }) | ||
| tc.on('end', function () { | ||
| var rs = rows.map(function (r) { | ||
| if (r && typeof r === 'object') { | ||
| return { id: r.id, ok: r.ok, name: r.name.trim() }; | ||
| } | ||
| else { | ||
| return r; | ||
| } | ||
| }) | ||
| tt.deepEqual(rs, [ | ||
| 'TAP version 13', | ||
| 'run success', | ||
| { id: 1, ok: true, name: 'assert name'}, | ||
| 'tests 1', | ||
| 'pass 1', | ||
| 'ok' | ||
| ]) | ||
| tt.end() | ||
| }) | ||
| test.stream.pipe(tc) | ||
| test("never run fail", function (t) { | ||
| t.equal(true, false) | ||
| t.end() | ||
| }) | ||
| test("never run success", function (t) { | ||
| t.equal(true, true) | ||
| t.end() | ||
| }) | ||
| test.only("run success", function (t) { | ||
| t.ok(true, "assert name") | ||
| t.end() | ||
| }) | ||
| }) |
+19
-1
@@ -29,2 +29,3 @@ var createDefaultStream = require('./lib/default_stream'); | ||
| var began = false; | ||
| var only = false; | ||
| var out = new Render(); | ||
@@ -41,3 +42,5 @@ | ||
| out.close(); | ||
| if (!code && !t._ok) process.exit(1); | ||
| if (!code && !t._ok && (!only || name === only)) { | ||
| process.exit(1); | ||
| } | ||
| }); | ||
@@ -57,2 +60,7 @@ } | ||
| if (only && name !== only) { | ||
| count--; | ||
| return; | ||
| } | ||
| if (running || pending.length) { | ||
@@ -100,2 +108,12 @@ pending.push(run); | ||
| test.only = function (name) { | ||
| if (only) { | ||
| throw new Error("there can only be one only test"); | ||
| } | ||
| only = name; | ||
| return test.apply(null, arguments); | ||
| }; | ||
| test.stream = out; | ||
@@ -102,0 +120,0 @@ return test; |
+1
-1
@@ -106,3 +106,3 @@ var EventEmitter = require('events').EventEmitter; | ||
| actual : defined(extra.actual, opts.actual), | ||
| expected : defined(extra.expected, opts.expected), | ||
| expected : defined(extra.expected, opts.expected) | ||
| }; | ||
@@ -109,0 +109,0 @@ this._ok = Boolean(this._ok && ok); |
+1
-1
| { | ||
| "name" : "tape", | ||
| "version" : "0.2.0", | ||
| "version" : "0.2.1", | ||
| "description" : "tap-producing test harness for node and browsers", | ||
@@ -5,0 +5,0 @@ "main" : "index.js", |
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
49020
3.56%36
2.86%1431
3.92%181
3.43%