So I have the following sequences of commands, and I don't believe it runs on Windows, but it runs on a Mac:
echo "istanbul cover /Users/Olegzandr/WebstormProjects/suman/test/build-tests/empty.test.js --dir ./coverage/empty.test
istanbul cover /Users/Olegzandr/WebstormProjects/suman/test/build-tests/tes-t7-start.test.js --dir ./coverage/tes-t7-start.test
istanbul cover /Users/Olegzandr/WebstormProjects/suman/test/build-tests/test6.test.js --dir ./coverage/test6.test
istanbul report --dir coverage --include **/*coverage.json lcov" | bash
So basically I have 4 individual statements (separated by a newline char) and I pipe those 4 commands through bash and it works on Mac (and probably on unix). But with Windows, it doesn't seem to work and I have no indication as to why. Bash is installed on my Windows machine, but since I am writing a library I need to assume bash is installed on all Windows machines - I assume this is true for Windows 7/8/10 etc.
Anyone have any idea why the above would work on Mac but not on Windows?
I tried the following:
const cmd = "istanbul cover C:\Users\denman\WebstormProjects\suman\test\build-tests\empty.test.js --dir ./coverage/empty.test && istanbul cover C:\Users\denman\WebstormProjects\suman\test\build-tests\tes-t7-start.test.js --dir ./coverage/tes-t7-start.test && istanbul cover C:\U
sers\denman\WebstormProjects\suman\test\build-tests\test6.test.js --dir ./coverage/test6.test && istanbul report --dir coverage --include **/*coverage.json lcov"
cp.exec(cmd, function(err,stdout,stderr){
////
});
and I got:
Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "istanbul cover C:\Users\denman\WebstormProjects\suman\test\build-tests\empty.test.js --dir ./coverage/empty.test&&istanbul cover C:\Users\denman\WebstormProjects\suman\test\build-tests\tes-t7-start.test.js -
-dir ./coverage/tes-t7-start.test&&istanbul cover C:\Users\denman\WebstormProjects\suman\test\build-tests\test6.test.js --dir ./coverage/test6.test&&istanbul report --dir coverage --include **/*coverage.json lcov"
=============================================================================
Writing coverage object [C:\Users\denman\WebstormProjects\suman\coverage\empty.test\coverage.json]
Writing coverage reports at [C:\Users\denman\WebstormProjects\suman\coverage\empty.test]
=============================================================================
at ChildProcess.exithandler (child_process.js:203:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:818:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:469:12)
However, the first coverage report was generated for the first test file, but all subsequent commands failed.