npm / node-which

Like which(1) unix command. Find the first instance of an executable in the PATH.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows tests fail on linux because writing to process.env is implicitly converted to a string

Naddiseo opened this issue · comments

commented

According to the documentation for process.env, assigning an undefined variable to it, will implicitly convert the value to a string.

This behaviour can sometimes cause bugs in the tests due to the pathExt test saving an undefined value, then restoring it later, which later can cascade into the getPathInfo function causing it to think that "undefined" is a valid file extension.

I'm having trouble reproducing this on master at the moment, but I'm currently writing a PR to fix #37, in which this bug is causing the tests to fail.

Travis shows tests passing on Linux. Where are you seeing that fail? (Or do you mean some other tests of some other program?)

That pathExt test only runs on Windows, not on Linux.

commented

IIRC, I was running npm test with this repo, which runs tests/windows.js, this file sets process.env.OSTYPE = 'cygwin' causing isWindows to be true, thus pathExt tests get run on linux.

I can double check tomorrow when I'm back at $work, and see if I can make a test case.