smspillaz / pubmed-retraction-analysis

Analysis of papers retracted from PubMed
MIT License
5 stars 4 forks source link

Add testing frameworks #27

Closed smspillaz closed 8 years ago

smspillaz commented 8 years ago

This PR adds both mocha, green, polysquarelint, prospector and eslint and adds tasks to the package.json and setup.py files

These can be run with Travis, which should also run this commit.

Various bugs were found in the process, which have been fixed.

smspillaz commented 8 years ago

Not ready yet - I'll have to take another look at this tomorrow or Tuesday. There's some weird things going on in travis.

smspillaz commented 8 years ago

Okay, this should be ready to merge now.

You should be able to see that travis built this branch successfully. That's good. Now all we have to do is keep it green. Any new PRs shouldn't break the build. They are fairly strict about code style, so its in your best interests to push early, push often.

If you ever need to quickly check whether your build is lint-passing, you can use:

python setup.py polysquarelint --exclusions=*/venv/*,*/node_modules/*,*/dist/*,*/public/components/* --suppress-codes=I100,LongDescription,D203
npm run lint

I appreciate that's verbose, so I'll add a script to do that in a follow-up.

Testing frameworks have been added. To add new tests, just drop files into the test directory. .js files get picked up automatically. I am using the mocha testing framework for JS and chai as the assertion library. You should be able to get the gist of it by looking at the examples in there.

The only restrictions with python tests is that they must be named test_xxx.py and all methods which test something must start with test_ and be in a class starting with Test