juliangruber / browser-run

Run code inside a browser from the command line
447 stars 62 forks source link

Windows issues #75

Closed sprat closed 1 year ago

sprat commented 8 years ago

I try to use tape-run but can't because I have many issues on my Windows box:

  1. electron is not supported on my (old) Windows box. So I need to switch to another browser
  2. real browsers detection fail too due to bugs in browser-launcher which is not maintained anymore!

Can I suggest moving to browser-launcher2 instead of browser-launcher, so that bugs are fixed?

juliangruber commented 8 years ago

i used to use browser-launcher2 but switched back to browser-launcher because that was working better for most cases. i'm happy to merge something in if it works well, but currently don't have time to work on this on my own.

out of curiosity, what windows version are you running?

sprat commented 8 years ago

I use Vista. I would upgrade if I could, but the update is so expensive...

But anyway, if you look at the windows browser detection code, it's really fragile. Do you remember the issue you had with browser-launcher2?

juliangruber commented 8 years ago

i just looked through the history and it seems like this never actually used browser-launcher2. i'd be happy to accept a pull request to move to that.

sprat commented 8 years ago

I'm trying to do that but I am annoyed because I can't even run the tests. First, there is the makefile: I've replaced it by regular npm scripts. Then, many tests fail: all the tests using electron fail on my machine, that's not really surprising, but also phantomjs, spawn, and stream ones! Don't know if I'll have time to fix that too. Note that I installed phantomjs globally, so phantomjs tests should probably work...

For the record, here are the errors I get:

test/close.js ......................................... 0/2 3s
  window.close()
  not ok exit
    +++ found                                                          
    --- wanted                                                         
    -0                                                                 
    +3221225785                                                        
    compare: ===
    at:
      line: 13
      column: 7
      file: test/close.js
      type: Stream
    source: |
      t.equal(code, 0, 'exit');
    stack: |
      Stream.<anonymous> (test/close.js:13:7)
      Electron.<anonymous> (index.js:98:15)
      Electron._exit (node_modules/electron-stream/index.js:96:8)

  window.close()
  not ok test unfinished: window.close()
    at:
      line: 4
      column: 1
      file: test/close.js
    plan: 2
    count: 1
    source: |
      test('window.close()', function (t) {

test/empty.js ......................................... 1/1 738ms
test/error.js ......................................... 1/1 983ms
test/phantom.js ....................................... 0/3 30s
  phantomjs
  not ok Error: spawn phantomjs ENOENT
    at:
      line: 856
      column: 11
      file: util.js
      function: exports._errnoException
    code: ENOENT
    errno: ENOENT
    syscall: spawn phantomjs
    path: phantomjs
    spawnargs:
      - "C:\\Users\\Sylvain\\AppData\\Local\\Temp\\phantomjs-stream:1bc1bf06"
    test: phantomjs
    message: 'Error: spawn phantomjs ENOENT'
    stack: |
      exports._errnoException (util.js:856:11)

  phantomjs
  not ok missing test
  not ok missing plan
    results:
      ok: false
      count: 1
      pass: 0
      fail: 1
      failures:
        - ok: false
          id: 1
          time: 68.458
          name: phantomjs
          diag:
            at:
              line: 5
              column: 1
              file: test/phantom.js
            results:
              plan:
                start: 1
                end: 2
              count: 2
              pass: 0
              ok: false
              fail: 2
              time: 68.458
            source: |
              test('phantomjs', function (t) {

test/spawn.js ......................................... 0/1 569ms
  spawn
  not ok Error: spawn UNKNOWN
    at:
      line: 856
      column: 11
      file: util.js
      function: exports._errnoException
    code: UNKNOWN
    errno: UNKNOWN
    syscall: spawn
    test: spawn
    message: 'Error: spawn UNKNOWN'
    stack: |
      exports._errnoException (util.js:856:11)
      exports.spawn (child_process.js:362:9)
      test/spawn.js:5:12
      Test.test (node_modules/tap/lib/test.js:445:17)
      Object.<anonymous> (test/spawn.js:4:1)

test/stream.js ........................................ 0/1 1s
  stream
  not ok test unfinished: stream
    at:
      line: 4
      column: 1
      file: test/stream.js
    source: |
      test('stream', function (t) {

total ................................................. 2/9

  2 passing (37s)
  7 failing
juliangruber commented 8 years ago

You could set up a Linux Vm for running this project, so you have a good starting point.

This error spawn phantomjs ENOENT shows that maybe on Windows we should spawn phantom.exe or something.

sprat commented 8 years ago

First thing you should probably do in every dependent library: use cross-spawn instead of child_process.spawn. See https://github.com/nodejs/node-v0.x-archive/issues/5841

rtsao commented 8 years ago

This might fix at least the phantom test issue for you: https://github.com/juliangruber/browser-run/pull/79