iamchrismiller / grunt-casper

Run CasperJS Scripts/Functional Tests
Other
69 stars 38 forks source link

Tests run in reverse (backwards) order? #62

Closed icd2k3 closed 9 years ago

icd2k3 commented 9 years ago

Is this a bug or is there an option to change the order that tests run in? I have a folder of tests like so:

/tests/01-testName.js
/tests/02-testName.js

And in Grunt:

casper: {
    target: {
        files: { 'path/to/results.xml' : ['tests/*.js'] }
    }
}

Test 02-testName.js is always executed before 01-testName.js! I've also tried renaming them to A, B, etc, but they always seem to run in reverse alphabetical order. Any ideas?

Edit: the only workaround I found is a setup like this using array.reverse():

files: { path/to/results.xml' : [
    '/tests/01-testName.js'
    '/tests/02-testName.js'
].reverse()}

But this is not ideal because it requires me to manually list tests instead of using a wildcard *.js

Any thoughts?

iamchrismiller commented 9 years ago

I can look into this, but just out of curiosity why do your tests care about order?

iamchrismiller commented 9 years ago

https://github.com/iamchrismiller/grunt-casper/releases/tag/v0.4.2 fixes you issue

icd2k3 commented 9 years ago

Thanks Chris! As for your question, we have a huge test suite divided up into test flow group folders.

Each test group folder is a target in grunt-casper and it's own island that doesn't care about order or what happens in other groups. However, order within the groups matters. Anyways, thanks again for the fix!