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

mimosa-karma

v0.0.2

Published

Mimosa module for kicking of your test suite against real browsers - whenever you make changes to your code!

Downloads

90

Readme

mimosa-karma

Overview

This is a Mimosa module for starting up a Karma test suite alongside Mimosa. This enables mimosa to give you instant feedback on your tests whenever your code changes.

For more information regarding Mimosa, see http://mimosajs.com

For more information regarding Karma, see http://karma-runner.github.io/

Usage

Add 'mimosa-karma' to your list of modules. Mimosa will install the module for you when you start up.

There are two approaches for configuring Karma, either run karma init or you can tweak your mimosa config.

To configure Karma with karma init, run karma init karma.conf.js. This will ask you a few questions and generate a config file for Karma named karma.conf.js.

If you prefer all your configuration to be in one place however, you can alternatively use your mimosa config file, adding the relevant configuration under a section named karma. The following link shows an example of how you can specify your karma configuration in Mimosa's config file eliminating the need for karma.conf.js: https://github.com/CraigCav/mimosa-karma/tree/master/example.

Example Usage using karma init

From the command prompt:

karma init

Which testing framework do you want to use?

jasmine

Do you want to use Require.js?

yes

Do you want to capture a browser automatically?

Chrome

Which files do you want to include with <script> tag?

tests/test.main.js

Which files do you want to test?

public/javascripts/**/*.js

tests/*spec.js

Any files you want to exclude?

Do you want Karma to watch all the files and run the tests on change?

yes

Config file generated at "C:\Code\mimosa-new\karma.conf.js"

In the above example we have a folder in the root of our Mimosa application called tests. Tests contains two files: a spec file test/example-view.spec.js which describes the functionality of app/example-view.js and test/main.js which is a file that configures RequireJS for loading the test suite. See http://karma-runner.github.io/0.8/plus/RequireJS.html for more details about configuring RequireJS with Karma.

Now open up the mimosa config file (e.g. mimosa-config.coffee) and mark that we wish to use an external karma configuration:

karma:
  configFile: 'karma.conf.js'
  externalConfig: true

Now run mimosa watch as usual. You should see the karma output whenever you save changes to a file. e.g.:

'Chrome 26.0 (Windows): Executed 1 of 1 SUCCESS (0.138 secs / 0.006 secs)'

Functionality

The mimosa-karma module will spin up a karma server whenever running mimosa watch --server, it will then let karma watch your configured list of files/and folders for changes and will then run your test suite.

Default Config

karma:
  configFile: 'karma.conf.js'
  externalConfig: false
  basePath: ''
  autoWatch: true
  • configFile: Optional path to an external karma configuration file, see: http://karma-runner.github.io/0.8/config/configuration-file.html. If an external karma configuration file is used, no other settings are needed.
  • externalConfig: Denotes whether or not an external karma configuration file is used, the default is false.
  • basePath: Base path that will be used to resolve all relative paths defined under files or exclude sections. The default is an empty string.
  • autoWatch: Enable or disable executing the tests whenever a watched file changes. The default is true (autowatch enabled).

Example Config

  karma: 
    files: [
      JASMINE: true,
      JASMINE_ADAPTER: true,
      REQUIRE: true,
      REQUIRE_ADAPTER: true,
      {pattern: 'public/javascripts/**/*.js', included: false },
      {pattern: 'tests/*spec.js', included: false},
      'tests/test.main.js'
    ]
    autoWatch: true
    browsers: ['Chrome']
  • files: List of files/patterns/adapters for karma to load in the browser.
  • autoWatch: Enable or disable executing the tests whenever one of these files changes.
  • browsers: A list of browsers to launch and capture. Once Karma is shut down, it will shut down these browsers as well. You can capture any browser manually just by opening a url, where Karma's web server is listening.Currently available: Chrome, ChromeCanary, Firefox, Opera, Safari (only Mac), PhantomJS, IE (only Windows).