mgenev / how-to-sane

A demonstration of how to use the SANE stack
http://howtosane.ninja
MIT License
163 stars 22 forks source link

Change test filenames to "-test.js" suffix and improve watch syntax #4

Closed IanVS closed 9 years ago

IanVS commented 9 years ago

To watch test files and run tests on changes, use "npm test -- --watch" from /server

Also adds a few more tests to check that validation errors are sent if username or password are blank.

Globegitter commented 9 years ago

Thanks again for the Pr - could you rather at this as

"scripts": { 
  autotest: mocha....
}

so you can do npm run-script autotest to have mocha. Otherwise I would still leave the runner file for npm test, since it removes mocha as a global dependency and is also the easiest to use for automated testing environments such as Travis :) Or you could also do it the other way around, have mocha on the normal test script and have the runner file as another script, if that makes sense.

IanVS commented 9 years ago

Sure, I didn't think about the dependency issue. I'll change it back so that mocha is only required to run with watch (it can't be done programmatically from the runner).

Globegitter commented 9 years ago

I think it's not too bad to have one watch command with the global mocha. There should just be an additional option for environments like travis that do not need a global mocha and don't watch :)

Globegitter commented 9 years ago

Ah yeah I think that is exactly what you said after reading a second time. My bad :P

IanVS commented 9 years ago

OK, hopefully I got things right this time? Let me know if there are other considerations I've missed. Thanks!

Globegitter commented 9 years ago

Yep all looking good now from my side :)