Skip to content

Contributing to Fay

Adam Bergmark edited this page Aug 8, 2013 · 6 revisions

Compiling

When recompiling fay you need to recompile fay-base as well. It might be best to do

fay$ git clone git://github.com/faylang/fay-base.git
fay$ cabal(-dev) install . fay-base/

Git

If you intend on submitting a pull request, whichever branch you choose to submit a pull request on, please ensure that it is properly rebased against master. This will ensure that the merge is clean and that you have checked that your contribution still works against the recent master. A typical workflow might be:

Set up a remote that you can use to track the main repository:

$ git remote add fay git://github.com/faylang/fay.git

Start our topic branch:

$ git branch my-topic-branch

Hack hack hack! Once changes committed, run git pull on master and try to rebase onto it to check whether your work is out of date.

$ git commit -a -m "My topic done."
$ git fetch fay
$ git rebase fay/master -i

Install with cabal install and run fay-tests. If there are no warnings and all tests pass, move on.

If there are any conflicts, resolve them. Install and run fay-tests again. Push changes to your Github fork:

$ git push origin my-topic-branch

Make a pull request on Github for my-topic-branch. Pull request gets merged in. Pull from the official Github remote:

$ git pull haskell master

Delete your topic branch:

$ git branch -D my-topic-branch

I'm all done!

Tests

There are two different kinds of tests.

Most of the tests are done at the top level, add a MyTest.hs and MyTest.res file in tests/. You don't need to modify or recompile fay-tests in order to run these. The hs file is compiled, the resulting javascript is run with nodejs and the res file contains the expected output from nodejs. All test files should be added as extra-source-files in fay.cabal so they are included when we sdist for release.

The Api/CommandLine tests are meant to be regular Haskell tests, feel free to test whatever you want here!

Tips

  • :r in ghci is much faster than recompiling with cabal
  • You can run the test for tests/MyTest.hs with fay-tests -t MyTest
  • fay --pretty --html-wrapper --include tests tests/Test.hs && node tests/Test.js is another way of running one test, useful if you want to inspect the output or use a web browser debugger.
  • If you added debug logging during compilation it's nice to use fay-prim to get cleaner output. Compile with --base-path fay-prim/.