0.0.9 • Published 10 years ago

stonefly v0.0.9

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

Stonefly.js

Stonefly.js is a minimalist unit test framework for Node.js projects using Require.js.

Installation

API

Describing a collection of tests (a suite)

define( function( requirejs )
{
    
    // Grab an instance of Stonefly
    var Stonefly = require( 'stonefly' );
    
    Stonefly.describe( "Math floor function", function()
    {
    
        // Test that the floor function given a value greater than zero and less than 1
        // returns a 0 value.
        Stonefly.it( "Math floor function returns zero for 0.1", function( done )
        {
            Stonefly.expect( Math.floor( 0.1 ) ).toBe( 0 );
            done();
        } );
        
        // Test that the floor of 0.9 resolves to something other than 1
        Stonefly.it( "Math floor functions return not 1 for 0.9", function( done )
        {
            Stonefly.expect( Math.floor( 0.9 ) ).notToBe( 1 );
            done();
        } );
        
        // Guarantee that the Math function actually exists
        Stonefly.it( "Math floor function exists", function( done )
        {
            // Expect can be used alone to just evaluate a value's truthiness
          Stonefly.expect( Math );
          Stonefly.expect( Math.floor );
          done();
        } );
        
    } );
    
    // Once all suites have been described and all tests, tell Stonefly to run.
    // runAndExit will execute tests and then exit the process with a success code
    // if the tests succeed and a failure code if they do not.
    Stonefly.runAndExit();
    
} );

License

MIT License

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