0.3.0-alpha.1 • Published 10 years ago

jasminetea v0.3.0-alpha.1

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

Jasminetea NPM version Build Status Coverage Status

          {
       }   }   {
      {   {  }  }
       }   }{  {
      {  }{  }  }          
     { }{ }{  { }          
   .- { { }  { }} -.       
  (  { } { } { } }  )      
  |`-..________ ..-'|      
  |                 |      
  |                 ;--.   
  |          ___    (__  \           _            _             
  |         |_  |    | )  )         (_)          | |            
  |           | | __ _ ___ _ __ ___  _ _ __   ___| |_ ___  __ _ 
  |           | |/ _` / __| '_ ` _ \| | '_ \ / _ \ __/ _ \/ _` |
  |       /\__/ / (_| \__ \ | | | | | | | | |  __/ ||  __/ (_| |
  |       \____/ \__,_|___/_| |_| |_|_|_| |_|\___|\__\___|\__,_|
   `-.._________..    

is Jasmine2 using CoffeeScript in Node.js

Getting started

.
├─ src
│  └─ index.coffee
└─ test
   └─ api.spec.coffee

./src/index.coffee

class MyModule
  encode: (str)->
    'data:text/plain;base64,'+(new Buffer str).toString 'base64'

  decode: (datauri)->
    (new Buffer datauri.slice(datauri.indexOf(',')+1),'base64').toString()

module.exports= new MyModule
module.exports.MyModule= MyModule

./test/index.coffee

MyModule= (require '../src').MyModule
myModule= require '../src'

fixture= 'foo'

describe 'API',->
  datauri= null

  it 'instanceof MyModule',->
    expect(myModule instanceof MyModule).toBe true

  it 'encode',->
    datauri= myModule.encode fixture
    expect(datauri).toBe 'data:text/plain;base64,'+(new Buffer fixture).toString 'base64'
  
  it 'decode',->
    str= myModule.decode datauri 
    expect(str).toBe fixture

1, 2, 3, Jasminetea!

$ npm install jasminetea --global

$ jasminetea
#
#  7_P +361 ms Found 1 files in test/*[sS]pec.coffee ...
# 
# 
# Running 3 specs.
# 
# API
#     instanceof MyModule: passed
#     encode: passed
#     decode: passed
# 
# 3 specs, 0 failures
# Finished in 0 seconds

More commands

--lint, -l

Check the code quality in *.coffee and src/*.coffee and test/*.coffee After the test. by CoffeeLint. Use .coffeelintrc as config if exists current working directory or home directory(e.g.~/.coffeelintrc). If change the subject then Type the glob separated by commas After the --lint.

Example:

$ jasminetea --lint
# 7_P +182ms Found 4 files in test/*[sS]pec.coffee ...
# ...
# 7_P    +1s Lint in *.coffee and src/*.coffee and test/*.coffee ...
# ...
# ✓ Ok! » 0 errors and 0 warnings in 8 files

$ jasminetea --lint foo/bar/baz/**/*.spec.coffee
# 7_P +182ms Found 4 files in test/*[sS]pec.coffee ...
# ...
# 7_P    +1s Skip --lint.   Because not exists in foo/bar/baz/**/*.spec.coffee

--cover, -c

Calculate the code coverage in src After the test. by Ibrik

$ jasminetea --cover
# 7_P +182ms Found 4 files in test/*[sS]pec.coffee ...
# ...
# 7_P    +1s Calculating...
# =============================================================================
# Writing coverage object [/Users/59naga/Downloads/jasminetea/coverage/coverage.json]
# Writing coverage reports at [/Users/59naga/Downloads/jasminetea/coverage]
# =============================================================================
# 
# =============================== Coverage summary ===============================
# Statements   : 88.65% ( 336/379 )
# Branches     : 64.84% ( 83/128 )
# Functions    : 88.57% ( 62/70 )
# Lines        : 92.75% ( 179/193 )
# ================================================================================

Also, Can post the coverage report to coveralls.io If use --report Need to beforehand set the COVERALLS_REPO_TOKEN in environment or .coveralls.yml

$ export COVERALLS_REPO_TOKEN=my_coveralls_repo_token
$ jasminetea --cover --report
# 7_P +182ms Found 4 files in test/*[sS]pec.coffee ...
# ...
# 7_P    +1s Calculating...
# ...
# 7_P    +6s Posted a coverage report.

The process exits with code 1 if test failing or no specs found.

$ jasminetea unknown/directory --cover && echo "success" || echo "failure"
# 7_P +206ms Spec not exists in unknown/directory/*[sS]pec.coffee
# 7_P   +3ms Skip --cover.  Because not exists in unknown/directory/*[sS]pec.coffee
# failure

-w, --watch

Monitor changes in *.coffee and src/*.coffee and test/*.coffee after the above commands if use option. Re-execution the jasminetea if has been changed in globs. If change the subject then Type the glob separated by commas After the --watch.

$ jasminetea --watch
# 7_P +182ms Found 4 files in test/*[sS]pec.coffee ...
# ...
# 7_P    +1s Lint in *.coffee and src/*.coffee and test/*.coffee ...
# ...
# 7_P    +1s Watch in *.coffee and src/*.coffee and test/*.coffee ...

$ jasminetea --watch foo/bar/baz/**/*.spec.coffee
# 7_P +182ms Found 4 files in test/*[sS]pec.coffee ...
# ...
# 7_P    +1s Watch in foo/bar/baz/**/*.spec.coffee ...

Other options

See $ jasminetea --help

#
#  Usage: jasminetea [specDir] [options...]
#
#  Options:
#
#    -h, --help            output usage information
#    -V, --version         output the version number
#    -c --cover            Use ibrik, Code coverage calculation
#    --report              Send lcov.info to coveralls.io via --cover
#    -l --lint [globs]     Use .coffeelintrc, Code linting after run. Find in [globs] (can use "," separator)
#    -w --watch [globs]    Watch file changes. See [globs] (can use "," separator)
#    -f --file [specGlob]  Target [specGlob] (default "*[sS]pec.coffee")
#    -r --recursive        Search to recursive directory
#    -S --silent           Use dots reporter
#    -s --stacktrace       Output stack trace
#    -t --timeout <msec>   Success time-limit (default 500 msec)
#    -d --debug            Output raw commands
#

License

MIT

0.3.0-alpha.1

10 years ago

0.3.0-alpha

10 years ago

0.2.1

10 years ago

0.2.1-alpha.2

10 years ago

0.2.1-alpha.1

10 years ago

0.2.1-alpha.0

10 years ago

0.2.0

10 years ago

0.2.0-beta.7

10 years ago

0.2.0-beta.6

10 years ago

0.2.0-beta.5

10 years ago

0.2.0-beta.4

10 years ago

0.2.0-beta.3

10 years ago

0.2.0-beta.2

10 years ago

0.2.0-beta.1

10 years ago

0.2.0-beta.0

10 years ago

0.2.0-alpha.3

10 years ago

0.2.0-alpha.2

10 years ago

0.2.0-alpha.1

10 years ago

0.2.0-alpha.0

10 years ago

0.1.30-rc.3

10 years ago

0.1.30-rc.2

10 years ago

0.1.30-rc.1

10 years ago

0.1.30-rc.0

10 years ago

0.1.29

10 years ago

0.1.28

10 years ago

0.1.27

10 years ago

0.1.26

10 years ago

0.1.25

10 years ago

0.1.24

10 years ago

0.1.23

10 years ago

0.1.22

10 years ago

0.1.21

10 years ago

0.1.20

10 years ago

0.1.19

10 years ago

0.1.18

10 years ago

0.1.17

10 years ago

0.1.16

10 years ago

0.1.15

10 years ago

0.1.14

10 years ago

0.1.13

10 years ago

0.1.12

10 years ago

0.1.11

10 years ago

0.1.10

10 years ago

0.1.9

10 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago