Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
63
gaia/tests/jsmarionette/mocha/mocha-json-proxy/test/helper.js
Executable file
63
gaia/tests/jsmarionette/mocha/mocha-json-proxy/test/helper.js
Executable file
|
|
@ -0,0 +1,63 @@
|
|||
'use strict';
|
||||
var exec = require('child_process').exec,
|
||||
fork = require('child_process').fork,
|
||||
EE = require('events').EventEmitter,
|
||||
debug = require('debug')('mocha-json-proxy:test');
|
||||
|
||||
|
||||
function forkFixture(test) {
|
||||
var reporterPath = __dirname + '/../reporter.js';
|
||||
var exec = __dirname + '/../../../../.bin/_mocha';
|
||||
var cmd = [
|
||||
'--reporter', reporterPath,
|
||||
'--ui', 'tdd',
|
||||
__dirname + '/fixtures/' + test
|
||||
];
|
||||
|
||||
var env = {};
|
||||
for (var key in process.env) {
|
||||
env[key] = process.env[key];
|
||||
}
|
||||
|
||||
var runnerOpts = {
|
||||
env: env
|
||||
};
|
||||
|
||||
// turn on the option to send messages directly between processes.
|
||||
runnerOpts.env[require(reporterPath).FORK_ENV] = true;
|
||||
|
||||
return fork(exec, cmd, runnerOpts);
|
||||
}
|
||||
|
||||
function runFixture(test, callback) {
|
||||
var cmd =
|
||||
__dirname + '/../../../../.bin/mocha' +
|
||||
' --ui tdd --reporter ' + __dirname + '/../reporter ' +
|
||||
__dirname + '/fixtures/' + test;
|
||||
|
||||
var emitter = new EE();
|
||||
exec(cmd, function(err, stdout, stderr) {
|
||||
debug('stdout', stdout);
|
||||
if (stderr) {
|
||||
console.error('ERR>>', stderr);
|
||||
}
|
||||
|
||||
callback(null, emitter);
|
||||
|
||||
var out = stdout.trim().split('\n');
|
||||
out.forEach(function(line) {
|
||||
var json;
|
||||
try {
|
||||
json = JSON.parse(line);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
emitter.emit.apply(emitter, json);
|
||||
});
|
||||
emitter.emit('helper end');
|
||||
});
|
||||
}
|
||||
|
||||
global.assert = require('chai').assert;
|
||||
global.runFixture = runFixture;
|
||||
global.forkFixture = forkFixture;
|
||||
Loading…
Reference in a new issue