Skip to content

Decorator for `tape`; provides a `pg` client in each test

License

Notifications You must be signed in to change notification settings

eliasmalik/tape-pg

Repository files navigation

Build Coverage npm

Decorates the tape function to provide a node-postgres client in each test.

Also optionally runs SQL query before each test.

Usage

var tape = require('tape');
var tapePg = require('tape-pg');
var schema = require('./schema.sql');

var opts = {
  model: 'DROP TABLE IF EXISTS my_table; CREATE TABLE my_table (column VARCHAR NOT NULL);',
  connection: {
    host: 'localhost',
    port: 5432,
  }
};

var test = tapePg(opts, tape);

test('perform some query', (t, client) => {
  client.query('SELECT * FROM my_table', (err, result) => {
    t.end();
  });
});

Unsupported tape features

The following tape features are currently unsupported:

  • .only
  • .skip

About

Decorator for `tape`; provides a `pg` client in each test

Resources

License

Stars

Watchers

Forks

Packages

No packages published