gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 786 forks source link

Invalid symlinks causes istanbul to fail #747

Open 0815fox opened 7 years ago

0815fox commented 7 years ago

I reported an issue against grunt-mocha-istanbul on this (see https://github.com/pocesar/grunt-mocha-istanbul/issues/66) but we found out, that the issue is in istanbul itself.

All works fine until I create a sym link to a file with extension '.js', which points to a not existing path. It seems not to matter, where I place that broken link.

$ ln -sT src/bar.js src/foo.js
$ ls -la src
$ grunt mocha_istanbul:server --debug
For remote client tests make sure you are connected to VPN.
Testing on 10.8.0.6:9876
Running "mocha_istanbul:server" (mocha_istanbul) task
[D] Task source: /home/mk/work/4.5.1/workspace2/cloud/node_modules/grunt-mocha-istanbul/tasks/index.js
/home/mk/work/4.5.1/workspace2/cloud/node_modules/istanbul/lib/cli.js:42
            throw ex; // turn it into an uncaught exception
            ^

Error: ENOENT: no such file or directory, stat '/home/mk/work/4.5.1/workspace2/cloud/src/foo.js'
    at Error (native)
>> 
Warning: Task "mocha_istanbul:server" failed. Use --force to continue.
Error: Task "mocha_istanbul:server" failed.
    at Task.<anonymous> (/home/mk/work/4.5.1/workspace2/cloud/node_modules/grunt/lib/util/task.js:205:15)
    at Timeout._onTimeout (/home/mk/work/4.5.1/workspace2/cloud/node_modules/grunt/lib/util/task.js:241:33)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)

Aborted due to warnings.

I use istanbul version 0.4.5.

Even when I just run istanbul on command line:

$ node_modules/.bin/istanbul cover node

it complains about that file:

Error: ENOENT: no such file or directory, stat '/home/mk/work/4.5.1/workspace2/cloud/src/foo.js'
    at Error (native)
0815fox commented 7 years ago

@gotwarlost Any ideas?

danielbaak commented 7 years ago

The problem still persists. :-(