vowsjs / vows

Asynchronous BDD & continuous testing for node.js
http://vowsjs.org
Apache License 2.0
1.56k stars 165 forks source link

Vows v0.9.0-rc2 breaks globbing on Windows #358

Closed shpros closed 6 years ago

shpros commented 9 years ago

Under Windows (Windows 7 with both CMD.EXE and Cygwin), wildcard globbing is broken in v0.9.0-rc2 and later code (e.g. master as of 2015-08-06), but works properly in v0.8.1 and v0.9.0-rc1. Globbing works correctly on a Linux VM (Linux precise64 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux).

The symptom is that the wildcard in vows tests/*.js does not get globbed into multiple individual files, but instead is treated as a file named *.js. From my investigation, it appears that this was broken by a change between v0.9.0-rc1 and v0.9.0-rc2. I suspect the combination of 4b7fecb225f000556cc71d6e910d198e92d9a388 and 0be6b23dc13664dc21119c61de8e649f023906b7 that were implemented to fix #337.

Result of running npm test in my project in Windows CMD.EXE or Cygwin with v0.8.1 or v0.9.0-rc1:

myproject $ npm test

> xpress@0.0.0 test D:\dev\myproject
> vows tests/*.js --spec --verbose

vows bin argv [ 'tests/*.js' ]
vows bin options {
    reporter: 'dot-matrix',
    matcher: /.*/
}
vows runner loading [ 'D:/dev/myproject/tests/delete-test.5', 'D:/dev/myproject/tests/delete-test', 'D:/dev/myproject/tests/event-test.5', 'D:/dev/myproject/tests/event-test' ]

.
.
.

vows runner finish
√ OK » 62 honored (58.236s)

Result of running npm test in my project in Windows CMD.EXE or Cygwin with v0.9.0-rc2 or master:

myproject $ npm test

> xpress@0.0.0 test D:\dev\myproject
> vows tests/*.js --spec --verbose

vows bin argv [ 'tests/*.js' ]
vows bin options {
    reporter: 'dot-matrix',
    matcher: /.*/
}
vows runner loading [ 'D:\\dev\\myproject\\tests\\*.js' ]
module.js:338
    throw err;
          ^
Error: Cannot find module 'D:\dev\myproject\tests\*.js'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at D:\dev\myproject\node_modules\vows\bin\vows:564:19
    at Array.reduce (native)
    at importSuites (D:\dev\myproject\node_modules\vows\bin\vows:557:18)
    at Object.<anonymous> (D:\dev\myproject\node_modules\vows\bin\vows:290:15)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
npm ERR! Test failed.  See above for more details.

Result of running npm test in my project in Linux VM with v0.9.0-rc2:

vagrant@precise64:~/dev/myproject$ npm test

> xpress@0.0.0 test /home/vagrant/dev/myproject
> vows tests/*.js --spec --verbose

vows bin argv [ 'tests/delete-test.5.js', 'tests/delete-test.js', 'tests/event-test.5.js', 'tests/event-test.js' ]
vows bin options {
    reporter: 'dot-matrix',
    matcher: /.*/
}
vows runner loading [ '/home/vagrant/dev/myproject/tests/delete-test.5', '/home/vagrant/dev/myproject/tests/delete-test'
, '/home/vagrant/dev/myproject/tests/event-test.5', '/home/vagrant/dev/myproject/tests/event-test' ]

.
.
.

vows runner finish
√ OK » 62 honored (56.491s)

I investigated further by cloning the vows project and running its tests. The unit tests for Vows all pass on the Linux VM, but under Windows there are varying numbers of failing tests depending on which version of Vows I test with. I'm not concerned about the "should have full path in stack trace" test, because that's just a flaw in the tests that is looking for / at the beginning of the path. However, there is one additional failure that appears in v0.9.0-rc2 that I think is relevant, "Running vows with -i flag for test/fixtures/isolate/ all tests (*) with json reporter".

Result of running npm test in vows project in Linux VM with v0.9.0-rc2:

√ OK » 165 honored ∙ 4 pending (2.462s)

Result of running npm test in vows project in Windows CMD.EXE or Cygwin with v0.9.0-rc2:

  ? vows/assert

  An AssertionError
    ? should have full path in stack trace
        » expected true, got false // d:\dev\toolsrc\vows\test\assert-test.js:228

  ? vows/isolate

  Running vows with -i flag for test/fixtures/isolate/ all tests (*) with json reporter
    ? should have correct output
        » expected 20,
        got      1 (==) // d:\dev\toolsrc\vows\test\isolate-test.js:62
? Broken » 163 honored ∙ 2 broken ∙ 4 pending (2.539s)

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

Result of running npm test in vows project in Windows CMD.EXE or Cygwin with v0.9.0-rc1 or v0.8.1 (different total number of tests, but same results for these two tests):

  Running vows with -i flag for test/fixtures/isolate/ all tests (*) with json reporter
    √ should be not ok
    √ should have correct output

.
.
.

  ? vows/assert

  An AssertionError
    ? should have full path in stack trace
        » expected true, got false // D:\dev\toolsrc\vows\test\assert-test.js:226
? Broken » 161 honored ∙ 1 broken ∙ 4 pending (3.223s)

npm ERR! Test failed.  See above for more details.
shpros commented 9 years ago

Having played around with this a little bit more, I'm confused about what problem the commits 0be6b23dc13664dc21119c61de8e649f023906b7 and 4b7fecb225f000556cc71d6e910d198e92d9a388 are supposed to be fixing. I tried rolling back bin/vows to commit a5a124dc7b50c979372480b00cd9a0291f5dac63, keeping the tests at tip, but the tests in passing.coffee are still passing, as are all of the tests. That tells me that we don't really have a test illustrating the problem that 0be6b23dc13664dc21119c61de8e649f023906b7 and 4b7fecb225f000556cc71d6e910d198e92d9a388 were written to fix.

BTW, rolling back bin/vows to commit a5a124dc7b50c979372480b00cd9a0291f5dac63 makes the Windows globbing work again, even with the newer version of glob that vows v0.9.0-rc2 is using.

evanp commented 6 years ago

vows 1.x doesn't do implicit globbing, so I think this is probably fine. Closing for now.

shpros commented 6 years ago

Thanks for the note. I'll let my project team know that we can/should test out vows 1.x.