2.1.2 • Published 2 years ago

tea-time v2.1.2

Weekly downloads
163
License
MIT
Repository
github
Last release
2 years ago

Unit test: Tea Time!

This is a battery included mocha-compatible test framework.

For the doc, start reading the mocha documentation.

Specific Tea Time! features:

  • Many reporters can be used at once, just using multiple --reporter options in the CLI

  • NEW! Promise-returning (or async function) tests and hooks

  • NEW! Built-in expect assertion (but custom assertion lib can be used as well), through the expect global function

  • NEW! (beta) Built-in test coverage, with in-terminal report, example:

    tea-time -C

    ... or even better using a pager:

    tea-time -C | less -r

  • Run browser tests directly from the CLI! So you can script browser tests as well! This example will grab all test in the test directory and build a browser version of them using Browserify, create a HTML target file in the OS tmp directory, open it using Firefox, run the test in Firefox while reporting anything to Tea Time (using websocket behind the scene).

    tea-time test/*js --tmp-html --ws --browserify --browser firefox

    ... or use the shorthand:

    tea-time test/*js --bb firefox

  • Optional tests:

    	When an optional test fails, it does not cause a 'fail' but an 'optionalFail'.
    	Optional fails don't produce non-zero exit code.
    	Common use cases are next iteration preparation, or test cases created just after a bug discovery: we do not want those
    	fails to prevent new releases since there is no regression.
    
    	Syntaxes:
    	- .optional()
    	- .opt()
    	- .next()
    it.optional( "Optional test" , function( done ) {
        throw new Error( "Optional fail" ) ;
    } ) ;
  • Better test isolation, mocha (v3.0.2 ATM) would fail to run this test properly:

    describe( "Desync" , function() {
        
        it( "should timeout and fail after the timeout" , function( done ) {
            
            this.timeout( 100 ) ;
            
            setTimeout( function() {
                throw new Error( "Delayed fail" ) ;
            } , 200 ) ;
        } ) ;
        
        it( "should pass without being affected by the previous test after-timeout failure" , function( done ) {
            
            setTimeout( function() {
                done() ;
            } , 500 ) ;
        } ) ;
    } ) ;

Install

Install it globally: npm install -g tea-time.

Usage

Usage is: tea-time test files option2

Available options:

  -h , --help             Show this help
  -C , --cover            Perform test coverage (beta feature, node.js only)
  -t , --timeout <time>   Set the default timeout for each test (default: 2000ms)
  -s , --slow <time>      Set the default slow time for each test (default: 75ms)
  -g , --grep <pattern>   Grep: filter in tests/suites by this pattern (can be used multiple times)
  -c , --console          Allow console.log() and friends
  -b , --bail             Bail after the first test failure
  -O , --skip-optional    Skip optional tests
  -R , --reporter <name>  Set/add the reporter (can be used multiple times)
 --clientReporter <name>  Set/add the client reporter (see --browser, can be used multiple times)
       --html <file>      Build one HTML file for all input test files, to run the test in browsers
       --tmp-html         Like --html but create a temporary file in the OS temp folder
       --browserify       In conjunction with --html, call Browserify to build a browser version
                          for each input files
       --ws               Start a websocket server, endpoint to the browser websocket client reporter
  -B , --browser <exe>    Open the html with the <exe> browser, need --html <file>,
                          force --ws and the websocket client reporter
       --bb <exe>         Shorthand for --tmp-html --ws --browserify --browser <exe>

Reporters

  • classic: the default reporter
  • one-line: one line status
  • panel: a reporter that does not scroll (except on the final error report, if any)
  • progress: a progress bar reporter
  • tap: Test Anything Protocol
  • dot: output colorful dots
  • verbose: like classic, but more verbose
  • report: use in conjunction with another reporter, only output the final status report
  • error-report: use in conjunction with another reporter, only output the final error report
  • coverage-summary: use in conjunction with another reporter, output partly uncovered files with percent
  • coverage-report: use in conjunction with another reporter, output all uncovered lines of code
  • notify: use in conjunction with another reporter, send a freedesktop.org notification with the final status report

Browser reporters:

  • classic: the default reporter
  • console: report everything in the browser console, using console.log()
  • websocket: connect to a local Tea Time instance, and send anything to it
2.1.2

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.15.0

4 years ago

1.14.5

4 years ago

1.14.4

4 years ago

1.14.3

4 years ago

1.14.2

5 years ago

1.14.1

5 years ago

1.14.0

5 years ago

1.13.0

5 years ago

1.12.0

5 years ago

1.11.0

5 years ago

1.10.16

5 years ago

1.10.15

5 years ago

1.10.14

6 years ago

1.10.13

6 years ago

1.10.12

6 years ago

1.10.11

6 years ago

1.10.10

6 years ago

1.10.9

6 years ago

1.10.8

6 years ago

1.10.7

6 years ago

1.10.6

6 years ago

1.10.5

6 years ago

1.10.4

6 years ago

1.10.3

6 years ago

1.10.2

7 years ago

1.10.1

7 years ago

1.10.0

7 years ago

1.9.0

7 years ago

1.8.5

7 years ago

1.8.4

7 years ago

1.8.3

7 years ago

1.8.2

7 years ago

1.8.1

7 years ago

1.8.0

7 years ago

1.7.0

7 years ago

1.6.6

7 years ago

1.6.5

7 years ago

1.6.4

7 years ago

1.6.3

7 years ago

1.6.2

7 years ago

1.6.1

7 years ago

1.6.0

7 years ago

1.5.0

7 years ago

1.4.5

7 years ago

1.4.4

7 years ago

1.4.3

7 years ago

1.4.2

8 years ago

1.4.1

8 years ago

1.4.0

8 years ago

1.3.8

8 years ago

1.3.7

8 years ago

1.3.6

8 years ago

1.3.5

8 years ago

1.3.4

8 years ago

1.3.3

8 years ago

1.3.2

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.1.0

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.9.0

9 years ago

0.8.8

9 years ago

0.8.7

9 years ago

0.8.6

9 years ago

0.8.5

9 years ago

0.8.4

9 years ago

0.8.3

9 years ago

0.8.2

9 years ago

0.8.1

9 years ago

0.8.0

9 years ago

0.7.9

9 years ago

0.7.8

9 years ago

0.7.7

9 years ago

0.7.6

9 years ago

0.7.5

9 years ago

0.7.4

9 years ago

0.7.3

9 years ago

0.7.2

9 years ago

0.7.1

9 years ago

0.7.0

9 years ago

0.6.2

9 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.12

9 years ago

0.5.11

9 years ago

0.5.10

9 years ago

0.5.9

9 years ago

0.5.8

9 years ago

0.5.7

9 years ago

0.5.6

9 years ago

0.5.5

9 years ago

0.5.4

9 years ago

0.5.3

9 years ago

0.5.2

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.5

9 years ago

0.4.4

9 years ago

0.4.3

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.29

9 years ago

0.3.28

9 years ago

0.3.27

9 years ago

0.3.26

9 years ago

0.3.25

9 years ago

0.3.23

9 years ago

0.3.21

9 years ago

0.3.20

9 years ago

0.3.19

9 years ago

0.3.18

9 years ago

0.3.17

9 years ago

0.3.16

9 years ago

0.3.15

9 years ago

0.3.14

9 years ago

0.3.13

9 years ago

0.3.12

9 years ago

0.3.11

9 years ago

0.3.10

9 years ago

0.3.9

9 years ago

0.3.8

9 years ago

0.3.7

9 years ago

0.3.6

9 years ago

0.3.5

9 years ago

0.3.4

9 years ago

0.3.3

9 years ago

0.3.2

9 years ago

0.3.1

9 years ago

0.3.0

9 years ago

0.2.10

9 years ago

0.2.9

9 years ago

0.2.8

9 years ago

0.2.7

9 years ago

0.2.6

9 years ago

0.2.5

9 years ago

0.2.4

9 years ago

0.2.3

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

10 years ago

0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

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