Skip to content

Instantly share code, notes, and snippets.

var exec = require('child_process').exec
var spawn = require('child_process').spawn
var p = spawn('mocha', ['tests.js', '-R', 'tap'])
p.stdout.on('data', function(data){
process.stdout.write(data + '')
})
p.on('exit', function(){
process.exit(0)
})
setInterval(function(){}, 1000)

On Windows

B:\testem\node_bug>node -v
v0.8.6

B:\testem\node_bug>mocha -V
1.3.2

B:\testem\node_bug>node spawn.js

On Windows

B:\testem\node_bug>node -v
v0.8.6

B:\testem\node_bug>node spawn.js

B:\testem\node_bug>
$ mocha tests.js
․․
✔ 2 tests complete (3ms)
• 1 test pending
$ mocha tests.js -R tap
1..2
ok 1 something does type coersion with ==
@airportyh
airportyh / gist:3762060
Created September 21, 2012 15:08
Mongodb Group Statement
db.element_views.group({
key: {element_id: true}
, cond: {
browser: 'Chrome',
os: 'MacOS',
device_type: 'Desktop'
}
, reduce: function(v, prev){
prev.sum++
}
<!doctype html>
<html>
<head>
<title>Test Page</title>
<script src="jquery.js"></script>
<script>
$(function(){
$.ajax({
url: '/api',
success: function(data){
@airportyh
airportyh / gist:4230676
Created December 7, 2012 04:02
Saucelabs Node driver
var webdriver = require('wd')
, assert = require('assert');
var browser = webdriver.remote(
"ondemand.saucelabs.com"
, 80
, "username-string"
, "access-key-string"
);
launchers:
Node:
command: "mocha -R tap test/*_test.js"
protocol: "tap"
launch_in_dev:
- Node
- Chrome
launch_in_ci:
- Node
- Chrome
describe('stuff should break', function(){
it('should break', function(){
Foo()
})
})
describe('TEST', function(){
it('SHOULD PASS', function(){
"st".indexOf1('x')
})
})