Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

python unittest integration for jshint

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 src
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.rst


This package integrates JSHint with Python's `unittest`_ module. This package was inspired by gocept.jslint.

JSHint is a community-driven tool to detect errors and potential problems in JavaScript code and to enforce your team's coding conventions.

It provides a special JSHintTestCase class that collects JavaScript files (in a configurable manner) and dynamically generates a test method for each file that calls jslint on that file.


To use it, create a test class like this:

class MyPackageJSLintTest(unittest_jshint.JSHintTestCase):

    include = (

    options = ( 'curly', 'eqeqeq', )

include is a list of "resource paths" of the form packagename:path (passed to pkg_resources).

exclude can be a list of filenames (without path) that will not be collected.

options is a list of arguments that are passed to JSHint (see its documentation for details). The default value is:

options = ()

All files ending in .js contained in each of these paths will be collected, and the test class will grow a method named test_<filename>.js.

You can ignore JSHint error by setting ignore on the test class (a list of substrings that are matched against each JHLint output line):

ignore = (
    "Use a named parameter",


unittest_jshint was tested with:

  • Python 2.6 (unittest2 required)
  • Python 2.7

Currently I only test with Python versions that are used by Plone so it just might work for other Python versions.

unittest_jshint requires jshint to be in the PATH or providing customized environmental variable UNITTEST_JSHINT_COMMAND.


Docutils System Messages

System Message: ERROR/3 (<string>, line 4); backlink

Unknown target name: "unittest".
Something went wrong with that request. Please try again.