17 lines
438 B
Groovy
17 lines
438 B
Groovy
/**
|
|
* Runs npm test inside current container. Expects npm install already done.
|
|
* Must be called inside container('node') block.
|
|
*
|
|
* config keys (all optional):
|
|
* workDir - directory to run in, default: '.'
|
|
* testCmd - npm script to run, default: 'test'
|
|
*/
|
|
def call(Map config = [:]) {
|
|
def workDir = config.workDir ?: '.'
|
|
def testCmd = config.testCmd ?: 'test'
|
|
|
|
dir(workDir) {
|
|
sh "npm ${testCmd}"
|
|
}
|
|
}
|