first commit
This commit is contained in:
17
vars/runNodeTest.groovy
Normal file
17
vars/runNodeTest.groovy
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Runs npm install + npm test inside current container.
|
||||
* 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 install'
|
||||
sh "npm ${testCmd}"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user