Skip to content

CLI not working on Windows #984

Closed
@eugirdor

Description

@eugirdor

The CLI is not working for me on Windows, and the issue seems to be with this code:

ava/cli.js

Lines 11 to 15 in f9fe8f2

if (localCLI && localCLI !== __filename) {
debug('Using local install of AVA');
require(localCLI);
return;
}

if (localCLI && localCLI !== __filename) {
    debug('Using local install of AVA');
    require(localCLI);
    return;
}

The problem is with the use of !== to compare localCLI and __filename. In my case, the two variables hold the following values:

localCLI: c:\workspace\...\node_modules\ava\cli.js
__filename: C:\workspace\...\node_modules\ava\cli.js

As you can see, the drive letter c: is lowercase in localCLI and uppercase in __filename, thus failing the !== check.

Using !== to compare paths doesn't seem to be a particularly good idea since there are numerous different ways the exact same path can be encoded. Not sure what the best practice is for comparing paths in node.js is. Perhaps path.relative() could be used?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcurrent functionality does not work as desired

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions