npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grouch

v0.2.1

Published

Test runner and linter for any front end project

Downloads

41

Readme

NPM version Build Status

Grouch

Test runner for any front end project.

It runs unit test using jasmine and does code coverage using istanbul. It also supports karma to run tests in different browsers. It also does Javascript lint using Eslint.

Options

Options:
  -h, --help                       Show help.
  -v, --version                    Outputs the version number.
  -s, --src path::String           Source file location. - default: ./src/main
  -t, --srcTest path::String       Test file location - default: ./src/test
  -m, --mock [path::String]        Path of the mock files directory - default: []
  -c, --config path::String        Load configuration data from this file.
  -i, --ignorePath [path::String]  Supply a collection of ignore paths. - default: []
  --coverage                       Code coverage should be done. - default: true
  --lint                           Lint the Javascript code with eslint. - default: true
  -b, --browsers [String]          Run in different browsers using karma.

Usage

The project should be used as CLI tool so that's why we require it to be installed globally. The benefits for installing it at globally are:

  • Don't have to install inside each project
  • Is available as a executable on your path
  • You can use it on any project without any installation. Its like a software on your machine.

To install it at global level, open cmd and run this command

npm install -g grouch

If already installed use the following command to update it

npm update -g grouch

Now in your cmd window, you should be able to say

grouch -h

and it should display help i.e. all the options available. it would look similar to what you see under the options header on the top.

If you want to test your code

grouch -s src/main/js -t test/js -m test/mock1 -m test/mock2 -i **/src/main/**.min.js

The above command would get all the source files from src/main/js folder, get the test files from test/js. It will also load some mock files from test/mock1 and test/mock2. Mocks would be loaded be fore your source files test files when running the tests. Important thing to note here is that from the source folder it will ignore all the files which have a .min.js extension.

After running the top command, in side your project base you would see specRunner.html for your jasmine run, eslintReport.html for the Javascript lint for the srcFiles and you should see coverage folder. Inside coverage folder, you would see index.html,which has your code coverage stats.

Karma has been integrated with grouch. Use -b or --browsers option to specify which browser you want to run your tests on. We support the following browsers:

  • Internet Explorer (command use -b ie)
    • IE8 (command use -b ie8)
    • IE9 (command use -b ie9)
    • IE10 (command use -b ie10)
    • IE11 (command use -b ie11)
  • Chrome (command use -b chrome)
  • Firefox (command use -b firefox)
  • Safari (command use -b safari)
  • Opera (command use -b opera)

You can specify multiple browsers like this:

grouch -s src/main/js -t test/js -b chrome -b ie8 -b firefox

Make sure you have these browsers installed on your machine because karma uses the exe installed on the machine.

All the boolean options can be turned off by using the prefix --no-. Example --no-lint, --no-coverage.

Note: This project automatically loads jquery 1.11.2 version before your mocks, src and test files. If you project has jquery built into it then it will override the 1.11.2 version with your version. We also load sinonJs fake server module to be used to fake XMLHttpRequest.

Contribution

Please feel free to log issues and even send pull request for the changes. Make sure you log a issue before you send in a pull request and reference that issue in your pull request. That way everyone knows what did you fix or add to the project.

Future

Check out the Grouch Roadmap.