Giter Club home page Giter Club logo

htf-viewer's Introduction

htf-viewer

The goal of this project is to provide a pretty viewable view of HTF haskell tests, kind of like what karma does for javascript tests. A node server will listen for HTF test output changes, parse them, and do a push to a local angularUI for pretty display.

Installation

> npm install htf-viewer -g

And to run, go to your haskell source directory and run

> htf-viewer

Use Case

Personally I write my haskell these days in sublime text, and while the console cabal test output is fine and dandy sometimes I wish I would see the results of all the tests, and not just the failed ones. HTF, I noticed, writes test results to a specific log file in a format like:

Test suite Ht1Tests: RUNNING...
[TEST] TestFixtures:targetMatches (src/tests/TestFixtures.hs:15)
+++ OK (0ms)

[TEST] TestFixtures:isBuyableFalse (src/tests/TestFixtures.hs:18)
assertEqual failed at src/tests/TestFixtures.hs:18
* expected: False
* but got: True
* diff:
F Fals
S Tru
C e<......>C
*** Failed! (81ms)

[TEST] TestFixtures:updateCart (src/tests/TestFixtures.hs:21)
+++ OK (0ms)

* Tests:    4
* Passed:   4
* Pending:  0
* Failures: 0
* Errors:   0

Total execution time: 90ms
Test suite Tutorial: PASS
Test suite logged to: dist/test/HTF-0.11.0.1-Tutorial.log

And I thought it'd be fun (and look nice) to be able to spin up a browser and have these files auto watched. This way I can get a clean overview of what all my tests did in a constantly ready UI.

Configuration

If you want, you can specify the project source and port in a hconfig.json file in your haskell directory. However, by default it will use port 3000 and use the local directory as the haskell project root. Your haskell projects should be a cabalized project using HTF.

{
    "projectSource": "/Users/devshorts/Projects/code/haskellProject",
    "port": 3000
}

Running

Load up the app with node app.js. After that, test-viewer will listen for HTF log file changes in the dist/test/*.log folder and re-parse any haskell test output files after they are detected to have been changed. Failed parsings are ignored.

Hitting the cabal test button does what it says it'll do. It'll run cabal test for the configured project source, which will trigger a re-parse of the output test files.

Adding more parsers

If the parser that is included isn't robust enough, you can create a wrapper around this package and inject your own parsers to the server. Do the following

var test-viewer = require("htf-viewer").App;

new test-viewer([list of parsers]).run();

The default parser will be appended to your parser list. The first parser that succeeds will be the one that is used.

Screen Shots

Main page

Development

If you want to add the to the repo, you'll need the following installed

  • typescript
  • node
  • foundation
  • compass
  • ruby
  • haskell (with HTF) (optional, but why wouldn't you?)

htf-viewer's People

Contributors

devshorts avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.