/** * 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}" } }