Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests don't work on Windows #429

Closed
feross opened this issue Sep 11, 2015 · 2 comments
Closed

Tests don't work on Windows #429

feross opened this issue Sep 11, 2015 · 2 comments

Comments

@feross
Copy link
Member

@feross feross commented Sep 11, 2015

Got this email from a user:

Hi feross,



I have been looking at the WebTorrent library and I am interested in being a part of it. However I am having some issues getting set up.

This is on windows. Once I have clone the repo and I try npm install it runs but it doesn’t install everything.

I think ran a loop to loop thru the sub directories and run npm install on them.

I got that to work but when running npm test it doesn’t seem to be working correctly.



Output

C:\Users\Shavaunh\Documents\webtorrent>npm test



> webtorrent@0.62.0 test C:\Users\Shavaunh\Documents\webtorrent

> standard && node ./bin/test.js



events.js:85

      throw er; // Unhandled 'error' event

            ^

Error: spawn npm ENOENT

    at exports._errnoException (util.js:746:11)

    at Process.ChildProcess._handle.onexit (child_process.js:1053:32)

    at child_process.js:1144:20

    at process._tickCallback (node.js:355:11)

    at Function.Module.runMain (module.js:503:11)

    at startup (node.js:129:16)

    at node.js:814:3

npm ERR! Test failed.  See above for more details.

Any help would be lovely

Thanks

Without doing any investigation, my guess is that tests don't work on Windows because we're using / instead of path.join all over the tests.

@shavyg2

This comment has been minimized.

Copy link

@shavyg2 shavyg2 commented Sep 13, 2015

So i found the problem and solved it. Just needed to use path.resolve and also do child.spawn("node"...[CMD,....,...]

This is because a windows system doesn't use the shebang so it might not know how to execute a js file. Spawning using node and node will understand how to read this.

Small issue silly as it sounds, is i don't know how to send a pull request.

josephfrazier pushed a commit to josephfrazier/webtorrent that referenced this issue Oct 4, 2015
josephfrazier pushed a commit to josephfrazier/webtorrent that referenced this issue Oct 4, 2015
See webtorrent#429 (comment)

> This is because a windows system doesn't use the shebang so it might
> not know how to execute a js file. Spawning using node and node will
> understand how to read this.
@josephfrazier

This comment has been minimized.

Copy link
Member

@josephfrazier josephfrazier commented Oct 7, 2015

My curiosity got the best of me and I tried this out in a Windows 10 VM:

screen shot 2015-10-06 at 10 17 19 pm

It turns out this is a long-standing issue, but cross-spawn-async provides a workaround. I'll be submitting a PR shortly :)

josephfrazier pushed a commit to josephfrazier/webtorrent that referenced this issue Oct 7, 2015
This allows Windows to run the tests, as promised in
webtorrent#429 (comment)

Note that there are a couple of outstanding failures on Windows:

    # client.seed: filesystem path to folder with one file, string
    not ok 8 should be equal
      ---
        operator: equal
        expected: '3a686c32404af0a66913dd5f8d2b40673f8d4490'
        actual:   'e6887b78d89d995876c7cef3476b6fb32c4c4e3d'
      ...
    not ok 9 should be equal
      ---
        operator: equal
        expected: |-
          'magnet:?xt=urn:btih:3a686c32404af0a66913dd5f8d2b40673f8d4490&dn=folder&tr=udp%3A%2F%2Ftracker.webtorrent.io%3A80'
        actual: |-
          'magnet:?xt=urn:btih:e6887b78d89d995876c7cef3476b6fb32c4c4e3d&dn=folder&tr=udp%3A%2F%2Ftracker.webtorrent.io%3A80'
feross pushed a commit to webtorrent/webtorrent-cli that referenced this issue Mar 11, 2016
This allows Windows to run the tests, as promised in
webtorrent/webtorrent#429 (comment)

Note that there are a couple of outstanding failures on Windows:

    # client.seed: filesystem path to folder with one file, string
    not ok 8 should be equal
      ---
        operator: equal
        expected: '3a686c32404af0a66913dd5f8d2b40673f8d4490'
        actual:   'e6887b78d89d995876c7cef3476b6fb32c4c4e3d'
      ...
    not ok 9 should be equal
      ---
        operator: equal
        expected: |-
          'magnet:?xt=urn:btih:3a686c32404af0a66913dd5f8d2b40673f8d4490&dn=folder&tr=udp%3A%2F%2Ftracker.webtorrent.io%3A80'
        actual: |-
          'magnet:?xt=urn:btih:e6887b78d89d995876c7cef3476b6fb32c4c4e3d&dn=folder&tr=udp%3A%2F%2Ftracker.webtorrent.io%3A80'
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.