2.0.2 • Published 5 years ago

@caviar/test v2.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

Build Status Coverage

@caviar/test

Testing utility for caviar, caviar blocks, and caviar plugins

Install

$ npm i @caviar/test -D

Usage

const {
  runBlock
} = require('@caviar/test')

const block = await runBlock(NextBlock, options)

await runBlock(block: Class, options: RunBlockOptions): Block

  • block Class the subclass of caviar.Block
  • options RunBlockOptions
interface RunBlockOptions {
  // Which is the same as the apply function of caviar.Plugin
  apply?: Function(getHooks: Function)
  // Array of config layers
  // [app layer, lower layer, ..., the lowest layer]
  configChain: Array<object>
  // The current working directory
  cwd: string
  dev?: boolean = false
  phase?: string = 'default'
}

Returns Block the block which has already run.

License

MIT

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago