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-testem-qunit

v0.1.1

Published

A module for integrating test execution via testem and qunit into your Mimosa app

Downloads

6

Readme

mimosa-testem-qunit

Overview

This is a Mimosa module that integrates testem + qunit into your RequireJS-enabled Mimosa application.

Client JavaScript testing requires a good deal of configuration to set up, as well as plenty of research and trial and error before you can start writing tests. The goal of this module is to keep the amount of configuration you need to create to a minimum. Out of the box it requires no configuration. The module writes its own configuration derived from your project. Include the module and start writing tests!

This module incorporates QUnit, Sinon, Testem and PhantomJS.

For more information regarding Mimosa, see http://mimosa.io

Usage

  • npm install -g phantomjs (If you are on Windows, this will not install phantomjs properly. You will need to download phantomjs from the site and add the executable to your PATH)
  • Add 'testem-qunit' to your list of modules. Mimosa will install the module for you when you start up.
  • Write tests! By default testem-qunit considers any file compiled/copied to watch.compiledDir that ends with -spec.js, _spec.js, -test.js or _test.js a test. Code your specs in watch.sourceDir and you can code it in CoffeeScript, LiveScript, whatever. Mimosa will treat it like any other piece of CoffeeScript.

Functionality

testem-qunit will create a series of assets it needs for testing in .mimosa/testemQUnit at the root of your project. That includes runner.html, qunit.js, qunit.css, sinon.js, and a copy of require.js. It also includes a file for kicking off tests, and a file declaring your test files and requirejs config that is dynamically generated based on your code.

testem-qunit also generates a testem.json config file for configuring the test running. By default that testem is configured to run all your qunit tests in a PhantomJS headless browser.

When mimosa starts up, testem-qunit will write all the assets and execute your tests. It will then execute those tests every time a JavaScript file changes. If all the tests pass, a message will say as much on the console and you will not be notified any other way. If tests fail, the console will have the details of the test failure and a Growl message will get sent letting you know a test has broken.

Command

mimosa testscript

The testscript command will drop a platform appropriate script in the root of your project that you can use to execute your testem tests directly. If you are writing tests or doing heavy test debugging, you will want to interact with testem directly and the script lets you do that. You will want to run this in conjunction with mimosa running, so that you tests get compiled/copied to the correct location and the configuration gets updated. Another Mimosa user found that you can run the script and Mimosa with one command, so you might want to try that out. You can also run quick mimosa builds if you don't want to run Mimosa in unison with the test script.

The script will be named test.[bat/sh]. The script takes a single option of ci. When ci is passed in, testem will run in ci mode.

mimosa testscript
test.sh
test.sh ci

Default Config

testemQUnit: {
  executeDuringBuild: true,
  executeDuringWatch: true,
  safeAssets: [],
  specConvention: /[_-](spec|test)\.js$/,
  assetFolder:".mimosa/testemQUnit",
  testemConfig: {
    "launch_in_dev": ["Firefox", "Chrome"],
    "launch_in_ci": ["PhantomJS"]
  },
  requireConfig: null
}

testemSimple: {
  configFile: testemQUnit.assetFolder + "testem.json",
  port: null,
  watch: [],
  exclude:[],
}
  • executeDuringBuild: Determines whether mimosa will automatically execute the tests during build.
  • executeDuringWatch: Determines whether mimosa will automatically execute the tests during watch as files are changed.
  • safeAssets: You may choose to alter the assets that Mimosa writes, for instance to use your own version of qunit. Mimosa by default will overwrite the files in this folder. If you don't want your file overwritten, add the name of the file to this array. Just the name, no paths necessary.
  • specConvention: This is the regex testem-qunit uses to identify your tests. It'll run this regex against every compiled file to determine if it is indeed a test and if it is, testem-qunit will include it in the list of tests to be run.
  • assetFolder: This is the folder testem-qunit places its assets.
  • testemConfig: This is testem's configuration. testem-qunit uses this default, which just defines the browsers to run the tests in, and then amplifies it with a few other computed properties
  • requireConfig This is the configuration used by require.js in your tests. By default testem-qunit derives this from your project. To see what it derives, look at .mimosa/testemQUnit/test-variables.js.
  • testemSimple: this module wraps the mimosa-testem-simple module. It overrides the testemSimple.configFile property to point at assetFolder + testem.json. The other testem-simple config can be updated/modified directly. See the config for testem-simple to see how you can use it via testem-qunit.