Negligent Parachute Maintainers
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    locipublic

    loci

    Install

    npm install loci

    We can now run both server-side, and browser tests.

    Run browser tests

    With your test in /test, if loci is installed globally then just run loci -b in your terminal. Then, open up http://localhost:8000. Your tap tests output will be in the console in your browser.

    Here is a sample test

        {testComponenttestloci} = (require "loci").browser 
     
        # Pull in your component 
        component = require 'path/to/component'
     
     
        testComponent(component()->
            test ''(t)->
                t.plan(2)
                t.equal typeof Date.now'function'
                start = new Date
                
                setTimeout ()->
                    t.equal new Date - start100
                100
     
            test 'timing hiding'(t)->
                t.plan(1)
                
                t.equal typeof Date.now'function'
     
            test 'teardown'(t)->
             loci.emit 'teardown' #this tears the component down 
             t.end()
        )

    Notes

    - clientify has to be in the root level.
    

    Run server-side tests

    Built ontop of node-tap

    Add the following to scripts in package.json: - Globally installed 'test': 'loci' - Locally installed 'test': 'path/to/loci/bin/loci'

    Then in the terminal run: npm test

    Here is a sample test:

    Reall all thats happening here is loci exposing node-tap

     
        test = (require'loci').test
     
        test "a cool test"(t)->
            t.plan(1)
            t.ok(true"It's ok to plan, and also end.  Watch.")
     

    Here another sample with loci.api

     
        {apitest} = require'loci'
     
        test "a cool api test"(t)->
            t.plan(1)
            t.ok(true"It's ok to plan, and also end.  Watch.")
     

    Keywords

    none

    install

    npm i loci

    Downloadsweekly downloads

    6

    version

    0.2.0

    license

    none

    last publish

    collaborators

    • avatar