myf / level-test

Easily run your level-* tests across all leveldown backends.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

level-test

LevelDB Logo

Inject different level implementations (browser, leveldb, etc) into your tests.

Build Status Greenkeeper badge

testling

Example

Create a fresh db, with out refering to any fs or dom specifics, so that the same test can be used in the server or the browser!

const level = require('level-test')()
const db = level('foo', { encoding: 'json' })

In Memory Example

const level = require('level-test')({ mem: true })
const db = level('foo', { encoding: 'json' })

Use whatever test framework you like!

Custom Backends

A custom backend for levelup can be provided via the options object:

const hyper = require('leveldown-hyper')
const level = require('level-test')({ db: hyper })
const db = level('foo', { encoding: 'json' })

Options

Currently supported options:

level(name, {
  clean: false, // do not delete database (defaults to true)
  db: require('leveldown-hyper') // optional, defaults to leveldown
})

TODO

Configure leveldb settings via command line options/environment vars.

License

MIT

About

Easily run your level-* tests across all leveldown backends.

License:MIT License


Languages

Language:JavaScript 100.0%