jenkins-mocha icon indicating copy to clipboard operation
jenkins-mocha copied to clipboard

Cannot find module nyc.CMD when running jenkins-mocha

Open shaunluttin opened this issue 8 years ago • 3 comments
trafficstars

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

shaunluttin avatar May 19 '17 17:05 shaunluttin

any workaround/resulution yet?

michaelschneiderdaimler avatar Aug 14 '17 14:08 michaelschneiderdaimler

@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

shaunluttin avatar Aug 17 '17 00:08 shaunluttin

This is happening on Windows host only.

Zaky7 avatar Mar 19 '20 14:03 Zaky7