Skip to content

Instantly share code, notes, and snippets.

@pascalopitz
Forked from Mindonaut/beforeTest.js
Created July 18, 2012 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pascalopitz/3134403 to your computer and use it in GitHub Desktop.
Save pascalopitz/3134403 to your computer and use it in GitHub Desktop.
Mocha command
requirejs = require('requirejs').config({
baseUrl: (function(){
var dir_tokens = __dirname.split('/');
dir_tokens.pop();
dir_tokens.push('lib');
return dir_tokens.join('/');
})(),
//Pass the top-level main.js/index.js require
//function to requirejs so that node modules
//are loaded relative to the top-level JS file.
nodeRequire: require
}); // LiveMvc uses require.js module format
expect = require('chai').expect; // Make expect function global
assert = require('chai').assert
if (typeof window == "undefined") {
// making the document object global
document = require("jsdom").jsdom("<html><head></head><body></body></html>", null, {
features:{
QuerySelector:true
}
});
// making the window object global
window = document.createWindow();
}
./node_modules/.bin/mocha \
--bail \
--require support/beforeTest.js \
--reporter spec \
--ui tdd \ ${NAME_OF_TEST_FILE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment