Jenkins on OSX 10.10 and NodeJS testing

330 views
Skip to first unread message

David Spector

unread,
Jan 9, 2015, 11:58:26 AM1/9/15
to jenkins...@googlegroups.com
Hi,

Looking for some advise/help on using Jenkins (ver. 1.596) on OS X (10.10) and testing NodeJS apps...I am running into to 2 issues:

1) PATH problems - Is there a common way of exporting PATH to Jenkins jobs?  When trying to test NodeJS apps the job doesn't seem to have access to /usr/local/bin; adding an "execute script" section to the job and using "export PATH=$PATH:/usr/local/bin" makes the node installation visible but I get the feeling this is pretty much a hack and there's a better way to do this. 

2) When using the mocha test reporter  to test a tiny NodeJS example, npm can't find the "unit" module.  Run from the regular command line this works fine (nom dynamically d/ls all the needed modules), but when run from a test stanza inside the packages.json I get a back trace like this:

> IttyBit...@0.0.1 test /Users/Shared/Jenkins/Home/jobs/IttyBittyJSApp/workspace
> mocha --recursive -R xunit test/ > test-reports.xml


module.js:340
    throw err;
          ^
Error: Cannot find module 'unit.js'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> 
    :
    :


the packages.json file is pretty straightforward:

{
    "name": "IttyBittyJSApp",
    "description": "A tiny little demo app to test Pingpads CI Server",
    "version": "0.0.1",
    "preferGlobal": true,
    "private": true,
    "dependencies": {
    },
    "devDependencies": {
        "unit": "0.1.0",
        "nunit": "latest",
        "mocha": "latest",
        "simple": "latest"
    },
"scripts": {
    "test": "./node_modules/.bin/mocha --recursive -R xunit test/ > test-reports.xml"
  }
}


Any suggestions would be greatly appreciated

cheers,
  Dave

Gabriel C. Troia

unread,
May 11, 2015, 9:36:03 PM5/11/15
to jenkins...@googlegroups.com
Your first hack saved my sanity. Have you actually found a more elegant solution to this? 

Thanks a lot,
Gabriel
Reply all
Reply to author
Forward
0 new messages