first commit

This commit is contained in:
2026-04-26 13:43:49 +07:00
commit 10c2f73587
5 changed files with 167 additions and 0 deletions

17
vars/runNodeTest.groovy Normal file
View 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}"
}
}