komondor-test

Test library for writing komondor plugins

MIT License

Downloads
5
Stars
0
Committers
2

komondor-test

Test library for writing plugins for komondor.

API

k.live(), k.save(), k.simulate(), k.trio() has the same signature. This allows you to easily switch between them to debug specific issue. e.g.

import k from 'komondor-test'

// starts with
k.live('...', (title, spec) => {
  test.only(title, async () => {
    // test away
  })
})

// change 4 characters 'Live' to 'Save' for saving the result
k.save('...', ...)

// change `Save` to `Simulate` to valid it works in simulate mode
k.simulate('...', ...)

// change to `Trio` to run all three
k.trio('...', ...)

testTrio([customDescription], specName, handler)

Also exposed as k.trio(). Use testTrio() to run all three tests (live, save, and simulate)

import { testTrio } from 'komondor-test'

testTrio('node/childProcess/success', (title, spec) => {
  // `test()` is your test runner: jest, ava, mocha, etc.
  test(title, async () => {
    const s = await spec(childProcess)
    ...
  })
})

testLive([customDescription], specName, handler)

Also exposed as k.live(). Use testLive() to run spec in live mode.

import { testLive } from 'komondor-test'

testLive('node/childProcess/success', (title, spec) => {
  // `test()` is your test runner: jest, ava, mocha, etc.
  test(title, async () => {
    const s = await spec(childProcess)
    ...
  })
})

testSave([customDescription], specName, handler)

Also exposed as k.save(). Use testSave() to run spec in save mode

import { testSave } from 'komondor-test'

testSave('node/childProcess/success', (title, spec) => {
  // `test()` is your test runner: jest, ava, mocha, etc.
  test(title, async () => {
    const s = await spec(childProcess)
    ...
  })
})

testSimulate([customDescription], specName, handler)

Also exposed as k.simulate(). Use testSimulate() to run spec in simulate mode.

import { testSimulate } from 'komondor-test'

testSimulate('node/childProcess/success', (title, spec) => {
  // `test()` is your test runner: jest, ava, mocha, etc.
  test(title, async () => {
    const s = await spec(childProcess)
    ...
  })
})

Contribute

# right after fork
npm install

# begin making changes
git checkout -b <branch>
npm run watch

# edit `webpack.config.dev.js` to exclude dependencies for the global build.

# after making change(s)
git commit -m "<commit message>"
git push

# create PR

Npm Commands

There are a few useful commands you can use during development.

# Run tests (and lint) automatically whenever you save a file.
npm run watch

# Run tests with coverage stats (but won't fail you if coverage does not meet criteria)
npm run test

# Manually verify the project.
# This will be ran during 'npm preversion' so you normally don't need to run this yourself.
npm run verify

# Build the project.
# You normally don't need to do this.
npm run build

# Run tslint
# You normally don't need to do this as `npm run watch` and `npm version` will automatically run lint for you.
npm run lint

Generated by [email protected]