Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fox

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fox

The testing tool I like.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-85.29%
Maintainers
1
Weekly downloads
 
Created
Source

Fox Build Status

A new pragmatic JavaScript testing framework running on NodeJS and browsers. It doesn't require writing configuration, writing HTML files or any other ceremonies. It just let's you write and run tests in a very simple and quick way.

$ npm install -g fox

Writing Tests

Create a new test document and name it test.js. ChaiJS' expect and assert modules are injected to the test modules by default;

describe('Number', function(){
  it('converts a date to a number', function(){    
      expect( Number(new Date) ).to.be.a('number')
  })
})

Available BDD methods:

  • before
  • beforeEach
  • describe
  • it
  • afterEach
  • after

Running on Node

$ fox test # Globbing and multiple parameters are enabled.
OK, passed 1 test.

Running On Browsers

$ fox test -b
Visit localhost:7559 to run tests on a web browser

Once you pass -b parameter, fox compiles your source code for browsers and publishes a web page where you can run and see the test results.

Command-Line

    USAGE

        fox [modules] [options]

    OPTIONS

        -b    --browser    Publishes the tests on localhost:7559
        -g    --grep       Run tests matching with given pattern
        -t    --timeout    Set test-case timeout in milliseconds [2000]
        -v    --version    Show version and exit
        -h    --help       Show help and exit

JavaScript API


describe('#Foo', function self(){
  
  self.testsuite.onError(function(error, test){
    console.log('%s throws %s', test.title, error)
  })
  
  it('will sing us a rap song', function(){
    throw new Error('fails immediately')
  })
 
})

Observing errors thrown by all testsuites;

var fox = require('fox');

fox.suites.onError(function(updates){
  
  errors.forEach(function(update){
    var error = update.params[0],
        test = update.params[1];
    
    console.log('%s throws %s', test.title, error.message);
  })
  
});

Migrating From Mocha

Unless you have nested describe calls, Fox can run your Mocha tests.

FAQs

Package last updated on 15 Jul 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc