Testing utility for caviar, caviar blocks, and caviar plugins
$ npm i @caviar/test -D
const {
runBlock
} = require('@caviar/test')
const block = await runBlock(NextBlock, options)
- block
Class
the subclass ofcaviar.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.