jasminetea
Unfancy Jasmine2 in Node.js
Last updated 5 years ago by 59naga .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install jasminetea 
SYNC missed versions from official npm registry.

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][License] [License]: http://59naga.mit-license.org/

Current Tags

  • 0.3.0-alpha.1                                ...           latest (5 years ago)

59 Versions

  • 0.3.0-alpha.1                                ...           5 years ago
  • 0.3.0-alpha                                ...           5 years ago
  • 0.2.1                                ...           5 years ago
  • 0.2.1-alpha.2                                ...           5 years ago
  • 0.2.1-alpha.1                                ...           5 years ago
  • 0.2.1-alpha.0                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.2.0-beta.7                                ...           5 years ago
  • 0.2.0-beta.6                                ...           5 years ago
  • 0.2.0-beta.5                                ...           5 years ago
  • 0.2.0-beta.4                                ...           5 years ago
  • 0.2.0-beta.3                                ...           5 years ago
  • 0.2.0-beta.2                                ...           5 years ago
  • 0.2.0-beta.1                                ...           5 years ago
  • 0.2.0-beta.0                                ...           5 years ago
  • 0.2.0-alpha.3                                ...           5 years ago
  • 0.2.0-alpha.2                                ...           5 years ago
  • 0.2.0-alpha.1                                ...           5 years ago
  • 0.2.0-alpha.0                                ...           5 years ago
  • 0.1.30-rc.3                                ...           5 years ago
  • 0.1.30-rc.2                                ...           5 years ago
  • 0.1.30-rc.1                                ...           5 years ago
  • 0.1.30-rc.0                                ...           5 years ago
  • 0.1.29                                ...           5 years ago
  • 0.1.28                                ...           5 years ago
  • 0.1.27                                ...           5 years ago
  • 0.1.26                                ...           5 years ago
  • 0.1.25                                ...           5 years ago
  • 0.1.24                                ...           5 years ago
  • 0.1.23                                ...           5 years ago
  • 0.1.22                                ...           5 years ago
  • 0.1.21                                ...           5 years ago
  • 0.1.20                                ...           5 years ago
  • 0.1.19                                ...           5 years ago
  • 0.1.18                                ...           5 years ago
  • 0.1.17                                ...           5 years ago
  • 0.1.16                                ...           5 years ago
  • 0.1.15                                ...           5 years ago
  • 0.1.14                                ...           5 years ago
  • 0.1.13                                ...           5 years ago
  • 0.1.12                                ...           5 years ago
  • 0.1.11                                ...           5 years ago
  • 0.1.10                                ...           5 years ago
  • 0.1.9                                ...           5 years ago
  • 0.1.8                                ...           5 years ago
  • 0.1.7                                ...           5 years ago
  • 0.1.5                                ...           5 years ago
  • 0.1.4                                ...           5 years ago
  • 0.1.3                                ...           5 years ago
  • 0.1.2                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
  • 0.0.7                                ...           5 years ago
  • 0.0.6                                ...           5 years ago
  • 0.0.5                                ...           5 years ago
  • 0.0.4                                ...           5 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 120
Dependencies (12)
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |