Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lookupFiles fails when trying to open a symbolic link #1223

Closed
jeloou opened this issue May 22, 2014 · 1 comment
Closed

lookupFiles fails when trying to open a symbolic link #1223

jeloou opened this issue May 22, 2014 · 1 comment

Comments

@jeloou
Copy link

jeloou commented May 22, 2014

lookupFiles is using fs.statSync to get stat, but that method throws an error when you pass it the path to a symbolic link.

$ mocha test

fs.js:684
  return binding.stat(pathModule._makeLong(path));
                 ^
Error: ENOENT, no such file or directory 'test/.#foo.js'
    at Object.fs.statSync (fs.js:684:18)
    at /usr/local/lib/node_modules/mocha/bin/_mocha:442:19
    at Array.forEach (native)
    at lookupFiles (/usr/local/lib/node_modules/mocha/bin/_mocha:440:24)
    at runAgain (/usr/local/lib/node_modules/mocha/bin/_mocha:284:24)
    at Array.forEach (native)
    at Object.<anonymous> (/usr/local/lib/node_modules/mocha/bin/_mocha:283:6)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

This bug is pretty common if you're using emacs, symbolic links are used as interlocks to prevent the simultaneous editing of the same file. The solution is to change to fs.lstatSync which has the same behavior, but adds the isSymbolicLink method to the fs.Stats class (see jeloou/mocha@157f597).

What do you think?

@boneskull boneskull self-assigned this Aug 26, 2014
@boneskull
Copy link
Contributor

reminder to me to run some tests against this

@boneskull boneskull removed their assignment Aug 31, 2014
boneskull pushed a commit to boneskull/mocha that referenced this issue Aug 31, 2014
- symbolic links are followed if they are not broken
- move `lookupFiles()` into `utils` module
- add some tests for the symbolic link stuff
- build
tandrewnichols pushed a commit to tandrewnichols/mocha that referenced this issue Dec 15, 2014
- symbolic links are followed if they are not broken
- move `lookupFiles()` into `utils` module
- add some tests for the symbolic link stuff
- build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants