-
-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
TextExclude.shouldInstrument(filename) returns false when options.relativePath is true and filename is not inside options.cwd.
However:
- when
options.cwdis a symlink and is passed with its symlink unresolved - but
filenameresolves the symlink (throughfs.realpath()for example) - then
shouldInstrument()will returnfalseeven though it should returntrue.
This is likely to happen since:
- the filename passed by
nycalways has symlinks resolved because that's howmodule._compile()works - however
nycuser might pass aoptions.cwdthat has an unresolved symlink.
Real-life example: running the following on Travis on Mac OS:
const os = require('os');
const execa = require('execa');
const cwd = os.tmpdir();
await execa.shell(`nyc --cwd ${cwd}`)Travis Mac OS environment:
- returns
/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/Twithos.tmpdir() - but this directory is a symlink for
/private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T - as a consequence all
filenamepassed totestExclude.shouldInstrument()will start with/private/var/..., whileoptions.cwd()will start with/var/..., even though it's the same folder.
One possible solution would be to run fs.realpath() on both filename and options.cwd() before comparing them.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels