Skip to content

run-tests.js is broken for cmd.exe #294

Closed
@nfischer

Description

@nfischer

I was trying out run-tests.js on my Windows machine, and ran into lots of problems. Since we're trying to get good support for Windows, I figured I'd make this a formal issue so that others can chime in and confirm the behavior I'm seeing.

The end-goal of this issue is to open up cmd.exe on Windows, cd to the shelljs directory, type npm test, and see that all the tests pass. To me this seems like a worthy goal.

With that said, if someone else sees behavior different from what I'm seeing, please verify that you're running everything through cmd.exe, like I am. I already know this can run on some other shells (Bash, for instance), but I'd like to see this work on this particular shell.

Initial problems I've seen:

  • must use node path/to/jshint in the run-tests script, instead of relying on the shebang
  • must expand wildcards ourselves, not relying on the shell, since cmd relies on the application to expand them, and jshint doesn't appear to be doing this
  • exec() will start in the current working directory if run through cmd.exe. If we pass the cwd argument to child_process.exec(), then this will fix the issue only for admin mode (not regular user mode). I think this is only possible to fix for admin mode. This means that all our exec calls will need pwd() prefixed to the paths.

I'll add more to the list in comments as I find the issues.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions