File tree Expand file tree Collapse file tree 4 files changed +40
-11
lines changed
Expand file tree Collapse file tree 4 files changed +40
-11
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,6 @@ import org.dsty.js.node.NodeEnv
99LogClient log = new LogClient ()
1010
1111node() {
12- // Ignore this line its for catching CPS issues.
13- String cps = sh(script : ' #!/bin/bash\n set +x; > /dev/null 2>&1\n echo Test for CPS issue' , returnStdout : true )
1412
1513 log. info(' Lets install the latest version of nodenv.' )
1614
@@ -31,14 +29,13 @@ node() {
3129
3230 node. runCommand(' -v' )
3331
34- log. info(' You can also specify the version in the .node-version file:' )
35-
3632 String nodeVersion = ''' \
373317.9.1
3834'''
39- println nodeVersion
4035
41- log. info(' Then that can be used by nodenv to automaticly install the correct version of node.' )
36+ log. info(' You can also specify the version in the .node-version file' )
37+
38+ log. info(" Lets create a .node-version file with version ${ nodeVersion} " )
4239
4340 Path ws = Path . workspace()
4441
@@ -48,12 +45,12 @@ node() {
4845
4946 nodeVersionFile. write(nodeVersion)
5047
48+ sh(" cat ${ nodeVersionFile} " )
49+
5150 node = nodenv. install()
5251
5352 node. runCommand(' -v' )
5453
5554 }
5655
57- // Ignore this line its for catching CPS issues.
58- cps = sh(script : ' #!/bin/bash\n set +x; > /dev/null 2>&1\n echo Test for CPS issue' , returnStdout : true )
5956}
Original file line number Diff line number Diff line change @@ -317,7 +317,16 @@ class NodeEnv implements Serializable {
317317
318318 // Install nodenv
319319 final Installer installer = new Installer ()
320- installer. install()
320+
321+ try {
322+ installer. install()
323+ } catch (ExecutionException ex) {
324+
325+ if (! ex. stdErr. contains(' All done!' )) {
326+ throw new Exception (" Failed to install nodenv." , ex)
327+ }
328+ }
329+
321330
322331 String binName = installer. getBinName()
323332
@@ -331,7 +340,7 @@ class NodeEnv implements Serializable {
331340
332341 if (! this . @nodenvInstallDir) {
333342
334- final Path installPath = Path . jenkinsHome (). child(' ./.nodenv' )
343+ final Path installPath = Path . userHome (). child(' ./.nodenv' )
335344
336345 this . nodenvInstallDir = installPath
337346 }
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ def run_test(job_path: str) -> str:
8282
8383 cmd = f"run_job { job_path } "
8484
85- exitcode , raw_output = container .exec_run (cmd , user = "root" )
85+ exitcode , raw_output = container .exec_run (cmd )
8686
8787 output = raw_output .decode ("utf-8" )
8888
Original file line number Diff line number Diff line change 1+ import pytest
2+
3+ from tests .conftest import Container
4+
5+
6+ @pytest .fixture ()
7+ def job_folder ():
8+ return "js/node"
9+
10+
11+ def test_nodenv_example (container : Container , job_folder ):
12+
13+ _ = container (f"{ job_folder } /nodenv_example.groovy" )
14+
15+
16+ def test_node_example (container : Container , job_folder ):
17+
18+ _ = container (f"{ job_folder } /node_example.groovy" )
19+
20+
21+ def test_npm_example (container : Container , job_folder ):
22+
23+ _ = container (f"{ job_folder } /npm_example.groovy" )
You can’t perform that action at this time.
0 commit comments