stjohnjohnson/jenkins-mocha

Cannot find module nyc.CMD when running jenkins-mocha

Opened this issue · 3 comments

Mocha works when called on its own but fails when called via jenkins-mocha. In other words:

.\node_modules\.bin\mocha .\test\test-unit\*.js
.\node_modules\.bin\jenkins-mocha .\test\test-unit\*.js      <--- BOOM

The problem is that node cannot resolve nyc.CMD, because it is blurring relative and absolute paths.

module.js:457
    throw err; 
    ^ 

Error: Cannot find module 'C:\srcbd\'C:\srcbd\node_modules\.bin\nyc.CMD''  
    at Function.Module._resolveFilename (module.js:455:15) 
    at Function.Module._load (module.js:403:25)          
    at Module.runMain (module.js:590:10)                    
    at run (bootstrap_node.js:394:7)           
    at startup (bootstrap_node.js:149:9)                
    at bootstrap_node.js:509:3       

Environment

Windows 10
node v6.6.0
jenkins-mocha: 4.1.2

any workaround/resulution yet?

@michaelschneiderdaimler We ended up using nyc directly with mocha.

https://github.com/istanbuljs/nyc

The simplest usage from the command line looks something like this:

$ nyc mocha .\some-test.js
Zaky7 commented

This is happening on Windows host only.