/usr/lib/nodejs/retape/retape.js is in node-retape 0.0.3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | "use strict";
var tape = require("tape")
var owns = Object.prototype.hasOwnProperty
var keys = Object.keys || function(object) {
var result = []
for (var key in object) {
if (owns.call(object, object[key])) {
result.push(key)
}
}
}
function adaptAsync(unit) {
return function(assert) {
unit(assert, function() {
assert.end()
})
}
}
function adaptSync(unit) {
return function(assert) {
unit(assert)
assert.end()
}
}
function adapt(suite, test) {
test = test || tape
Object.keys(suite).forEach(function(name) {
// CommonJS cares only about names that start with test.
if (name.indexOf("test") !== 0) return
var unit = suite[name]
// If unit is a function then adapt it.
if (typeof(unit) === "function") {
var adapted = unit.length > 1 ? adaptAsync(unit) :
adaptSync(unit)
test(name, adapted)
} else if (unit && typeof(unit) === "object"){
test(name, function(test) {
adapt(unit, function(name, unit) {
test.test(name, unit)
})
test.end()
})
}
})
}
module.exports = adapt
|