Giter VIP home page Giter VIP logo

meteor-mocha-phantomjs's Introduction

dispatch:mocha-phantomjs

A Mocha test driver package for Meteor 1.3. This package reports server and client results in the server console and can be used for running tests on a CI server. This achieves what spacejam does but without the need for a separate Node package.

This package runs your client tests within a PhantomJS page. If you prefer a different solution, it should be possible to fork this package to make a variation that runs in Chrome or any other headless browser. If you do so, we can add a link to your package here.

Installation

In a Meteor 1.3+ app directory:

meteor add dispatch:mocha-phantomjs

NOTE: The PhantomJS package is a binary dependency, so you should also run meteor npm rebuild after installing if you are not on Mac OSX. See https://guide.meteor.com/v1.4/1.4-migration.html#binary-packages-require-build-toolchain

Run app unit tests

meteor test --once --driver-package dispatch:mocha-phantomjs

Run app unit tests in watch mode

TEST_WATCH=1 meteor test --driver-package dispatch:mocha-phantomjs

Run with a different server reporter

The default Mocha reporter for server tests is the "spec" reporter. You can set the SERVER_TEST_REPORTER environment variable to change it.

SERVER_TEST_REPORTER="dot" meteor test --once --driver-package dispatch:mocha-phantomjs

Run with a different client reporter

The default Mocha reporter for client tests is the "spec" reporter. You can set the CLIENT_TEST_REPORTER environment variable to change it.

CLIENT_TEST_REPORTER="tap" meteor test --once --driver-package dispatch:mocha-phantomjs

Because of the differences between client and server code, not all reporters will work as client reporters. "spec" and "tap" are confirmed to work.

NPM Scripts

A good best practice is to define these commands as run scripts in your app's package.json file. For example:

"scripts": {
  "test": "meteor test --once --driver-package dispatch:mocha-phantomjs",
  "test:watch": "TEST_WATCH=1 meteor test --driver-package dispatch:mocha-phantomjs",
  "start": "meteor run"
}

And then run npm test for one-time/CI mode or npm run test:watch to rerun the tests whenever you change a file.

meteor-mocha-phantomjs's People

Contributors

aldeed avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.