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

grunt-mocha-phantomjs

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-mocha-phantomjs

Run client-side mocha tests using phantomjs

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
574
decreased by-80.28%
Maintainers
1
Weekly downloads
 
Created
Source

grunt-mocha-phantomjs

A simple wrapper to run client-side mochas tests using mocha-phantomjs

Getting Started

This plugin requires Grunt ~0.4.0

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-mocha-phantomjs --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-mocha-phantomjs');

The "mocha_phantomjs" task

Run this task with the grunt mocha_phantomjs command.

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

PhantomJS is installed when installing using NPM.

Options

reporter

Type: String
Default: spec

The reporter that should be used. See the supported reporters for more information.

urls

Type: Array
Default: []

Absolute http:// or https:// urls to be passed to PhantomJS. Specified URLs will be merged with any specified src files first. Note that urls must be served by a web server, and since this task doesn't contain a web server, one will need to be configured separately. The grunt-contrib-connect plugin provides a basic web server.

Additional arguments may be passed. See mocha-phantomjs's usage.

Usage examples

Basic usage
// Project configuration.
grunt.initConfig({
  mocha_phantomjs: {
    all: ['test/**/*.html']
  }
});
Local server

Include the [grunt-contrib-connect plugin][] to run a local server [grunt-contrib-connect plugin]: https://github.com/gruntjs/grunt-contrib-connect

// Project configuration.
grunt.initConfig({
  mocha_phantomjs: {
    all: {
      options: {
        urls: [
          'http://localhost:8000/test/foo.html',
          'http://localhost:8000/test/bar.html'
        ]
      }
    }
  },
  connect: {
      server: {
        options: {
          port: 8000,
          base: '.',
        }
      }
    }
});

grunt.registerTask('test', ['connect', 'mocha_phantomjs']);

Notes

This is a very basic implementation of mocha-phantomjs. Failed tests and errors do not bubble up for custom reporting. The idea of this is to be mainly used by a CI and let the CI manage the error reporting.

Keywords

FAQs

Package last updated on 28 Mar 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