Fix tests for windows systems #973

Merged
merged 2 commits into from Apr 8, 2013

Conversation

Projects
None yet
2 participants
Contributor

stevenbenner commented Mar 28, 2013

Currently tests are producing several failures on windows systems. This is happening because of two issues where cli test conditions do not match the functionality in the cli code being tested. This patch resolves the following issues:

  1. Add process.env.HOMEPATH fallback for .jshintrc files
    The testHomeRcFile and testTargetRelativeRcLookup tests were only using process.env.HOME, which returns undefined on windows systems. It also does not match the functionality of findConfig() which coalesces the HOME and HOMEPATH environmental variables to support both *nix and windows.
  2. Normalize paths for stubbed .jshintrc files
    The testHomeRcFile and testTargetRelativeRcLookup tests were stubbing the .jshintrc files with hard coded forward slashes for path separators, which does not match the paths that the findConfig() will try to open. The findConfig() function runs the file paths through the path.resolve() method which returns a normalized path string. So the stubbed file commands were never actually being executed on windows systems.

Please note that I only fixed the failing tests in this patch. It might be a good idea to go through all of the tests at some point and make sure that paths are normalized across the board.

stevenbenner added some commits Mar 28, 2013

@stevenbenner stevenbenner Added HOMEPATH fallback for HOME to cli tests.
The home path lookups in the cli tests were only using process.env.HOME,
which does not match the way the src/cli.js code works. This adds a
HOMEPATH fallback to match the tested functionality and support windows
systems.
e03688b
@stevenbenner stevenbenner Normalized stubbed .jshintrc paths for cli tests.
The paths that were being used to stub .jshintrc files did not match the
paths that would be searched for by the findConfig() function because
they are using hard coded forward slashes as path separators, but the
findConfig() function runs the supplied file path through path.resolve()
which returns normalized paths. This commit normalizes the stubbed
.jshintrc paths to match the functionality in findConfig() and support
windows systems.
3c74eb5

valueof merged commit b216fd7 into jshint:master Apr 8, 2013

1 check passed

default The Travis build passed
Details
Owner

valueof commented Apr 8, 2013

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment