wbyoung/avn

Test RegEx not catching all cases

duckontheweb opened this issue · 2 comments

Please describe your issue clearly and also include all details below.

Details

  • avn 0.2.3
  • node v6.11.5
  • nvm 0.33.6
  • n 2.0.0
  • zsh zsh 5.0.8 (x86_64-apple-darwin15.0)
  • bash version 3.2.57(1)-release (x86_64-apple-darwin15)

The output of __avn_debug in the directory with a .node-version file is:

# paste output here

avn is loaded in my ~/.{bash|zsh}{_profile|rc} file with:

# find the relevant line(s) in your profile & note path above

nvm specific

  • As an nvm user I am confirming that I did not install with Homebrew

I am starting in on a PR for #43, but I have a couple of tests failing. One of them is the fails for any failed action test in test/setup.js, which give the following failed test output:

AssertionError: expected 'error: EACCES: permission denied, open \'/var/folders/1p/9z6dp_4n2cd27d2ktj6w_xv40000gn/T/d-1171011-15092-10e8ilz.4tsh8h0k9/.bash_profile\'\n' to match /^error: EACCES.*, open '[\/\w-]*\/.bash_profile'\n$/

It looks like the regex is just not catching my error message case. I can dig into the regex and fix it to catch this, but I wanted to bring this to your attention in case it's a known issue that I should ignore.

This is the old regex:

/^error: EACCES.*, open '[\/\w-]*\/.bash_profile'\n$/

This is the updated regex that catches my case:

/^error: EACCES.*, open '[\/\w-\d\.]*\/.bash_profile'\n$/

The changes were matching digits and the dot character in the directory portion before .bash_profile. I've tested this locally and the test now passes.

@duckontheweb looks like a good change. Please feel free to throw up a separate PR.