ilearnio / module-alias

Register aliases of directories and custom module paths in Node
MIT License
1.76k stars 69 forks source link

Test failing on Windows 10 #86

Open mfaheemakhtar opened 4 years ago

mfaheemakhtar commented 4 years ago

Tests are failing on my Windows 10 Pro Education 64-bit.

I found that aliases[alias] = nodePath.join(base, aliases[alias]) is adding base path + alias (absolute) path resulting in an invalid location.

Changing join to resolve fixes the issue. aliases[alias] = nodePath.resolve(base, aliases[alias])

51 is also affected.

Please note that tests can't run on Windows using yarn run test. The command must be changed from "testonly": "NODE_ENV=test mocha test/specs.js", to "testonly": "SET NODE_ENV=test & mocha test/specs.js", in package.json.