How to use the tape.createStream function in tape

To help you get started, we’ve selected a few tape examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brownieboy / es6bindall / tests / test1.js View on Github external
/* eslint prefer-arrow-callback: 0 object-shorthand:0 */

const test = require("tape");
const faucet = require("faucet");
const es6BindAll = require("../"); // index.js

test.createStream()
  .pipe(faucet())
  .pipe(process.stdout);

const boundObject1 = {
  name: "boundObject1",
  testFunc: function() {
    return this;
  },
  testFunc2: function() {
    return this;
  }
};

const boundObject2 = {
  name: "boundObject2"
};
github digidem / mapeo-mobile / benchmark / rnnodeapp / index.js View on Github external
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see .
*/

const http = require('http');
const test = require('tape');
const path = require('path');
const tapjson = require('tap-json');
const benchmark = require('osm-p2p-db-benchmark');
const level = require('level');
const fdchunk = require('fd-chunk-store');

const results = { stats: null, perf: null };

const testStream = test.createStream();
testStream.pipe(tapjson()).on('data', function(res) {
  results.stats = res.stats;
  console.log('stats:', res.stats);
});

// The requires need to be explicit here because noderify will statically
// analyze these require calls to create one single index.js file.
require('osm-p2p-db/test/batch');
require('osm-p2p-db/test/changeset');
require('osm-p2p-db/test/create');
require('osm-p2p-db/test/create_db');
require('osm-p2p-db/test/del');
require('osm-p2p-db/test/del_batch');
require('osm-p2p-db/test/del_node');
require('osm-p2p-db/test/del_node_in_way');
require('osm-p2p-db/test/del_relation');
github thefourtheye / deep-inspect / tests / nested-objects.js View on Github external
var test = require('tape');
var util = require('./util');

test.createStream()
  .pipe(require('tap-spec')())
  .pipe(process.stderr);

test('Simple nested objects test', function (t) {
  util.patchLogger();

  t.plan(7);

  t.equal(util.getTestResult([1, [2, 3]]), [
    'Array',
    '├─┬ Index: "0"',
    '│ └── 1',
    '└─┬ Index: "1"',
    '  └── Array'
  ].join('\n'));
github hharnisc / auth-service / service / integration-test / index.js View on Github external
import test from 'tape';
import tapSpec from 'tap-spec';
import jwt from 'jsonwebtoken';
import requestPromise from 'request-promise';
import retryPromise from 'retry-promise';
import rethinkdb from 'rethinkdb';
import rethinkdbInit from 'rethinkdb-init';
rethinkdbInit(rethinkdb);

test.createStream()
  .pipe(tapSpec())
  .pipe(process.stdout);

const before = test;
const after = test;

const host = process.env.HOST || 'auth';
const port = 8080;
let userId;
let connection;
const refreshToken = '1234';
const config = {
  host: process.env.RETHINKDB_SERVICE_HOST || 'rethinkdb',
  port: 28015,
  db: 'auth',
};
github thefourtheye / deep-inspect / tests / inherited-properties.js View on Github external
var test = require('tape');
var util = require('./util');

test.createStream()
  .pipe(require('tap-spec')())
  .pipe(process.stderr);

test('Inherited properties test', function (t) {
  util.patchLogger();

  t.plan(3);

  t.equal(util.getTestResult({}, {
    parentChainLevel: 2
  }), [
    'Object',
    '└─┬ [[Parent]] : Object',
    '  └── [[Parent]] : null'
  ].join('\n'));
github DylanPiercey / auto-sni / test / index.js View on Github external
var path = require('path')
var tape = require('tape')

tape
  .createStream()
  .pipe(require('tap-spec')())
  .pipe(process.stdout)

tape.onFinish(process.exit)

process.argv.slice(2).forEach(function (file) {
  require(path.resolve(__dirname, file))
})
github mosjs / mos / packages / mos / src / cli.js View on Github external
return mos(md, [...defaultPluginsWithOpts, ...pkgPlugins])
    })
    .then(processor => processor.process())

  const mdExtensions = ['markdown', 'mdown', 'mkdn', 'mkd', 'md']
  const files = cli.input[isTest ? 1 : 0]
  const pattern = files
    ? path.resolve(cwd, files)
    : path.resolve(cwd, `{/**/,/}*.{${mdExtensions.join()}}`)
  const ignorePattern = cli.flags.x
    ? path.resolve(cwd, cli.flags.x)
    : null

  if (isTest) {
    if (cli.flags.tap !== true) {
      test.createStream()
        .pipe(tapDiff())
        .pipe(stdout)
    }
    test('markdown', t => {
      processFiles({
        process: processMD,
        pattern,
        ignorePattern,
        afterEachRender (opts) {
          const relativePath = normalizePath(getRelativePath(opts.filePath))
          t.equal(normalizeNewline(opts.newMD), normalizeNewline(opts.currentMD), relativePath)
        },
      })
      .then(() => t.end())
      .catch(err => { throw err })
    })
github godaddy / ekke / plugins / tape.native.js View on Github external
modify('before', async function before({ config }) {
    output = tape.createStream();
    harness = tape.getHarness();

    output.on('data', line => console.log(line.trimRight()));
  });
github stampit-org / stamp / packages / check-compose / index.js View on Github external
return new Promise((resolve) => {
    test
      .createStream({ objectMode: true })
      .on('data', (assert) => {
        if (assert.error) failures.push(assert);
      })
      .on('end', () => {
        resolve({ failures });
      });

    files.forEach((file) => {
      require(`./${file}`)(compose);
    });
  });
};
github cryptoscope / ssb / message / legacy / signature_compat.js View on Github external
we use tape to make the process exit with an non-zero code if anything is wrong

    it's job is verify and create signatures over data that is configured over environment variables:

    * testaction: which test to run
    * testobj: base64 encoded json object (b64 just to make newline handling easier)
    * testseed: the seed data to create the keypair
    * testpublic: the expected public key (preliminary sanity check that keypair seeding works)
    * testhmackey: used by HMAC_* as the secret
    
    the sign actions output the generated signature to stdout
*/
var tape = require('tape')
var ssbKeys = require('ssb-keys')

tape.createStream().pipe(process.stderr);

tape("got seed and action", (t) => {
    let testobj = JSON.parse(Buffer.from(process.env.testobj, 'base64'))
    t.ok(testobj, 'got test object')
    
    let action = process.env.testaction
    t.notEqual(['sign', 'verify', 'hmac_sign', 'hmac_verify'].indexOf(action), -1, 'is valid action')


    let seed = Buffer.from(process.env.testseed, 'base64')
    t.equal(seed.length,32, 'got test seed for key')
    
    var keys = ssbKeys.generate('ed25519', seed)
    t.equal(keys.id, process.env.testpublic, 'wrong pubkey for testseed')

    if (action == 'sign')